forked from MarseyWorld/MarseyWorld
fdssfd
parent
ebfb1ea7db
commit
4f12d7d9e9
|
@ -58,12 +58,18 @@ def revert_actions(v, username):
|
|||
cutoff = int(time.time()) - 86400
|
||||
|
||||
posts = [x[0] for x in g.db.query(ModAction.target_submission_id).filter(ModAction.user_id == user.id, ModAction.created_utc > cutoff, ModAction.kind == 'ban_post').all()]
|
||||
posts = g.db.query(Submission).filter_by(id.in_(posts)).all()
|
||||
|
||||
comments = [x[0] for x in g.db.query(ModAction.target_comment_id).filter(ModAction.user_id == user.id, ModAction.created_utc > cutoff, ModAction.kind == 'ban_comment').all()]
|
||||
comments = g.db.query(Comment).filter_by(id.in_(comments)).all()
|
||||
|
||||
for item in posts + comments:
|
||||
item.is_banned = False
|
||||
g.db.add(item)
|
||||
|
||||
users = (x[0] for x in g.db.query(ModAction.target_user_id).filter(ModAction.user_id == user.id, ModAction.created_utc > cutoff, ModAction.kind.in_(('shadowban', 'ban_user'))).all())
|
||||
users = g.db.query(User).filter_by(id.in_(users)).all()
|
||||
|
||||
for user in users:
|
||||
user.shadowbanned = None
|
||||
user.is_banned = 0
|
||||
|
|
Loading…
Reference in New Issue