From d11f821089800055a95fe0fb310830f3fce02c66 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 19 Feb 2024 01:09:09 +0200 Subject: [PATCH] fix this https://rdrama.net/h/changelog/post/165657/changelog-megathread-marseynotes/5971246#context --- files/routes/groups.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/files/routes/groups.py b/files/routes/groups.py index a3a95329b..401ad86bd 100644 --- a/files/routes/groups.py +++ b/files/routes/groups.py @@ -323,7 +323,13 @@ def group_usurp(v, group_name): Comment.body_html.like(search_html), ).first() - if is_active: + month_old_applications = g.db.query(GroupMembership.user_id).filter( + GroupMembership.group_name == group.name, + GroupMembership.approved_utc == None, + GroupMembership.created_utc < one_month_ago, + ).first() + + if is_active or not month_old_applications: abort(403, "The current regime has reviewed a membership application in the past month, so you can't usurp them!") send_repeatable_notification(group.owner_id, f"@{v.username} has usurped control of !{group.name} from you. This was possible because you (and your mods) have spent more than a month not reviewing membership applications. Be active next time sweaty :!marseycheeky:")