Properly handle redactions
This commit is contained in:
parent
2a3b1b82b3
commit
b2c009080d
|
@ -104,15 +104,19 @@ def filter_blacklisted(user, response):
|
||||||
response["redacted"] += 1
|
response["redacted"] += 1
|
||||||
# Anonymous
|
# Anonymous
|
||||||
if user.is_anonymous:
|
if user.is_anonymous:
|
||||||
response["hits"]["hits"].remove(item)
|
# Just set it to none so the index is not off
|
||||||
|
response["hits"]["hits"][index] = None
|
||||||
else:
|
else:
|
||||||
if not user.is_superuser:
|
if not user.is_superuser:
|
||||||
response["hits"]["hits"].remove(item)
|
response["hits"]["hits"][index] = None
|
||||||
else:
|
else:
|
||||||
response["hits"]["hits"][index]["_source"][
|
response["hits"]["hits"][index]["_source"][
|
||||||
"exemption"
|
"exemption"
|
||||||
] = True
|
] = True
|
||||||
|
|
||||||
|
# Actually get rid of all the things we set to None
|
||||||
|
response["hits"]["hits"] = [hit for hit in response["hits"]["hits"] if hit]
|
||||||
|
|
||||||
|
|
||||||
def run_main_query(client, user, query, custom_query=False, index=None, size=None):
|
def run_main_query(client, user, query, custom_query=False, index=None, size=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -10,22 +10,18 @@
|
||||||
<i class="fa-solid fa-chart-mixed"></i>
|
<i class="fa-solid fa-chart-mixed"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="nowrap-child">
|
<div class="nowrap-child">
|
||||||
<p>{{ card }} hits</p>
|
<p>fetched {{ results|length }} of {{ card }} hits in {{ took }}ms</p>
|
||||||
</div>
|
|
||||||
{% if redacted != 0 %}
|
|
||||||
<div class="nowrap-child">
|
|
||||||
<p>{{ redacted }} redacted</p>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
<div class="nowrap-child">
|
|
||||||
<p>{{ took }}ms</p>
|
|
||||||
</div>
|
</div>
|
||||||
{% if exemption is not None %}
|
{% if exemption is not None %}
|
||||||
<div class="nowrap-child">
|
<div class="nowrap-child">
|
||||||
<i class="fa-solid fa-book-bible"></i>
|
<i class="fa-solid fa-book-bible"></i>
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{% if redacted != 0 %}
|
||||||
|
<div class="nowrap-child">
|
||||||
|
<p>{{ redacted }} redacted</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|
Loading…
Reference in New Issue