forked from rDrama/rDrama
search comments within a specific thread
parent
503494f4af
commit
c2b892af04
|
@ -11,6 +11,7 @@ valid_params = [
|
||||||
'author',
|
'author',
|
||||||
'domain',
|
'domain',
|
||||||
'over18',
|
'over18',
|
||||||
|
"post",
|
||||||
search_operator_hole,
|
search_operator_hole,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -185,6 +186,14 @@ def searchcomments(v):
|
||||||
comments = g.db.query(Comment.id).join(Comment.post) \
|
comments = g.db.query(Comment.id).join(Comment.post) \
|
||||||
.filter(Comment.parent_submission != None, Comment.author_id.notin_(v.userblocks))
|
.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:
|
if 'author' in criteria:
|
||||||
comments = comments.filter(Comment.ghost == False)
|
comments = comments.filter(Comment.ghost == False)
|
||||||
author = get_user(criteria['author'])
|
author = get_user(criteria['author'])
|
||||||
|
|
|
@ -71,8 +71,19 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="pl-md-3">
|
<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') %}
|
||||||
<br>
|
<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>
|
<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>
|
<h1 class="h4 mb-0">{{query}}</h1>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue