From b2253f05748f5fde383ef0cc0a6aa64757ffa2a5 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 2 Aug 2023 01:18:57 +0300 Subject: [PATCH] approve ppl automatcailly into !verifiedrich --- files/routes/groups.py | 14 ++++++++++++-- files/templates/group_memberships.html | 4 ++-- files/templates/groups.html | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/files/routes/groups.py b/files/routes/groups.py index bc0cfbdd8..4d67ba75f 100644 --- a/files/routes/groups.py +++ b/files/routes/groups.py @@ -67,11 +67,21 @@ def create_group(v): def join_group(v, group_name): group_name = group_name.strip().lower() - if group_name == 'verifiedrich' and not v.patron: - abort(403, f"Only {patron}s can join !verifiedrich") + if group_name == 'verifiedrich': + if not v.patron: + abort(403, f"Only {patron}s can join !verifiedrich") + + join = GroupMembership( + user_id=v.id, + group_name=group_name, + approved_utc = time.time() + ) + g.db.add(join) + return {"message": "You have joined !verifiedrich successfully!"} group = g.db.get(Group, group_name) if not group: abort(404) + existing = g.db.query(GroupMembership).filter_by(user_id=v.id, group_name=group_name).one_or_none() if not existing: join = GroupMembership(user_id=v.id, group_name=group_name) diff --git a/files/templates/group_memberships.html b/files/templates/group_memberships.html index 9111875c0..fa8d1603d 100644 --- a/files/templates/group_memberships.html +++ b/files/templates/group_memberships.html @@ -4,14 +4,14 @@ {% if v.id != group.owner.id %} - + {% endif %}
diff --git a/files/templates/groups.html b/files/templates/groups.html index 1e8afeb6c..480edf01d 100644 --- a/files/templates/groups.html +++ b/files/templates/groups.html @@ -25,14 +25,14 @@ {{group.member_ids | length}} {% if v.id != group.owner.id %} - + {% endif %}