generate notifs for moving posts

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-09-29 08:05:42 +02:00
parent 7201d55f69
commit 87f3af5968
2 changed files with 13 additions and 0 deletions

View File

@ -74,6 +74,12 @@ def flag_post(pid, v):
)
g.db.add(ma)
if v.id != post.author_id:
if v.admin_level >= 3: position = 'Admin'
else: position = 'Mod'
message = f"@{v.username} ({position}) has moved [{post.title}]({post.shortlink}) to /h/{post.sub}"
send_repeatable_notification(post.author_id, message)
return {"message": f"Post moved to /h/{post.sub}"}
else:
existing = g.db.query(Flag.post_id).filter_by(user_id=v.id, post_id=post.id).one_or_none()

View File

@ -366,6 +366,13 @@ def kick(v, pid):
_note=f'{old_str} → main feed',
)
g.db.add(ma)
if v.id != post.author_id:
if v.admin_level >= 3: position = 'Admin'
else: position = 'Mod'
message = f"@{v.username} ({position}) has moved [{post.title}]({post.shortlink}) from /h/{old} to the main feed!"
send_repeatable_notification(post.author_id, message)
g.db.add(post)
cache.delete_memoized(frontlist)