forked from MarseyWorld/MarseyWorld
approve ppl automatcailly into !verifiedrich
parent
ffe1faa8cd
commit
b2253f0574
|
@ -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:
|
||||
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)
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
{% if v.id != group.owner.id %}
|
||||
<button id="leave-{{group}}" type="button" class="mt-4 btn btn-primary btn-block {% if v.id not in group.membership_user_ids %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/leave','leave-{{group}}','apply-{{group}}','d-none')">
|
||||
{%- if v.id in group.member_ids -%}
|
||||
{%- if v.id in group.member_ids or group.name == 'verifiedrich' -%}
|
||||
Leave
|
||||
{%- else -%}
|
||||
Cancel Application
|
||||
{%- endif -%}
|
||||
</button>
|
||||
|
||||
<button id="apply-{{group}}" type="button" class="mt-4 {% if v.id in group.membership_user_ids %}d-none{% endif %} btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/apply','leave-{{group}}','apply-{{group}}','d-none')">Apply to Join</button>
|
||||
<button id="apply-{{group}}" type="button" class="mt-4 {% if v.id in group.membership_user_ids %}d-none{% endif %} btn btn-primary btn-block" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/apply','leave-{{group}}','apply-{{group}}','d-none')">{% if group.name != 'verifiedrich' %}Apply to {% endif %}Join</button>
|
||||
{% endif %}
|
||||
|
||||
<br>
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
<a href="/!{{group}}">{{group.member_ids | length}}</a>
|
||||
{% if v.id != group.owner.id %}
|
||||
<button id="leave-{{group}}" type="button" class="ml-3 ml-md-5 btn btn-primary {% if v.id not in group.membership_user_ids %}d-none{% endif %}" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/leave','leave-{{group}}','apply-{{group}}','d-none')">
|
||||
{%- if v.id in group.member_ids -%}
|
||||
{%- if v.id in group.member_ids or group.name == 'verifiedrich' -%}
|
||||
Leave
|
||||
{%- else -%}
|
||||
Cancel Application
|
||||
{%- endif -%}
|
||||
</button>
|
||||
|
||||
<button id="apply-{{group}}" type="button" class="ml-3 ml-md-5 {% if v.id in group.membership_user_ids %}d-none{% endif %} btn btn-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/apply','leave-{{group}}','apply-{{group}}','d-none')">Apply to Join</button>
|
||||
<button id="apply-{{group}}" type="button" class="ml-3 ml-md-5 {% if v.id in group.membership_user_ids %}d-none{% endif %} btn btn-primary" data-nonce="{{g.nonce}}" data-onclick="postToastSwitch(this,'/!{{group}}/apply','leave-{{group}}','apply-{{group}}','d-none')">{% if group.name != 'verifiedrich' %}Apply to {% endif %}Join</button>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td data-time="{{group.created_utc}}"></td>
|
||||
|
|
Loading…
Reference in New Issue