Improve modal and implement deduplication
This commit is contained in:
@@ -254,14 +254,11 @@ class DrilldownContextModal(APIView):
|
||||
nicks = None
|
||||
query = False
|
||||
# Create the query params from the POST arguments
|
||||
mandatory = ["net", "channel", "num", "src", "index", "nick", "type"]
|
||||
mandatory = ["net", "channel", "num", "src", "index", "nick", "type", "mtype"]
|
||||
invalid = [None, False, "—", "None"]
|
||||
|
||||
query_params = {k: v for k, v in request.data.items() if v}
|
||||
|
||||
if query_params["index"] == "int":
|
||||
mandatory.append("mtype")
|
||||
|
||||
for key in query_params:
|
||||
if query_params[key] in invalid:
|
||||
query_params[key] = None
|
||||
@@ -314,13 +311,16 @@ class DrilldownContextModal(APIView):
|
||||
if query_params["src"] == "irc":
|
||||
if query_params["type"] in ["query", "notice", "msg", "highlight"]:
|
||||
annotate = True
|
||||
|
||||
results = query_results(
|
||||
request, query_params, annotate=annotate, custom_query=search_query
|
||||
request,
|
||||
query_params,
|
||||
annotate=annotate,
|
||||
custom_query=search_query,
|
||||
reverse=True,
|
||||
dedup_fields=["net", "type", "msg"],
|
||||
)
|
||||
if "message" in results:
|
||||
return render(request, self.template_name, results)
|
||||
results["object_list"] = results["object_list"][::-1]
|
||||
|
||||
# Make the time nicer
|
||||
# for index, item in enumerate(results["object_list"]):
|
||||
@@ -339,6 +339,7 @@ class DrilldownContextModal(APIView):
|
||||
"type": query_params["type"],
|
||||
"mtype": query_params["mtype"],
|
||||
"nick": query_params["nick"],
|
||||
"params": query_params,
|
||||
}
|
||||
if request.user.is_superuser:
|
||||
if query:
|
||||
|
||||
@@ -66,5 +66,6 @@ class DrilldownTable(Table):
|
||||
server = Column()
|
||||
mtype = Column()
|
||||
tokens = Column()
|
||||
hidden = Column()
|
||||
template_name = "ui/drilldown/table_results.html"
|
||||
paginate_by = settings.DRILLDOWN_RESULTS_PER_PAGE
|
||||
|
||||
Reference in New Issue
Block a user