fix 500 error

master
Aevann 2024-10-29 20:41:52 +03:00
parent 998d41635a
commit a4beb8a3a8
3 changed files with 4 additions and 4 deletions

View File

@ -922,7 +922,7 @@ class User(Base):
q = q.filter(ModAction.kind.notin_(AEVANN_EXCLUDED_MODACTION_KINDS)) q = q.filter(ModAction.kind.notin_(AEVANN_EXCLUDED_MODACTION_KINDS))
if self.admin_level < PERMS['PROGSTACK']: if self.admin_level < PERMS['PROGSTACK']:
q = q.filter(ModAction.kind.notin_(MODACTION_PRIVILEGED__TYPES)) q = q.filter(ModAction.kind.notin_(MODACTION_PRIVILEGED__KINDS))
return q.count() return q.count()

View File

@ -479,12 +479,12 @@ MODACTION_PRIVILEGED_KINDS = {
'insert_transaction', 'insert_transaction',
'change_under_siege', 'change_under_siege',
} }
MODACTION_PRIVILEGED__TYPES = {'progstack_post', 'progstack_comment', MODACTION_PRIVILEGED__KINDS = {'progstack_post', 'progstack_comment',
'unprogstack_post', 'unprogstack_comment'} 'unprogstack_post', 'unprogstack_comment'}
MODACTION_KINDS_FILTERED = deepcopy({t:v for t,v in MODACTION_KINDS.items() MODACTION_KINDS_FILTERED = deepcopy({t:v for t,v in MODACTION_KINDS.items()
if not t in MODACTION_PRIVILEGED_KINDS}) if not t in MODACTION_PRIVILEGED_KINDS})
MODACTION_KINDS__FILTERED = deepcopy({t:v for t,v in MODACTION_KINDS.items() MODACTION_KINDS__FILTERED = deepcopy({t:v for t,v in MODACTION_KINDS.items()
if not t in MODACTION_PRIVILEGED__TYPES}) if not t in MODACTION_PRIVILEGED__KINDS})
AEVANN_EXCLUDED_MODACTION_KINDS = {'pin_post', 'unpin_post', AEVANN_EXCLUDED_MODACTION_KINDS = {'pin_post', 'unpin_post',
'pin_comment', 'unpin_comment', 'pin_comment', 'unpin_comment',
'approve_emoji', 'reject_emoji', 'approve_emoji', 'reject_emoji',

View File

@ -269,7 +269,7 @@ def notifications_modactions(v):
listing = listing.filter(cls.kind.notin_(AEVANN_EXCLUDED_MODACTION_KINDS)) listing = listing.filter(cls.kind.notin_(AEVANN_EXCLUDED_MODACTION_KINDS))
if v.admin_level < PERMS['PROGSTACK']: if v.admin_level < PERMS['PROGSTACK']:
listing = listing.filter(cls.kind.notin_(MODACTION_PRIVILEGED__TYPES)) listing = listing.filter(cls.kind.notin_(MODACTION_PRIVILEGED__KINDS))
if cls == HoleAction: if cls == HoleAction:
listing = listing.filter(cls.hole.in_(v.moderated_holes)) listing = listing.filter(cls.hole.in_(v.moderated_holes))