make modmail appear in /search/messages
parent
890fedf1f3
commit
8085fa3351
|
@ -53,7 +53,10 @@ def notifications_modmail(v):
|
|||
try: page = max(int(request.values.get("page", 1)), 1)
|
||||
except: page = 1
|
||||
|
||||
comments = g.db.query(Comment).filter(Comment.sentto==2).order_by(Comment.id.desc()).offset(PAGE_SIZE*(page-1)).limit(PAGE_SIZE+1).all()
|
||||
comments = g.db.query(Comment).filter_by(
|
||||
sentto=MODMAIL_ID,
|
||||
level=1,
|
||||
).order_by(Comment.id.desc()).offset(PAGE_SIZE*(page-1)).limit(PAGE_SIZE+1).all()
|
||||
next_exists = (len(comments) > PAGE_SIZE)
|
||||
listing = comments[:PAGE_SIZE]
|
||||
|
||||
|
|
|
@ -297,11 +297,15 @@ def searchmessages(v:User):
|
|||
|
||||
criteria = searchparse(query)
|
||||
|
||||
dm_conditions = [Comment.author_id == v.id, Comment.sentto == v.id]
|
||||
if v.admin_level >= PERMS['VIEW_MODMAIL']:
|
||||
dm_conditions.append(Comment.sentto == MODMAIL_ID),
|
||||
|
||||
comments = g.db.query(Comment.id) \
|
||||
.filter(
|
||||
Comment.sentto != None,
|
||||
or_(Comment.author_id == v.id, Comment.sentto == v.id),
|
||||
Comment.parent_submission == None,
|
||||
or_(*dm_conditions),
|
||||
)
|
||||
|
||||
if 'author' in criteria:
|
||||
|
|
|
@ -605,7 +605,7 @@ def messagereply(v:User):
|
|||
parent_comment_id=id,
|
||||
top_comment_id=parent.top_comment_id,
|
||||
level=parent.level + 1,
|
||||
sentto=user_id,
|
||||
sentto=parent.sentto,
|
||||
body=body,
|
||||
body_html=body_html,
|
||||
)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
select id from comments where parent_submission is null and sentto is null and (top_comment_id in (select id from comments where sentto = 2) or parent_comment_id in (select id from comments where sentto = 2));
|
Loading…
Reference in New Issue