diff --git a/drama/classes/comment.py b/drama/classes/comment.py index fd78ea65c..1e01ba132 100644 --- a/drama/classes/comment.py +++ b/drama/classes/comment.py @@ -146,18 +146,6 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): if self.post: return f"{self.post.permalink}/{self.id}/" else: return f"/comment/{self.id}/" - @property - def any_descendants_live(self): - - if self.replies == []: - return False - - if any([not x.is_banned and x.deleted_utc == 0 for x in self.replies]): - return True - - else: - return any([x.any_descendants_live for x in self.replies]) - def rendered_comment(self, v=None, render_replies=True, standalone=False, level=1, **kwargs): @@ -205,7 +193,7 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): 'id': self.base36id, 'fullname': self.fullname, 'level': self.level, - 'author_name': self.author.username if not self.author.deleted_utc > 0 else None, + 'author_name': self.author.username, 'body': self.body, 'body_html': self.body_html, 'is_archived': self.is_archived, @@ -405,14 +393,10 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): return data - @property - def is_exiled_for(self): - return self.__dict__.get('_is_exiled_for', None) - @property @lazy def is_op(self): - return self.author_id==self.post.author_id and not self.author.deleted_utc > 0 and not self.post.author.deleted_utc > 0 and not self.post.deleted_utc + return self.author_id==self.post.author_id diff --git a/drama/classes/mod_logs.py b/drama/classes/mod_logs.py index a07a65eea..f12bf053f 100644 --- a/drama/classes/mod_logs.py +++ b/drama/classes/mod_logs.py @@ -68,10 +68,7 @@ class ModAction(Base, Stndrd, Age_times): @property def target_link(self): if self.target_user: - if self.target_user.deleted_utc: - return "[deleted user]" - else: - return f'{self.target_user.username}' + return f'{self.target_user.username}' elif self.target_post: return f'{self.target_post.title}' elif self.target_comment: @@ -117,14 +114,7 @@ class ModAction(Base, Stndrd, Age_times): @property def permalink(self): - return f"/log/{self.base36id}" - @property - def title_text(self): - if self.user.deleted_utc: - return f"[deleted user] {self.actiontype['title'].format(self=self)}" - else: - return f"@{self.user.username} {self.actiontype['title'].format(self=self)}" - + return f"/log/{self.base36id}" diff --git a/drama/classes/submission.py b/drama/classes/submission.py index f715bbf22..2bdb75fb4 100644 --- a/drama/classes/submission.py +++ b/drama/classes/submission.py @@ -265,7 +265,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): @property def json_raw(self): - data = {'author_name': self.author.username if not self.author.deleted_utc > 0 else None, + data = {'author_name': self.author.username, 'permalink': self.permalink, 'is_banned': bool(self.is_banned), 'deleted_utc': self.deleted_utc, diff --git a/drama/classes/user.py b/drama/classes/user.py index e0142a060..c230ab9a8 100644 --- a/drama/classes/user.py +++ b/drama/classes/user.py @@ -610,22 +610,12 @@ class User(Base, Stndrd, Age_times): 'ban_reason': self.ban_reason, 'id': self.base36id } - - elif self.deleted_utc: - return {'username': self.username, - 'permalink': self.permalink, - 'deleted_utc': True, - 'id': self.base36id - } return self.json_raw @property def json(self): data = self.json_core - if self.deleted_utc > 0 or self.is_banned: - return data - data["badges"] = [x.json_core for x in self.badges] data['dramacoins'] = int(self.dramacoins) data['post_count'] = self.post_count @@ -637,20 +627,6 @@ class User(Base, Stndrd, Age_times): def can_use_darkmode(self): return True - # return self.referral_count or self.has_earned_darkmode or - # self.has_badge(16) or self.has_badge(17) - - @property - def is_valid(self): - if self.is_banned and self.unban_utc == 0: - return False - - elif self.deleted_utc: - return False - - else: - return True - def ban(self, admin=None, reason=None, days=0): if days > 0: diff --git a/drama/routes/login.py b/drama/routes/login.py index 96e03e1a5..67d66f6eb 100644 --- a/drama/routes/login.py +++ b/drama/routes/login.py @@ -60,8 +60,7 @@ def login_post(): if "@" in username: account = g.db.query(User).filter( - User.email.ilike(username), - User.deleted_utc == False).first() + User.email.ilike(username)).first() else: account = get_user(username, graceful=True) @@ -69,10 +68,6 @@ def login_post(): time.sleep(random.uniform(0, 2)) return render_template("login.html", failed=True, i=random_image()) - if account.deleted_utc: - time.sleep(random.uniform(0, 2)) - return render_template("login.html", failed=True, i=random_image()) - # test password if request.form.get("password"): @@ -417,8 +412,7 @@ def post_forgot(): user = g.db.query(User).filter( User.username.ilike(username), - User.email.ilike(email), - User.deleted_utc == False).first() + User.email.ilike(email)).first() if user: # generate url diff --git a/drama/routes/search.py b/drama/routes/search.py index 5a739a628..8d8c6ae93 100644 --- a/drama/routes/search.py +++ b/drama/routes/search.py @@ -55,7 +55,6 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None): posts=posts.filter( Submission.author_id==get_user(criteria['author']).id, User.is_private==False, - User.deleted_utc==False ) if 'domain' in criteria: diff --git a/drama/routes/users.py b/drama/routes/users.py index 9ebb4f786..d8143c9be 100644 --- a/drama/routes/users.py +++ b/drama/routes/users.py @@ -264,13 +264,6 @@ def u_username(username, v=None): g.db.add(view) - if u.deleted_utc > 0 and (not v or v.admin_level < 3): - return {'html': lambda: render_template("userpage_deleted.html", - u=u, - v=v), - 'api': lambda: {"error": "That user deactivated their account."} - } - if u.is_private and (not v or (v.id != u.id and v.admin_level < 3)): return {'html': lambda: render_template("userpage_private.html", u=u, diff --git a/drama/templates/comments.html b/drama/templates/comments.html index a151c198d..e11f05f84 100644 --- a/drama/templates/comments.html +++ b/drama/templates/comments.html @@ -124,7 +124,7 @@ {% if c.is_blocking %} {% endif %} {% if c.is_blocked %} {% endif %} - {% if c.author.deleted_utc > 0 %}[deleted account]{% else %}{{c.author.username}}{% if c.author.customtitle %}  {{c.author.customtitle | safe}}{% endif %}{% endif %} + {{c.author.username}}{% if c.author.customtitle %}  {{c.author.customtitle | safe}}{% endif %}  {{c.age_string}} {% if c.edited_utc %} diff --git a/drama/templates/modlog.html b/drama/templates/modlog.html index 4330273e1..c86ffde4c 100644 --- a/drama/templates/modlog.html +++ b/drama/templates/modlog.html @@ -39,11 +39,7 @@
- {% if not ma.user.deleted_utc > 0 %} - @{{ma.user.username}} - {% else %} - [deleted user] - {% endif %} + @{{ma.user.username}} {{ma.string | safe}}
diff --git a/drama/templates/submission.html b/drama/templates/submission.html index a6916a03a..e7227b765 100644 --- a/drama/templates/submission.html +++ b/drama/templates/submission.html @@ -26,23 +26,23 @@ {% if comment_info and not comment_info.is_banned and not linked_comment.deleted_utc > 0 %} -{{'@'+comment_info.author.username if not comment_info.author.deleted_utc > 0 else '[deleted account]'}} comments on "{{title}} - Drama" +{{'@'+comment_info.author.username comments on "{{title}} - Drama" - + {% if comment_info.edited_utc %}{% endif %} - - + + - - + + @@ -55,11 +55,11 @@ {{title | safe}} - Drama - + {% if p.edited_utc %}{% endif %} - + @@ -68,7 +68,7 @@ - + @@ -96,7 +96,7 @@