"Leave" instead of "Kick" when its myself

master
Aevann 2023-05-16 13:40:57 +03:00
parent 6c97b77f4c
commit d6df16394f
2 changed files with 9 additions and 8 deletions

View File

@ -176,14 +176,15 @@ def group_reject(v:User, group_name, user_id):
if not membership:
abort(404, "There is no membership to reject!")
if membership.approved_utc:
text = f"@{v.username} (!{group}'s owner) has kicked you from the group!"
msg = f"You have kicked @{membership.user.username} successfully!"
if v.id == membership.user_id:
msg = f"You have left !{group} successfully!"
else:
text = f"@{v.username} (!{group}'s owner) has rejected your application!"
msg = f"You have rejected @{membership.user.username} successfully!"
if v.id != membership.user_id:
if membership.approved_utc:
text = f"@{v.username} (!{group}'s owner) has kicked you from the group!"
msg = f"You have kicked @{membership.user.username} successfully!"
else:
text = f"@{v.username} (!{group}'s owner) has rejected your application!"
msg = f"You have rejected @{membership.user.username} successfully!"
send_repeatable_notification(membership.user_id, text)
g.db.delete(membership)

View File

@ -59,7 +59,7 @@
{% if v.id == group.owner.id or v.admin_level >= PERMS['MODS_EVERY_GROUP'] %}
<td>
<div id="kick-{{membership.user_id}}" {% if name == 'applications' %}class="d-none"{% endif %}>
<button type="button" class="btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="reject_membership(this,'{{group}}','{{membership.user_id}}')">Kick</button>
<button type="button" class="btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="reject_membership(this,'{{group}}','{{membership.user_id}}')">{% if v.id == membership.user_id %}Leave{% else %}Kick{% endif %}</button>
</div>
<div {% if name == 'members' %}class="d-none"{% endif %}>