linkify under siege modlogs
parent
b00c72b0b6
commit
5b3af82751
|
@ -301,7 +301,9 @@ class Comment(Base):
|
||||||
def shortlink(self):
|
def shortlink(self):
|
||||||
if self.wall_user_id:
|
if self.wall_user_id:
|
||||||
return f"/@{self.wall_user.username}/wall/comment/{self.id}#context"
|
return f"/@{self.wall_user.username}/wall/comment/{self.id}#context"
|
||||||
return f"{self.post.shortlink}/{self.id}#context"
|
if self.parent_post:
|
||||||
|
return f"{self.post.shortlink}/{self.id}#context"
|
||||||
|
return f"/notification/{self.id}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -548,6 +548,8 @@ def execute_under_siege(v, target, body, kind):
|
||||||
reason = f'report on <a href="{target.permalink}">post</a>'
|
reason = f'report on <a href="{target.permalink}">post</a>'
|
||||||
else:
|
else:
|
||||||
reason = f'report on <a href="{target.permalink}">comment</a>'
|
reason = f'report on <a href="{target.permalink}">comment</a>'
|
||||||
|
elif hasattr(target, 'permalink'):
|
||||||
|
reason = f'<a href="{target.permalink}">{kind}</a>'
|
||||||
else:
|
else:
|
||||||
reason = kind
|
reason = kind
|
||||||
|
|
||||||
|
@ -564,15 +566,6 @@ def execute_under_siege(v, target, body, kind):
|
||||||
)
|
)
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
|
|
||||||
if kind == 'message':
|
|
||||||
notified_ids = [x[0] for x in g.db.query(User.id).filter(
|
|
||||||
User.admin_level >= PERMS['BLACKJACK_NOTIFICATIONS'],
|
|
||||||
User.id != AEVANN_ID,
|
|
||||||
)]
|
|
||||||
for uid in notified_ids:
|
|
||||||
n = Notification(comment_id=target.id, user_id=uid)
|
|
||||||
g.db.add(n)
|
|
||||||
|
|
||||||
def process_options(v, target):
|
def process_options(v, target):
|
||||||
|
|
||||||
patterns = [(poll_regex, 0), (choice_regex, 1)]
|
patterns = [(poll_regex, 0), (choice_regex, 1)]
|
||||||
|
|
Loading…
Reference in New Issue