fsd
This commit is contained in:
parent
f8bb7a99be
commit
fd655eadec
12 changed files with 105 additions and 31 deletions
|
@ -48,6 +48,14 @@ if site_name == "Drama":
|
|||
"color": "text-pink",
|
||||
"price": 500
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
|
@ -74,7 +82,15 @@ else:
|
|||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
}
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class Comment(Base):
|
|||
senttouser = relationship("User", primaryjoin="User.id==Comment.sentto", viewonly=True)
|
||||
parent_comment = relationship("Comment", remote_side=[id], viewonly=True)
|
||||
child_comments = relationship("Comment", remote_side=[parent_comment_id], viewonly=True)
|
||||
#awards = relationship("AwardRelationship", viewonly=True)
|
||||
awards = relationship("AwardRelationship", viewonly=True)
|
||||
|
||||
awards = None
|
||||
|
||||
|
|
|
@ -175,22 +175,22 @@ ACTIONTYPES={
|
|||
},
|
||||
"pin_comment":{
|
||||
"str":'pinned a {self.target_link}',
|
||||
"icon":"fa-thumbtack fa-rotate--45",
|
||||
"icon":"fa-thumbtack",
|
||||
"color": "bg-info",
|
||||
},
|
||||
"unpin_comment":{
|
||||
"str":'un-pinned a {self.target_link}',
|
||||
"icon":"fa-thumbtack fa-rotate--45",
|
||||
"icon":"fa-thumbtack",
|
||||
"color": "bg-muted",
|
||||
},
|
||||
"pin_post":{
|
||||
"str":'pinned post {self.target_link}',
|
||||
"icon":"fa-thumbtack fa-rotate--45",
|
||||
"icon":"fa-thumbtack",
|
||||
"color": "bg-success",
|
||||
},
|
||||
"unpin_post":{
|
||||
"str":'un-pinned post {self.target_link}',
|
||||
"icon":"fa-thumbtack fa-rotate--45",
|
||||
"icon":"fa-thumbtack",
|
||||
"color": "bg-muted",
|
||||
},
|
||||
"set_nsfw":{
|
||||
|
|
|
@ -64,7 +64,15 @@ if site_name == "Drama":
|
|||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
}
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
|
@ -91,7 +99,15 @@ else:
|
|||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
}
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
|
||||
class User(Base):
|
||||
|
|
|
@ -1040,7 +1040,9 @@ def api_sticky_post(post_id, v):
|
|||
|
||||
post = g.db.query(Submission).options(lazyload('*')).filter_by(id=post_id).first()
|
||||
if post:
|
||||
if post.stickied: post.stickied = None
|
||||
if post.stickied:
|
||||
if post.stickied.startswith("t:"): abort(403)
|
||||
else: post.stickied = None
|
||||
else: post.stickied = v.username
|
||||
g.db.add(post)
|
||||
|
||||
|
|
|
@ -51,7 +51,15 @@ def shop(v):
|
|||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
}
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
|
@ -77,8 +85,16 @@ def shop(v):
|
|||
"description": "Summons a train on the post.",
|
||||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
}
|
||||
"price": 50
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
|
||||
query = g.db.query(
|
||||
|
@ -152,7 +168,15 @@ def buy(v, award):
|
|||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
}
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
else:
|
||||
AWARDS = {
|
||||
|
@ -179,7 +203,15 @@ def buy(v, award):
|
|||
"icon": "fas fa-train",
|
||||
"color": "text-pink",
|
||||
"price": 500
|
||||
}
|
||||
},
|
||||
"pin": {
|
||||
"kind": "pin",
|
||||
"title": "1-Hour Pin",
|
||||
"description": "Pins the post.",
|
||||
"icon": "fas fa-thumbtack",
|
||||
"color": "text-warning",
|
||||
"price": 750
|
||||
},
|
||||
}
|
||||
|
||||
if award not in AWARDS: abort(400)
|
||||
|
@ -233,8 +265,8 @@ def award_post(pid, v):
|
|||
|
||||
post = g.db.query(Submission).options(lazyload('*')).filter_by(id=pid).first()
|
||||
|
||||
if not post or post.is_banned or post.deleted_utc > 0:
|
||||
return {"error": "That post doesn't exist or has been deleted or removed."}, 404
|
||||
if not post:
|
||||
return {"error": "That post doesn't exist."}, 404
|
||||
|
||||
existing_award = g.db.query(AwardRelationship).options(lazyload('*')).filter(
|
||||
and_(
|
||||
|
@ -272,6 +304,11 @@ def award_post(pid, v):
|
|||
g.db.add(author)
|
||||
link = f"[this post]({post.permalink})"
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!")
|
||||
elif kind == "pin":
|
||||
if post.stickied and post.stickied.startswith("t:"): t = int(post.stickied[2:]) + 600
|
||||
else: t = int(time.time()) + 3600
|
||||
post.stickied = f"t:{t}"
|
||||
g.db.add(post)
|
||||
|
||||
post.author.received_award_count += 1
|
||||
g.db.add(post.author)
|
||||
|
@ -307,8 +344,8 @@ def award_comment(cid, v):
|
|||
|
||||
c = g.db.query(Comment).options(lazyload('*')).filter_by(id=cid).first()
|
||||
|
||||
if not c or c.is_banned or c.deleted_utc > 0:
|
||||
return {"error": "That comment doesn't exist or has been deleted or removed."}, 404
|
||||
if not c:
|
||||
return {"error": "That comment doesn't exist."}, 404
|
||||
|
||||
existing_award = g.db.query(AwardRelationship).options(lazyload('*')).filter(
|
||||
and_(
|
||||
|
@ -324,8 +361,7 @@ def award_comment(cid, v):
|
|||
msg = f"@{v.username} has given your [comment]({c.permalink}) the {AWARDS[kind]['title']} Award!"
|
||||
|
||||
note = request.values.get("note", "").strip()
|
||||
if note:
|
||||
msg += f"\n\n> {note}"
|
||||
if note: msg += f"\n\n> {note}"
|
||||
|
||||
send_notification(NOTIFICATIONS_ACCOUNT, c.author, msg)
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
|||
|
||||
posts = posts[:size]
|
||||
|
||||
pins = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.stickied != None)
|
||||
pins = g.db.query(Submission.id).options(lazyload('*')).filter(Submission.stickied != None, Submission.is_banned == False)
|
||||
if v and v.admin_level == 0:
|
||||
blocking = [x[0] for x in g.db.query(UserBlock.target_id).filter_by(user_id=v.id).all()]
|
||||
blocked = [x[0] for x in g.db.query(UserBlock.user_id).filter_by(target_id=v.id).all()]
|
||||
|
|
|
@ -104,6 +104,10 @@ def api_vote_post(post_id, new, v):
|
|||
g.db.add(post)
|
||||
g.db.commit()
|
||||
except: g.db.rollback()
|
||||
|
||||
if post.stickied and post.stickied.startswith("t:") and int(time.time()) > int(post.stickied[2:]):
|
||||
post.stickied = None
|
||||
g.db.add(post)
|
||||
return "", 204
|
||||
|
||||
@app.post("/vote/comment/<comment_id>/<new>")
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
@media (min-width: 767.98px) {
|
||||
.award-columns {
|
||||
column-count: 5 !important;
|
||||
column-count: 6 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -263,7 +263,7 @@
|
|||
{% if c.active_flags %}<a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" href="javascript:void(0)" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags}} Reports</a>{% endif %}
|
||||
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if v and v.admin_level==6 and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Shadowbanned by @{{c.author.shadowbanned}}"></i>{% endif %}
|
||||
{% if c.is_pinned %}<i class="text-admin fas fa-thumbtack fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned by @{{c.is_pinned}}"></i>{% endif %}
|
||||
{% if c.is_pinned %}<i class="text-admin fas fa-thumbtack" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned by @{{c.is_pinned}}"></i>{% endif %}
|
||||
{% if c.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
|
||||
{% if c.is_op %}<i class="fas fa-microphone-stand text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="OP"></i>{% endif %}
|
||||
{% if c.is_bot %}<i class="fad fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Bot"></i>{% endif %}
|
||||
|
@ -435,9 +435,9 @@
|
|||
{% endif %}
|
||||
|
||||
{% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %}
|
||||
<a id="unpin-{{c.id}}" class="{% if c.is_pinned %}d-md-inline-block{% endif %} list-inline-item text-muted d-none text-info" href="javascript:void(0)" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/pin_comment/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Unpin</a>
|
||||
<a id="unpin-{{c.id}}" class="{% if c.is_pinned %}d-md-inline-block{% endif %} list-inline-item text-muted d-none text-info" href="javascript:void(0)" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/pin_comment/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack text-info fa-fw"></i>Unpin</a>
|
||||
|
||||
<a id="pin-{{c.id}}" class="{% if not c.is_pinned %}d-md-inline-block{% endif %} list-inline-item text-muted d-none text-info" href="javascript:void(0)" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/pin_comment/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</a>
|
||||
<a id="pin-{{c.id}}" class="{% if not c.is_pinned %}d-md-inline-block{% endif %} list-inline-item text-muted d-none text-info" href="javascript:void(0)" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3('/pin_comment/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack text-info fa-fw"></i>Pin</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
@ -579,8 +579,8 @@
|
|||
{% endif %}
|
||||
|
||||
{% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %}
|
||||
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" href="javascript:void(0)" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info"></i>Pin</a>
|
||||
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" href="javascript:void(0)" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info"></i>Unpin</a>
|
||||
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" href="javascript:void(0)" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack text-info"></i>Pin</a>
|
||||
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" href="javascript:void(0)" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2('/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack text-info"></i>Unpin</a>
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
|
|
|
@ -375,8 +375,8 @@
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if v and v.admin_level==6 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Shadowbanned by @{{p.author.shadowbanned}}"></i>{% endif %}
|
||||
{% if p.stickied %}<i class="fas fa-thumbtack fa-fw text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned by @{{p.stickied}}"></i>{% endif %}
|
||||
{% if p.is_pinned %}<i class="fas fa-thumbtack fa-fw text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned to profile"></i>{% endif %}
|
||||
{% if p.stickied %}<i class="fas fa-thumbtack fa-fw text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned {% if p.stickied.startswith('t:') %}until {{p.stickied[2:]}}{% else %}by @{{p.stickied}}{%endif%}"></i>{% endif %}
|
||||
{% if p.is_pinned %}<i class="fas fa-thumbtack fa-fw text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned to profile"></i>{% endif %}
|
||||
{% if p.distinguish_level %} <i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
|
||||
{% if p.is_bot %} <i class="fad fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Bot"></i>{% endif %}
|
||||
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
|
|
|
@ -174,9 +174,9 @@
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if v and v.admin_level==6 and p.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Shadowbanned by @{{p.author.shadowbanned}}"></i>{% endif %}
|
||||
{% if p.stickied %}<i class="fas fa-thumbtack text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned by @{{p.stickied}}"></i>{% endif %}
|
||||
{% if p.stickied %}<i class="fas fa-thumbtack text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned {% if p.stickied.startswith('t:') %}until {{p.stickied[2:]}}{% else %}by @{{p.stickied}}{%endif%}"></i>{% endif %}
|
||||
{% if p.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="{{'SITE_NAME' | app_config}} Admin, speaking officially"></i>{% endif %}
|
||||
{% if p.is_pinned and request.path.startswith('/@') %}<i class="fas fa-thumbtack text-admin fa-rotate--45" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned to profile"></i>{% endif %}
|
||||
{% if p.is_pinned and request.path.startswith('/@') %}<i class="fas fa-thumbtack text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Pinned to profile"></i>{% endif %}
|
||||
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if p.is_bot %} <i class="fad fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Bot"></i>{% endif %}
|
||||
{% if p.is_blocking %}<i class="fas fa-user-minus text-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="You're blocking this user, but you can see this post because {{'it\'s pinned' if p.stickied else 'you\'re an admin'}}."></i>{% endif %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue