sneed
This commit is contained in:
parent
7071ab7665
commit
9094f0249d
1 changed files with 38 additions and 35 deletions
|
@ -581,47 +581,50 @@ def api_comment(v):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if not shadowbanned:
|
||||||
|
# queue up notification for parent author
|
||||||
|
notify_users = set()
|
||||||
|
|
||||||
# queue up notification for parent author
|
for x in g.db.query(Subscription.user_id).filter_by(submission_id=c.parent_submission).all():
|
||||||
notify_users = set()
|
notify_users.add(x)
|
||||||
|
|
||||||
for x in g.db.query(Subscription.user_id).filter_by(submission_id=c.parent_submission).all():
|
if parent.author.id != v.id: notify_users.add(parent.author.id)
|
||||||
notify_users.add(x)
|
|
||||||
|
|
||||||
if parent.author.id != v.id: notify_users.add(parent.author.id)
|
soup = BeautifulSoup(body_html, features="html.parser")
|
||||||
|
mentions = soup.find_all("a", href=re.compile("^/@(\w+)"))
|
||||||
|
for mention in mentions:
|
||||||
|
username = mention["href"].split("@")[1]
|
||||||
|
|
||||||
soup = BeautifulSoup(body_html, features="html.parser")
|
user = g.db.query(User).filter_by(username=username).first()
|
||||||
mentions = soup.find_all("a", href=re.compile("^/@(\w+)"))
|
|
||||||
for mention in mentions:
|
|
||||||
username = mention["href"].split("@")[1]
|
|
||||||
|
|
||||||
user = g.db.query(User).filter_by(username=username).first()
|
if user:
|
||||||
|
if v.any_block_exists(user):
|
||||||
|
continue
|
||||||
|
if user.id != v.id:
|
||||||
|
notify_users.add(user.id)
|
||||||
|
|
||||||
if user:
|
for x in notify_users:
|
||||||
if v.any_block_exists(user):
|
n = Notification(comment_id=c.id, user_id=x)
|
||||||
continue
|
g.db.add(n)
|
||||||
if user.id != v.id:
|
try: g.db.flush()
|
||||||
notify_users.add(user.id)
|
except: g.db.rollback()
|
||||||
|
|
||||||
for x in notify_users:
|
if parent.author.id != v.id:
|
||||||
n = Notification(comment_id=c.id, user_id=x)
|
beams_client.publish_to_interests(
|
||||||
g.db.add(n)
|
interests=[str(parent.author.id)],
|
||||||
try: g.db.flush()
|
publish_body={
|
||||||
except: g.db.rollback()
|
'web': {
|
||||||
|
'notification': {
|
||||||
if parent.author.id != v.id:
|
'title': f'New reply by @{v.username}',
|
||||||
beams_client.publish_to_interests(
|
'body': c.body,
|
||||||
interests=[str(parent.author.id)],
|
'deep_link': f'https://rdrama.net{c.permalink}?context=5#context',
|
||||||
publish_body={
|
},
|
||||||
'web': {
|
},
|
||||||
'notification': {
|
|
||||||
'title': f'New reply by @{v.username}',
|
|
||||||
'body': c.body,
|
|
||||||
'deep_link': f'https://rdrama.net{c.permalink}?context=5#context',
|
|
||||||
},
|
},
|
||||||
},
|
)
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# create auto upvote
|
# create auto upvote
|
||||||
vote = CommentVote(user_id=v.id,
|
vote = CommentVote(user_id=v.id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue