forked from rDrama/rDrama
search comments within a specific thread
parent
503494f4af
commit
c2b892af04
|
@ -11,6 +11,7 @@ valid_params = [
|
|||
'author',
|
||||
'domain',
|
||||
'over18',
|
||||
"post",
|
||||
search_operator_hole,
|
||||
]
|
||||
|
||||
|
@ -185,6 +186,14 @@ def searchcomments(v):
|
|||
comments = g.db.query(Comment.id).join(Comment.post) \
|
||||
.filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks))
|
||||
|
||||
|
||||
if 'post' in criteria:
|
||||
try: post = int(criteria['post'])
|
||||
except: return {"error": f"Post with id {post} does not exist."}
|
||||
print(post,flush=True)
|
||||
comments = comments.filter(Comment.parent_submission == post)
|
||||
|
||||
|
||||
if 'author' in criteria:
|
||||
comments = comments.filter(Comment.ghost == False)
|
||||
author = get_user(criteria['author'])
|
||||
|
|
|
@ -71,8 +71,19 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<div class="pl-md-3">
|
||||
<div class="text-muted text-small mb-1">Advanced search parameters (with examples): "author:quadnarca", "domain:reddit.com", "over18:true", "{{HOLE_NAME}}:music"<div>
|
||||
{% if not request.path.startswith('/search/users') %}
|
||||
<strong>Advanced search parameters (with examples)</strong>
|
||||
<ul class="mt-2">
|
||||
<li class="mb-1">author:quadnarca</li>
|
||||
<li class="mb-1">domain:reddit.com</li>
|
||||
<li class="mb-1">over18:true</li>
|
||||
<li class="mb-1">{{HOLE_NAME}}:music</li>
|
||||
{% if request.path.startswith('/search/comments') %}
|
||||
<li class="mb-1">post:504</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<br>
|
||||
{% endif %}
|
||||
<div class="text-muted text-small mb-1">Showing {% block listinglength %}{{listing | length}}{% endblock %} of {{total}} result{{'s' if total != 1 else ''}} for</div>
|
||||
<h1 class="h4 mb-0">{{query}}</h1>
|
||||
|
||||
|
|
Loading…
Reference in New Issue