vote realness is in user model

remotes/1693176582716663532/tmp_refs/heads/watchparty
justcool393 2022-10-11 23:47:47 -07:00
parent 81b2e04ff7
commit 941b5fa82d
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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,