handle this edge case https://rdrama.net/h/changelog/post/165657/changelog-megathread-marseynotes/5918908#context
parent
911ab38abb
commit
7e8ee81a16
|
@ -297,6 +297,13 @@ def group_usurp(v, group_name):
|
||||||
if is_active:
|
if is_active:
|
||||||
abort(403, f"@{group.owner.username} has reviewed a membership application in the past month, so you can't usurp them!")
|
abort(403, f"@{group.owner.username} has reviewed a membership application in the past month, so you can't usurp them!")
|
||||||
|
|
||||||
|
membership_applications = g.db.query(GroupMembership.user_id).filter_by(
|
||||||
|
group_name=group.name,
|
||||||
|
approved_utc=None,
|
||||||
|
).first()
|
||||||
|
if not membership_applications:
|
||||||
|
abort(403, f"There is currently no membership applications to !{group.name}, so usurping is not necessary!")
|
||||||
|
|
||||||
send_repeatable_notification(group.owner_id, f"@{v.username} has usurped control of !{group.name} from you. This was possible because you spent more than a month not reviewing membership applications. Be active next time sweaty :!marseycheeky:")
|
send_repeatable_notification(group.owner_id, f"@{v.username} has usurped control of !{group.name} from you. This was possible because you spent more than a month not reviewing membership applications. Be active next time sweaty :!marseycheeky:")
|
||||||
|
|
||||||
group.owner_id = v.id
|
group.owner_id = v.id
|
||||||
|
|
Loading…
Reference in New Issue