diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py
index 551977fcda..0470df7ee1 100644
--- a/files/classes/mod_logs.py
+++ b/files/classes/mod_logs.py
@@ -18,6 +18,8 @@ class ModAction(Base):
user = relationship("User", lazy="joined", primaryjoin="User.id==ModAction.user_id")
+ target_user = relationship("User", lazy="joined", primaryjoin="User.id==ModAction.target_user_id")
+ target_post = relationship("Submission", lazy="joined")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs:
@@ -69,10 +71,11 @@ class ModAction(Base):
def note(self):
if self.kind=="ban_user":
- if self.target_submission_id: return f'for post'
+ if self.target_post: return f'for post'
elif self.target_comment_id: return f'for comment'
else: return self._note
- else: return self._note or ""
+ else:
+ return self._note or ""
@note.setter
def note(self, x):
@@ -83,15 +86,18 @@ class ModAction(Base):
def string(self):
output = ACTIONTYPES[self.kind]["str"].format(self=self)
+
if self.note: output += f" ({self.note})"
+
return output
@property
@lazy
def target_link(self):
- if self.target_user_id: return f'{self.target_user.username}'
- elif self.target_submission_id: return f'{self.target_post.title.replace("<","").replace(">","")}'
- elif self.target_comment_id: return f'comment'
+ if self.target_user: return f'{self.target_user.username}'
+ elif self.target_post: return f'{self.target_post.title.replace("<","").replace(">","")}'
+ elif self.target_comment: return f'comment'
+ else: return ""
@property
@lazy