From 941b5fa82dacf9e5cfcfa9cd5e9e2f925a10becd Mon Sep 17 00:00:00 2001 From: justcool393 Date: Tue, 11 Oct 2022 23:47:47 -0700 Subject: [PATCH 1/2] vote realness is in user model --- files/classes/user.py | 8 ++++++++ files/routes/votes.py | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 0547c4fe6..e3f19d4f3 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -289,6 +289,14 @@ class User(Base): if self.bite: return "565656" return self.namecolor + @property + @lazy + def is_votes_real(self): + if self.is_suspended_permanently or self.shadowbanned: return False + if self.agendaposter: return False + if self.profile_url.startswith('/e/') and not self.customtitle and self.namecolor == DEFAULT_COLOR: return False + return True + @lazy def mods(self, sub): if self.is_suspended_permanently or self.shadowbanned: return False diff --git a/files/routes/votes.py b/files/routes/votes.py index 18fc7ec85..76a3df77d 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -98,9 +98,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls): target.author.truecoins += coin_delta g.db.add(target.author) - if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url.startswith('/e/') and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False - else: real = True - + real = new != 1 or v.is_votes_real vote = None if vote_cls == Vote: vote = Vote(user_id=v.id, From bb1658e0a0380f2d74f3fc35974ca84063e5180c Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 12 Oct 2022 00:03:08 -0700 Subject: [PATCH 2/2] WPD: remove vestigial social and music filer code --- files/routes/front.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index 1b10d4787..2d6b856a8 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -120,19 +120,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" if v: size = v.frontsize or 0 else: size = 25 - if False: - posts = posts.offset(size * (page - 1)).limit(100).all() - social_found = False - music_found = False - for post in posts: - if post.sub == 'social': - if social_found: posts.remove(post) - else: social_found = True - elif post.sub == 'music': - if music_found: posts.remove(post) - else: music_found = True - else: - posts = posts.offset(size * (page - 1)).limit(size+1).all() + posts = posts.offset(size * (page - 1)).limit(size+1).all() next_exists = (len(posts) > size)