Implement adding the next relay
This commit is contained in:
parent
7b97c96be3
commit
29fa14bc98
|
@ -90,7 +90,10 @@ def get_aliases():
|
||||||
|
|
||||||
|
|
||||||
def add_relay(net, num):
|
def add_relay(net, num):
|
||||||
|
if num:
|
||||||
url = f"irc/network/{net}/{num}"
|
url = f"irc/network/{net}/{num}"
|
||||||
|
else:
|
||||||
|
url = f"irc/network/{net}"
|
||||||
payload = {}
|
payload = {}
|
||||||
created = threshold_request(url, payload, method="PUT")
|
created = threshold_request(url, payload, method="PUT")
|
||||||
return created
|
return created
|
||||||
|
|
|
@ -58,6 +58,7 @@ def annotate_results(results_parsed):
|
||||||
# Annotate the number channels the user is on
|
# Annotate the number channels the user is on
|
||||||
num_chans = annotate_num_chans(net, nicks)
|
num_chans = annotate_num_chans(net, nicks)
|
||||||
for item in results_parsed:
|
for item in results_parsed:
|
||||||
|
if "net" in item:
|
||||||
if item["net"] == net:
|
if item["net"] == net:
|
||||||
if "nick" in item:
|
if "nick" in item:
|
||||||
if item["nick"] in online_info:
|
if item["nick"] in online_info:
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button
|
<button
|
||||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||||
|
hx-put="{% url 'threshold_irc_network_actions_add_relay' net %}"
|
||||||
hx-trigger="click"
|
hx-trigger="click"
|
||||||
hx-target="#channels"
|
hx-target="#actions"
|
||||||
hx-swap="outerHTML"
|
hx-swap="outerHTML"
|
||||||
class="button is-success">
|
class="button is-success">
|
||||||
<span class="icon-text">
|
<span class="icon-text">
|
||||||
|
|
|
@ -235,8 +235,7 @@ class ThresholdIRCNetworkActionsRelay(SuperUserRequiredMixin, APIView):
|
||||||
Create a relay
|
Create a relay
|
||||||
"""
|
"""
|
||||||
if "num" not in request.data:
|
if "num" not in request.data:
|
||||||
message = "No num specified"
|
num = 0
|
||||||
message_class = "danger"
|
|
||||||
else:
|
else:
|
||||||
num = request.data["num"]
|
num = request.data["num"]
|
||||||
if not num.isdigit():
|
if not num.isdigit():
|
||||||
|
|
Loading…
Reference in New Issue