forked from MarseyWorld/MarseyWorld
Merge branch 'frost' into permissions-refactor
commit
c4c3d6cf49
|
@ -6038,6 +6038,7 @@ g {
|
|||
.fa-css3-alt:before{content:"\f38b"}
|
||||
.fa-landscape:before{content:"\e1b5"}
|
||||
.fa-user-ninja:before{content:"\f504"}
|
||||
.fa-club:before{content:"\f327"}
|
||||
|
||||
.pronouns {
|
||||
font-size: 9px;
|
||||
|
|
|
@ -419,7 +419,17 @@ ACTIONTYPES = {
|
|||
"str": 'updated marsey image',
|
||||
"icon": 'fa-cat',
|
||||
"color": 'bg-success'
|
||||
}
|
||||
},
|
||||
'club_post': {
|
||||
"str": 'moved post {self.target_link} to the {cc}',
|
||||
"icon": 'fa-club',
|
||||
"color": 'bg-success'
|
||||
},
|
||||
'unclub_post': {
|
||||
"str": 'removed post {self.target_link} from the {cc}',
|
||||
"icon": 'fa-club',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
}
|
||||
|
||||
ACTIONTYPES2 = deepcopy(ACTIONTYPES)
|
||||
|
|
|
@ -319,6 +319,8 @@ def club_allow(v, username):
|
|||
)
|
||||
g.db.add(ma)
|
||||
|
||||
send_repeatable_notification(u.id, f"@{v.username} (admin) has inducted you into the {CC_TITLE}!")
|
||||
|
||||
return {"message": f"@{u.username} has been allowed into the {CC_TITLE}!"}
|
||||
|
||||
@app.post("/@<username>/club_ban")
|
||||
|
@ -342,7 +344,9 @@ def club_ban(v, username):
|
|||
)
|
||||
g.db.add(ma)
|
||||
|
||||
return {"message": f"@{u.username} has been kicked from the {CC_TITLE}. Deserved."}
|
||||
send_repeatable_notification(u.id, f"@{v.username} (admin) has disallowed you from the {CC_TITLE}!")
|
||||
|
||||
return {"message": f"@{u.username} has been disallowed from the {CC_TITLE}. Deserved."}
|
||||
|
||||
|
||||
@app.get("/admin/shadowbanned")
|
||||
|
|
|
@ -28,21 +28,57 @@ import os
|
|||
titleheaders = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"}
|
||||
|
||||
|
||||
@app.post("/toggle_club/<pid>")
|
||||
@app.post("/club_post/<pid>")
|
||||
@auth_required
|
||||
def toggle_club(pid, v):
|
||||
def club_post(pid, v):
|
||||
if not FEATURES['COUNTRY_CLUB']:
|
||||
abort(403)
|
||||
|
||||
post = get_post(pid)
|
||||
if post.author_id != v.id and v.admin_level < PERMS['POST_COMMENT_MODERATION']: abort(403)
|
||||
|
||||
post.club = not post.club
|
||||
if not post.club:
|
||||
post.club = True
|
||||
g.db.add(post)
|
||||
|
||||
if post.author_id != v.id:
|
||||
ma = ModAction(
|
||||
kind = "club_post",
|
||||
user_id = v.id,
|
||||
target_submission_id = post.id,
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
if post.club: return {"message": "Post has been marked as club-only!"}
|
||||
else: return {"message": "Post has been unmarked as club-only!"}
|
||||
message = f"@{v.username} (admin) has moved [{post.title}]({post.shortlink}) to the {CC_TITLE}!"
|
||||
send_repeatable_notification(post.author_id, message)
|
||||
|
||||
return {"message": f"Post has been moved to the {CC_TITLE}!"}
|
||||
|
||||
@app.post("/unclub_post/<pid>")
|
||||
@auth_required
|
||||
def unclub_post(pid, v):
|
||||
if not FEATURES['COUNTRY_CLUB']:
|
||||
abort(403)
|
||||
|
||||
post = get_post(pid)
|
||||
if post.author_id != v.id and v.admin_level < 2: abort(403)
|
||||
|
||||
if post.club:
|
||||
post.club = False
|
||||
g.db.add(post)
|
||||
|
||||
if post.author_id != v.id:
|
||||
ma = ModAction(
|
||||
kind = "unclub_post",
|
||||
user_id = v.id,
|
||||
target_submission_id = post.id,
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
message = f"@{v.username} (admin) has removed [{post.title}]({post.shortlink}) from the {CC_TITLE}!"
|
||||
send_repeatable_notification(post.author_id, message)
|
||||
|
||||
return {"message": f"Post has been removed from the {CC_TITLE}!"}
|
||||
|
||||
|
||||
@app.post("/publish/<pid>")
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
|
||||
|
||||
{% if FEATURES['COUNTRY_CLUB'] -%}
|
||||
<button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-2"></i>Mark club</button>
|
||||
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye mr-2"></i>Unmark club</button>
|
||||
<button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" role="button" onclick="post_toast(this,'/club_post/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-2"></i>Mark club</button>
|
||||
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" role="button" onclick="post_toast(this,'/unclub_post/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye mr-2"></i>Unmark club</button>
|
||||
{%- endif %}
|
||||
{% else %}
|
||||
{% if not p.ghost %}
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
{% endif %}
|
||||
|
||||
{% if FEATURES['COUNTRY_CLUB'] -%}
|
||||
<button id="club2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-2"></i>Mark club</button>
|
||||
<button id="unclub2-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye mr-2"></i>Unmark club</button>
|
||||
<button id="club2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="post_toast(this,'/club_post/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-2"></i>Mark club</button>
|
||||
<button id="unclub2-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="post_toast(this,'/unclub_post/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye mr-2"></i>Unmark club</button>
|
||||
{%- endif %}
|
||||
{% if v.admin_level >= PERMS['POST_COMMENT_DISTINGUISH'] and (v.id == c.author_id or v.admin_level >= PERMS['POST_COMMENT_MODERATION']) %}
|
||||
<button id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="post_toast(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-2"></i>Distinguish</button>
|
||||
|
|
Loading…
Reference in New Issue