|
|
|
@ -255,33 +255,36 @@ class DrilldownContextModal(APIView):
|
|
|
|
|
# Create the query params from the POST arguments
|
|
|
|
|
mandatory = ["net", "channel", "num", "src", "index", "nick", "type"]
|
|
|
|
|
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
|
|
|
|
|
for key in mandatory:
|
|
|
|
|
if key not in query_params:
|
|
|
|
|
query_params[key] = None
|
|
|
|
|
if query_params["index"] == "int":
|
|
|
|
|
if "mtype" not in query_params:
|
|
|
|
|
query_params["mtype"] = None
|
|
|
|
|
|
|
|
|
|
type = None
|
|
|
|
|
if "type" in query_params:
|
|
|
|
|
type = query_params["type"]
|
|
|
|
|
if type == "znc":
|
|
|
|
|
query_params["channel"] = "*status"
|
|
|
|
|
|
|
|
|
|
if request.user.is_superuser:
|
|
|
|
|
if query_params["type"] in ["query", "notice"]:
|
|
|
|
|
if type in ["query", "notice"]:
|
|
|
|
|
nicks = [query_params["channel"], query_params["nick"]]
|
|
|
|
|
query_params["sorting"] = "desc"
|
|
|
|
|
if (
|
|
|
|
|
query_params["index"] == "int"
|
|
|
|
|
and query_params["mtype"] == "msg"
|
|
|
|
|
and not query_params["type"] == "query"
|
|
|
|
|
and not type == "query"
|
|
|
|
|
):
|
|
|
|
|
query_params["index"] = "main"
|
|
|
|
|
|
|
|
|
|
type = None
|
|
|
|
|
if "type" in query_params:
|
|
|
|
|
type = query_params["type"]
|
|
|
|
|
if type == "znc":
|
|
|
|
|
query_params["channel"] = "*status"
|
|
|
|
|
|
|
|
|
|
# Create the query with the context helper
|
|
|
|
|
search_query = construct_query(
|
|
|
|
|
query_params["index"],
|
|
|
|
|