This commit is contained in:
Aevann1 2021-11-22 16:16:58 +02:00
parent d006ed0896
commit e35cbd9147
8 changed files with 23 additions and 25 deletions

View file

@ -995,15 +995,13 @@ def api_sticky_post(post_id, v):
if post.stickied:
if v.id != post.author_id:
message = f"@{v.username} has pinned your [post](/post/{post_id})!"
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.body == message).first()
if not existing: send_notification(post.author_id, message)
send_notification(post.author_id, message)
g.db.commit()
return {"message": "Post pinned!"}
else:
if v.id != post.author_id:
message = f"@{v.username} has unpinned your [post](/post/{post_id})!"
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.body == message).first()
if not existing: send_notification(post.author_id, message)
send_notification(post.author_id, message)
g.db.commit()
return {"message": "Post unpinned!"}