From 38305331b6399233023160072bf318ef780efa7c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 22 Sep 2021 00:11:06 +0200 Subject: [PATCH] fdsfs --- files/classes/mod_logs.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 551977fcd..0470df7ee 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