|
@ -1014,6 +1014,8 @@ def edit_channel(request, code): |
|
|
return webhook_form(request, channel=channel) |
|
|
return webhook_form(request, channel=channel) |
|
|
if channel.kind == "sms": |
|
|
if channel.kind == "sms": |
|
|
return sms_form(request, channel=channel) |
|
|
return sms_form(request, channel=channel) |
|
|
|
|
|
if channel.kind == "signal": |
|
|
|
|
|
return signal_form(request, channel=channel) |
|
|
|
|
|
|
|
|
return HttpResponseBadRequest() |
|
|
return HttpResponseBadRequest() |
|
|
|
|
|
|
|
@ -1720,28 +1722,41 @@ def add_whatsapp(request, code): |
|
|
|
|
|
|
|
|
@require_setting("SIGNAL_CLI_ENABLED") |
|
|
@require_setting("SIGNAL_CLI_ENABLED") |
|
|
@login_required |
|
|
@login_required |
|
|
def add_signal(request, code): |
|
|
|
|
|
project = _get_rw_project_for_user(request, code) |
|
|
|
|
|
|
|
|
def signal_form(request, channel=None, code=None): |
|
|
|
|
|
is_new = channel is None |
|
|
|
|
|
if is_new: |
|
|
|
|
|
project = _get_rw_project_for_user(request, code) |
|
|
|
|
|
channel = Channel(project=project, kind="signal") |
|
|
|
|
|
|
|
|
if request.method == "POST": |
|
|
if request.method == "POST": |
|
|
form = forms.PhoneUpDownForm(request.POST) |
|
|
form = forms.PhoneUpDownForm(request.POST) |
|
|
if form.is_valid(): |
|
|
if form.is_valid(): |
|
|
channel = Channel(project=project, kind="signal") |
|
|
|
|
|
channel.name = form.cleaned_data["label"] |
|
|
channel.name = form.cleaned_data["label"] |
|
|
channel.value = form.get_json() |
|
|
channel.value = form.get_json() |
|
|
channel.save() |
|
|
channel.save() |
|
|
|
|
|
|
|
|
channel.assign_all_checks() |
|
|
|
|
|
return redirect("hc-channels", project.code) |
|
|
|
|
|
else: |
|
|
|
|
|
|
|
|
if is_new: |
|
|
|
|
|
channel.assign_all_checks() |
|
|
|
|
|
return redirect("hc-channels", channel.project.code) |
|
|
|
|
|
elif is_new: |
|
|
form = forms.PhoneUpDownForm() |
|
|
form = forms.PhoneUpDownForm() |
|
|
|
|
|
else: |
|
|
|
|
|
form = forms.PhoneUpDownForm( |
|
|
|
|
|
{ |
|
|
|
|
|
"label": channel.name, |
|
|
|
|
|
"phone": channel.phone_number, |
|
|
|
|
|
"up": channel.signal_notify_up, |
|
|
|
|
|
"down": channel.signal_notify_down, |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
ctx = { |
|
|
ctx = { |
|
|
"page": "channels", |
|
|
"page": "channels", |
|
|
"project": project, |
|
|
|
|
|
|
|
|
"project": channel.project, |
|
|
"form": form, |
|
|
"form": form, |
|
|
"profile": project.owner_profile, |
|
|
|
|
|
|
|
|
"is_new": is_new, |
|
|
} |
|
|
} |
|
|
return render(request, "integrations/add_signal.html", ctx) |
|
|
|
|
|
|
|
|
return render(request, "integrations/signal_form.html", ctx) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@require_setting("TRELLO_APP_KEY") |
|
|
@require_setting("TRELLO_APP_KEY") |
|
|