Prevent multiple matches to exemption rules incrementing the counter
This commit is contained in:
parent
66dc57dc45
commit
2a3b1b82b3
|
@ -96,6 +96,12 @@ def filter_blacklisted(user, response):
|
||||||
if blacklisted_item == str(content):
|
if blacklisted_item == str(content):
|
||||||
# Remove the item
|
# Remove the item
|
||||||
if item in response["hits"]["hits"]:
|
if item in response["hits"]["hits"]:
|
||||||
|
# Let the UI know something was redacted
|
||||||
|
if (
|
||||||
|
"exemption"
|
||||||
|
not in response["hits"]["hits"][index]["_source"]
|
||||||
|
):
|
||||||
|
response["redacted"] += 1
|
||||||
# Anonymous
|
# Anonymous
|
||||||
if user.is_anonymous:
|
if user.is_anonymous:
|
||||||
response["hits"]["hits"].remove(item)
|
response["hits"]["hits"].remove(item)
|
||||||
|
@ -107,9 +113,6 @@ def filter_blacklisted(user, response):
|
||||||
"exemption"
|
"exemption"
|
||||||
] = True
|
] = True
|
||||||
|
|
||||||
# Let the UI know something was redacted
|
|
||||||
response["redacted"] += 1
|
|
||||||
|
|
||||||
|
|
||||||
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):
|
||||||
"""
|
"""
|
||||||
|
@ -199,7 +202,7 @@ def query_results(request, size=None):
|
||||||
|
|
||||||
# Split the timestamp into date and time
|
# Split the timestamp into date and time
|
||||||
if "ts" not in element:
|
if "ts" not in element:
|
||||||
if "time" in element: # will fix data later
|
if "time" in element: # will fix data later
|
||||||
ts = element["time"]
|
ts = element["time"]
|
||||||
del element["time"]
|
del element["time"]
|
||||||
element["ts"] = ts
|
element["ts"] = ts
|
||||||
|
|
Loading…
Reference in New Issue