Recognise queries
This commit is contained in:
parent
a43bb5e861
commit
fdcfc715c8
|
@ -252,6 +252,7 @@ class DrilldownContextModal(APIView):
|
||||||
|
|
||||||
size = 20
|
size = 20
|
||||||
nicks = None
|
nicks = None
|
||||||
|
query = False
|
||||||
# Create the query params from the POST arguments
|
# Create the query params from the POST arguments
|
||||||
mandatory = ["net", "channel", "num", "src", "index", "nick", "type"]
|
mandatory = ["net", "channel", "num", "src", "index", "nick", "type"]
|
||||||
invalid = [None, False, "—", "None"]
|
invalid = [None, False, "—", "None"]
|
||||||
|
@ -269,15 +270,17 @@ class DrilldownContextModal(APIView):
|
||||||
query_params[key] = None
|
query_params[key] = None
|
||||||
|
|
||||||
type = None
|
type = None
|
||||||
|
# SUPERUSER BLOCK #
|
||||||
|
if request.user.is_superuser:
|
||||||
if "type" in query_params:
|
if "type" in query_params:
|
||||||
type = query_params["type"]
|
type = query_params["type"]
|
||||||
if type == "znc":
|
if type == "znc":
|
||||||
query_params["channel"] = "*status"
|
query_params["channel"] = "*status"
|
||||||
|
|
||||||
if request.user.is_superuser:
|
|
||||||
if type in ["query", "notice"]:
|
if type in ["query", "notice"]:
|
||||||
nicks = [query_params["channel"], query_params["nick"]]
|
nicks = [query_params["channel"], query_params["nick"]]
|
||||||
query_params["sorting"] = "desc"
|
query = True
|
||||||
|
|
||||||
if (
|
if (
|
||||||
query_params["index"] == "int"
|
query_params["index"] == "int"
|
||||||
and query_params["mtype"] == "msg"
|
and query_params["mtype"] == "msg"
|
||||||
|
@ -285,6 +288,17 @@ class DrilldownContextModal(APIView):
|
||||||
):
|
):
|
||||||
query_params["index"] = "main"
|
query_params["index"] = "main"
|
||||||
|
|
||||||
|
if query_params["type"] in ["znc", "auth"]:
|
||||||
|
query = True
|
||||||
|
|
||||||
|
# SUPERUSER BLOCK #
|
||||||
|
|
||||||
|
if not request.user.is_superuser:
|
||||||
|
if "index" in query_params:
|
||||||
|
query_params["index"] = "main"
|
||||||
|
|
||||||
|
query_params["sorting"] = "desc"
|
||||||
|
|
||||||
# Create the query with the context helper
|
# Create the query with the context helper
|
||||||
search_query = construct_query(
|
search_query = construct_query(
|
||||||
query_params["index"],
|
query_params["index"],
|
||||||
|
@ -326,7 +340,8 @@ class DrilldownContextModal(APIView):
|
||||||
"mtype": query_params["mtype"],
|
"mtype": query_params["mtype"],
|
||||||
"nick": query_params["nick"],
|
"nick": query_params["nick"],
|
||||||
}
|
}
|
||||||
if nicks:
|
if request.user.is_superuser:
|
||||||
|
if query:
|
||||||
context["query"] = True
|
context["query"] = True
|
||||||
|
|
||||||
return render(request, self.template_name, context)
|
return render(request, self.template_name, context)
|
||||||
|
|
Loading…
Reference in New Issue