move an if condition to push_notif()

pull/134/head
Aevann 2023-02-24 03:56:46 +02:00
parent 2caf9a9faf
commit 6755cbf28a
2 changed files with 8 additions and 6 deletions

View File

@ -140,6 +140,13 @@ def push_notif(uids, title, body, url):
if VAPID_PUBLIC_KEY == DEFAULT_CONFIG_VALUE:
return
if isinstance(url, tuple):
cid, posting_to_submission = url
if posting_to_submission:
url = f'{SITE_FULL}/comment/{cid}?read=true#context'
else:
url = f'{SITE_FULL}/@{c.wall_user.username}/wall/comment/{cid}?read=true#context'
if len(body) > PUSH_NOTIF_LIMIT:
body = body[:PUSH_NOTIF_LIMIT] + "..."

View File

@ -327,13 +327,8 @@ def comment(v:User):
if len(c.body) > PUSH_NOTIF_LIMIT: notifbody = c.body[:PUSH_NOTIF_LIMIT] + '...'
else: notifbody = c.body
if posting_to_submission:
url = f'{SITE_FULL}/comment/{c.id}?read=true#context'
else:
url = f'{SITE_FULL}/@{c.wall_user.username}/wall/comment/{c.id}?read=true#context'
if parent_user.id != AEVANN_ID:
push_notif({parent_user.id}, title, notifbody, url)
push_notif({parent_user.id}, title, notifbody, (c.id,posting_to_submission))
vote = CommentVote(user_id=v.id,
comment_id=c.id,