don't unnecessarily filter
parent
24082d178a
commit
047a3fa44f
|
@ -950,8 +950,10 @@ def get_saves_and_subscribes(v, template, relationship_cls, page:int, standalone
|
|||
ids = [x[0] for x in g.db.query(query).join(join).filter(relationship_cls.user_id == v.id).order_by(cls.created_utc.desc()).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()]
|
||||
next_exists = len(ids) > PAGE_SIZE
|
||||
ids = ids[:PAGE_SIZE]
|
||||
|
||||
extra = None if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] else lambda q:q.filter(cls.is_banned == False, cls.deleted_utc == 0)
|
||||
|
||||
extra = None
|
||||
if not v.admin_level >= PERMS['POST_COMMENT_MODERATION']:
|
||||
extra = lambda q:q.filter(cls.is_banned == False, cls.deleted_utc == 0)
|
||||
|
||||
if cls is Submission:
|
||||
listing = get_posts(ids, v=v, eager=True, extra=extra)
|
||||
|
@ -959,8 +961,6 @@ def get_saves_and_subscribes(v, template, relationship_cls, page:int, standalone
|
|||
listing = get_comments(ids, v=v, extra=extra)
|
||||
else:
|
||||
raise TypeError("Only supports Submissions and Comments. This is probably the result of a bug with *this* function")
|
||||
|
||||
listing = [item for item in listing if not (item.is_banned or item.deleted_utc)]
|
||||
|
||||
if v.client: return {"data": [x.json(g.db) for x in listing]}
|
||||
return render_template(template, u=v, v=v, listing=listing, page=page, next_exists=next_exists, standalone=standalone)
|
||||
|
|
Loading…
Reference in New Issue