Aevann 2024-05-23 03:59:05 +03:00
parent 20c3cad072
commit eeb3c10172
3 changed files with 4 additions and 7 deletions

View File

@ -142,9 +142,6 @@ def leave_chat(v, chat_id):
if not chat:
abort(404, "Chat not found!")
if v.id == chat.owner_id:
abort(403, "The chat owner can't leave it!")
membership = g.db.query(ChatMembership).filter_by(user_id=v.id, chat_id=chat_id).one_or_none()
if not membership:
abort(400, "You're not a member of this chat!")

View File

@ -27,9 +27,9 @@
</form>
<a href="/chat/{{chat.id}}/orgies" class="orgy-control fas fa-tv text-muted ml-2"></a>
{% else %}
<button id="leave-private-chat" type="submit" class="btn btn-danger ml-1 ml-md-3 px-2 text-small-sm" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/chat/{{chat.id}}/leave')">Leave</button>
{% endif %}
<button id="leave-private-chat" type="submit" class="btn btn-danger ml-1 ml-md-3 px-2 text-small-sm" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/chat/{{chat.id}}/leave')">Leave</button>
{% endif %}
<div id="chat-group-template" class="d-none">

View File

@ -16,10 +16,10 @@
{% if v.id == chat.owner_id %}
<a href="/chat/{{chat.id}}/orgies" class="orgy-control fas fa-tv text-muted ml-2"></a>
{% else %}
<button id="leave-private-chat" type="submit" class="btn btn-danger ml-1 ml-md-3 px-2 text-small-sm" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/chat/{{chat.id}}/leave')">Leave</button>
{% endif %}
<button id="leave-private-chat" type="submit" class="btn btn-danger ml-1 ml-md-3 px-2 text-small-sm" data-nonce="{{g.nonce}}" data-onclick="areyousure(this)" data-areyousure="postToastReload(this, '/chat/{{chat.id}}/leave')">Leave</button>
<div>
<p id="orgy-file-container" class="resizable">
{% if orgy.type == 'youtube' %}