diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py
index d56fd8f68..0696d28e2 100644
--- a/files/classes/mod_logs.py
+++ b/files/classes/mod_logs.py
@@ -40,10 +40,13 @@ class ModAction(Base):
@property
def note(self):
- if self.kind=="ban_user":
- if self.target_post: return f'for post'
- if self.target_comment: return f'for comment'
- else: return self._note
+ if self.kind == "ban_user":
+ if self.target_post_id:
+ return f'for post'
+ elif self.target_comment_id:
+ return f'for comment'
+ else:
+ return self._note
else:
return self._note or ""
@@ -57,10 +60,12 @@ class ModAction(Base):
@property
@lazy
def target_link(self):
- if self.target_user: return f'@{self.target_user.username}'
- elif self.target_post:
+ if self.target_user_id:
+ return f'@{self.target_user.username}'
+ elif self.target_post_id:
return censor_slurs(f'{self.target_post.title_html}', None)
- elif self.target_comment_id: return f'comment'
+ elif self.target_comment_id:
+ return f'comment'
@property
@lazy
diff --git a/files/classes/sub_logs.py b/files/classes/sub_logs.py
index f3c412e82..ebd65a509 100644
--- a/files/classes/sub_logs.py
+++ b/files/classes/sub_logs.py
@@ -25,6 +25,7 @@ class SubAction(Base):
user = relationship("User", primaryjoin="User.id==SubAction.user_id")
target_user = relationship("User", primaryjoin="User.id==SubAction.target_user_id")
target_post = relationship("Post")
+ target_comment = relationship("Comment")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
@@ -48,10 +49,12 @@ class SubAction(Base):
@property
@lazy
def target_link(self):
- if self.target_user: return f'@{self.target_user.username}'
- elif self.target_post:
+ if self.target_user_id:
+ return f'@{self.target_user.username}'
+ elif self.target_post_id:
return censor_slurs(f'{self.target_post.title_html}', None)
- elif self.target_comment_id: return f'comment'
+ elif self.target_comment_id:
+ return f'comment'
@property
@lazy