mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
Make notifications open comments below THREAD_CUTOFF_DEPTH
This commit is contained in:
parent
db6e198457
commit
11a4f1b101
1 changed files with 10 additions and 4 deletions
|
@ -1921,10 +1921,16 @@ def notify_about_post_reply(parent_reply: Union[PostReply, None], new_reply: Pos
|
||||||
send_notifs_to = set(notification_subscribers(parent_reply.id, NOTIF_REPLY))
|
send_notifs_to = set(notification_subscribers(parent_reply.id, NOTIF_REPLY))
|
||||||
for notify_id in send_notifs_to:
|
for notify_id in send_notifs_to:
|
||||||
if new_reply.user_id != notify_id:
|
if new_reply.user_id != notify_id:
|
||||||
|
if new_reply.depth <= THREAD_CUTOFF_DEPTH:
|
||||||
new_notification = Notification(title=shorten_string(_('Reply to comment on %(post_title)s',
|
new_notification = Notification(title=shorten_string(_('Reply to comment on %(post_title)s',
|
||||||
post_title=parent_reply.post.title), 50),
|
post_title=parent_reply.post.title), 50),
|
||||||
url=f"/post/{parent_reply.post.id}#comment_{new_reply.id}",
|
url=f"/post/{parent_reply.post.id}#comment_{new_reply.id}",
|
||||||
user_id=notify_id, author_id=new_reply.user_id)
|
user_id=notify_id, author_id=new_reply.user_id)
|
||||||
|
else:
|
||||||
|
new_notification = Notification(title=shorten_string(_('Reply to comment on %(post_title)s',
|
||||||
|
post_title=parent_reply.post.title), 50),
|
||||||
|
url=f"/post/{parent_reply.post.id}/comment/{parent_reply.id}#comment_{new_reply.id}",
|
||||||
|
user_id=notify_id, author_id=new_reply.user_id)
|
||||||
db.session.add(new_notification)
|
db.session.add(new_notification)
|
||||||
user = User.query.get(notify_id)
|
user = User.query.get(notify_id)
|
||||||
user.unread_notifications += 1
|
user.unread_notifications += 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue