|
|
|
@ -252,6 +252,7 @@ class DrilldownContextModal(APIView):
|
|
|
|
|
|
|
|
|
|
size = 20
|
|
|
|
|
nicks = None
|
|
|
|
|
query = False
|
|
|
|
|
# Create the query params from the POST arguments
|
|
|
|
|
mandatory = ["net", "channel", "num", "src", "index", "nick", "type"]
|
|
|
|
|
invalid = [None, False, "—", "None"]
|
|
|
|
@ -269,21 +270,34 @@ class DrilldownContextModal(APIView):
|
|
|
|
|
query_params[key] = None
|
|
|
|
|
|
|
|
|
|
type = None
|
|
|
|
|
if "type" in query_params:
|
|
|
|
|
type = query_params["type"]
|
|
|
|
|
if type == "znc":
|
|
|
|
|
query_params["channel"] = "*status"
|
|
|
|
|
|
|
|
|
|
# SUPERUSER BLOCK #
|
|
|
|
|
if request.user.is_superuser:
|
|
|
|
|
if "type" in query_params:
|
|
|
|
|
type = query_params["type"]
|
|
|
|
|
if type == "znc":
|
|
|
|
|
query_params["channel"] = "*status"
|
|
|
|
|
|
|
|
|
|
if type in ["query", "notice"]:
|
|
|
|
|
nicks = [query_params["channel"], query_params["nick"]]
|
|
|
|
|
query = True
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
query_params["index"] == "int"
|
|
|
|
|
and query_params["mtype"] == "msg"
|
|
|
|
|
and not type == "query"
|
|
|
|
|
):
|
|
|
|
|
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"
|
|
|
|
|
if (
|
|
|
|
|
query_params["index"] == "int"
|
|
|
|
|
and query_params["mtype"] == "msg"
|
|
|
|
|
and not type == "query"
|
|
|
|
|
):
|
|
|
|
|
query_params["index"] = "main"
|
|
|
|
|
|
|
|
|
|
# Create the query with the context helper
|
|
|
|
|
search_query = construct_query(
|
|
|
|
@ -326,8 +340,9 @@ class DrilldownContextModal(APIView):
|
|
|
|
|
"mtype": query_params["mtype"],
|
|
|
|
|
"nick": query_params["nick"],
|
|
|
|
|
}
|
|
|
|
|
if nicks:
|
|
|
|
|
context["query"] = True
|
|
|
|
|
if request.user.is_superuser:
|
|
|
|
|
if query:
|
|
|
|
|
context["query"] = True
|
|
|
|
|
|
|
|
|
|
return render(request, self.template_name, context)
|
|
|
|
|
|
|
|
|
|