forked from MarseyWorld/MarseyWorld
subs: fix exile behavior
parent
9ba1e96268
commit
753178a186
|
@ -289,10 +289,15 @@ class User(Base):
|
|||
if self.profile_url.startswith('/e/') and not self.customtitle and self.namecolor == DEFAULT_COLOR: return False
|
||||
return True
|
||||
|
||||
@lazy
|
||||
def actually_mods(self, sub):
|
||||
if not sub: return False
|
||||
return bool(g.db.query(Mod.user_id).filter_by(user_id=self.id, sub=sub).one_or_none())
|
||||
|
||||
@lazy
|
||||
def mods(self, sub):
|
||||
if self.is_suspended_permanently or self.shadowbanned: return False
|
||||
return self.admin_level >= PERMS['HOLE_GLOBAL_MODERATION'] or bool(g.db.query(Mod.user_id).filter_by(user_id=self.id, sub=sub).one_or_none())
|
||||
return self.admin_level >= PERMS['HOLE_GLOBAL_MODERATION'] or self.actually_mods(sub)
|
||||
|
||||
@lazy
|
||||
def exiled_from(self, sub):
|
||||
|
|
|
@ -166,7 +166,7 @@ PERMS = { # Minimum admin_level to perform action.
|
|||
'ADMIN_HOME_VISIBLE': 2,
|
||||
'DOMAINS_BAN': 3,
|
||||
'HOLE_CREATE': 0,
|
||||
'HOLE_GLOBAL_MODERATION': 4,
|
||||
'HOLE_GLOBAL_MODERATION': 3,
|
||||
'FLAGS_REMOVE': 2,
|
||||
'VOTES_VISIBLE': 0,
|
||||
'USER_BLOCKS_VISIBLE': 0,
|
||||
|
|
|
@ -53,7 +53,7 @@ def exile_comment(v, cid):
|
|||
|
||||
u = c.author
|
||||
|
||||
if u.mods(sub): abort(403)
|
||||
if u.actually_mods(sub): abort(403)
|
||||
|
||||
if not u.exiled_from(sub):
|
||||
exile = Exile(user_id=u.id, sub=sub, exiler_id=v.id)
|
||||
|
|
Loading…
Reference in New Issue