move an if condition to push_notif()
parent
2caf9a9faf
commit
6755cbf28a
|
@ -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] + "..."
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue