forked from rDrama/rDrama
remove insane bloat
parent
d4a99c05e9
commit
6b068de522
|
@ -288,16 +288,10 @@ class User(Base):
|
||||||
if self.agendaposter: return False
|
if self.agendaposter: return False
|
||||||
if self.profile_url.startswith('/e/') and not self.customtitle and self.namecolor == DEFAULT_COLOR: return False
|
if self.profile_url.startswith('/e/') and not self.customtitle and self.namecolor == DEFAULT_COLOR: return False
|
||||||
return True
|
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
|
@lazy
|
||||||
def mods(self, sub):
|
def mods(self, sub):
|
||||||
if self.is_suspended_permanently or self.shadowbanned: return False
|
if self.is_suspended_permanently or self.shadowbanned: return False
|
||||||
return self.admin_level >= PERMS['HOLE_GLOBAL_MODERATION'] or self.actually_mods(sub)
|
return bool(g.db.query(Mod.user_id).filter_by(user_id=self.id, sub=sub).one_or_none())
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def exiled_from(self, sub):
|
def exiled_from(self, sub):
|
||||||
|
@ -331,10 +325,7 @@ class User(Base):
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def mod_date(self, sub):
|
def mod_date(self, sub):
|
||||||
if self.admin_level >= PERMS['HOLE_GLOBAL_MODERATION']: return 1
|
return g.db.query(Mod.created_utc).filter_by(user_id=self.id, sub=sub).one()[0]
|
||||||
mod = g.db.query(Mod).filter_by(user_id=self.id, sub=sub).one_or_none()
|
|
||||||
if not mod: return None
|
|
||||||
return mod.created_utc
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
|
|
@ -166,7 +166,6 @@ PERMS = { # Minimum admin_level to perform action.
|
||||||
'ADMIN_HOME_VISIBLE': 2,
|
'ADMIN_HOME_VISIBLE': 2,
|
||||||
'DOMAINS_BAN': 3,
|
'DOMAINS_BAN': 3,
|
||||||
'HOLE_CREATE': 0,
|
'HOLE_CREATE': 0,
|
||||||
'HOLE_GLOBAL_MODERATION': 4,
|
|
||||||
'FLAGS_REMOVE': 2,
|
'FLAGS_REMOVE': 2,
|
||||||
'VOTES_VISIBLE': 0,
|
'VOTES_VISIBLE': 0,
|
||||||
'USER_BLOCKS_VISIBLE': 0,
|
'USER_BLOCKS_VISIBLE': 0,
|
||||||
|
|
|
@ -53,7 +53,7 @@ def exile_comment(v, cid):
|
||||||
|
|
||||||
u = c.author
|
u = c.author
|
||||||
|
|
||||||
if u.actually_mods(sub): abort(403)
|
if u.mods(sub): abort(403)
|
||||||
|
|
||||||
if not u.exiled_from(sub):
|
if not u.exiled_from(sub):
|
||||||
exile = Exile(user_id=u.id, sub=sub, exiler_id=v.id)
|
exile = Exile(user_id=u.id, sub=sub, exiler_id=v.id)
|
||||||
|
@ -359,16 +359,6 @@ def kick(v, pid):
|
||||||
old = post.sub
|
old = post.sub
|
||||||
post.sub = None
|
post.sub = None
|
||||||
|
|
||||||
if v.admin_level >= PERMS['HOLE_GLOBAL_MODERATION'] and v.id != post.author_id:
|
|
||||||
old_str = f'<a href="/h/{old}">/h/{old}</a>'
|
|
||||||
ma = ModAction(
|
|
||||||
kind='move_hole',
|
|
||||||
user_id=v.id,
|
|
||||||
target_submission_id=post.id,
|
|
||||||
_note=f'{old_str} → main feed',
|
|
||||||
)
|
|
||||||
g.db.add(ma)
|
|
||||||
else:
|
|
||||||
ma = SubAction(
|
ma = SubAction(
|
||||||
sub=old,
|
sub=old,
|
||||||
kind='kick_post',
|
kind='kick_post',
|
||||||
|
@ -378,9 +368,7 @@ def kick(v, pid):
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
|
|
||||||
if v.id != post.author_id:
|
if v.id != post.author_id:
|
||||||
if v.admin_level >= PERMS['HOLE_GLOBAL_MODERATION']: position = 'Admin'
|
message = f"@{v.username} (Mod) has moved [{post.title}]({post.shortlink}) from /h/{old} to the main feed!"
|
||||||
else: position = 'Mod'
|
|
||||||
message = f"@{v.username} ({position}) has moved [{post.title}]({post.shortlink}) from /h/{old} to the main feed!"
|
|
||||||
send_repeatable_notification(post.author_id, message)
|
send_repeatable_notification(post.author_id, message)
|
||||||
|
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
|
Loading…
Reference in New Issue