forked from MarseyWorld/MarseyWorld
fix prev commit
parent
747a880cdb
commit
668725266a
|
@ -41,9 +41,12 @@ class ModAction(Base):
|
||||||
@property
|
@property
|
||||||
def note(self):
|
def note(self):
|
||||||
if self.kind == "ban_user":
|
if self.kind == "ban_user":
|
||||||
if self.target_post: return f'for <a href="{self.target_post.permalink}">post</a>'
|
if self.target_post_id:
|
||||||
if self.target_comment: return f'for <a href="{self.target_comment.permalink}">comment</a>'
|
return f'for <a href="{self.target_post.permalink}">post</a>'
|
||||||
else: return self._note
|
elif self.target_comment_id:
|
||||||
|
return f'for <a href="{self.target_comment.permalink}">comment</a>'
|
||||||
|
else:
|
||||||
|
return self._note
|
||||||
else:
|
else:
|
||||||
return self._note or ""
|
return self._note or ""
|
||||||
|
|
||||||
|
@ -57,10 +60,12 @@ class ModAction(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def target_link(self):
|
def target_link(self):
|
||||||
if self.target_user: return f'<a href="{self.target_user.url}">@{self.target_user.username}</a>'
|
if self.target_user_id:
|
||||||
elif self.target_post:
|
return f'<a href="{self.target_user.url}">@{self.target_user.username}</a>'
|
||||||
|
elif self.target_post_id:
|
||||||
return censor_slurs(f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>', None)
|
return censor_slurs(f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>', None)
|
||||||
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}#context">comment</a>'
|
elif self.target_comment_id:
|
||||||
|
return f'<a href="{self.target_comment.permalink}">comment</a>'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -25,6 +25,7 @@ class SubAction(Base):
|
||||||
user = relationship("User", primaryjoin="User.id==SubAction.user_id")
|
user = relationship("User", primaryjoin="User.id==SubAction.user_id")
|
||||||
target_user = relationship("User", primaryjoin="User.id==SubAction.target_user_id")
|
target_user = relationship("User", primaryjoin="User.id==SubAction.target_user_id")
|
||||||
target_post = relationship("Post")
|
target_post = relationship("Post")
|
||||||
|
target_comment = relationship("Comment")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
@ -48,10 +49,12 @@ class SubAction(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def target_link(self):
|
def target_link(self):
|
||||||
if self.target_user: return f'<a href="{self.target_user.url}">@{self.target_user.username}</a>'
|
if self.target_user_id:
|
||||||
elif self.target_post:
|
return f'<a href="{self.target_user.url}">@{self.target_user.username}</a>'
|
||||||
|
elif self.target_post_id:
|
||||||
return censor_slurs(f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>', None)
|
return censor_slurs(f'<a href="{self.target_post.permalink}">{self.target_post.title_html}</a>', None)
|
||||||
elif self.target_comment_id: return f'<a href="/comment/{self.target_comment_id}#context">comment</a>'
|
elif self.target_comment_id:
|
||||||
|
return f'<a href="{self.target_comment.permalink}">comment</a>'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
Loading…
Reference in New Issue