Handle edge case where a circle was deleted more thoroughly

This commit is contained in:
Jonas Schäfer
2021-01-25 18:28:30 +01:00
parent c1132ae975
commit 174a2c3e14
4 changed files with 68 additions and 64 deletions

View File

@@ -1,5 +1,5 @@
{% extends "admin_app.html" %}
{% from "library.j2" import showuri, form_button, standard_button %}
{% from "library.j2" import showuri, form_button, standard_button, extract_circle_name %}
{% block head_lead %}
{{ super() }}
{% include "copy-snippet.html" %}
@@ -22,7 +22,7 @@
<dt>{% trans %}Circles{% endtrans %}</dt>
<dd><p>{% trans %}Users joining via this invitation will be added to the following circles:{% endtrans %}</p><ul>
{%- for group_id in invite.group_ids -%}
<li>{{ circle_map[group_id] | circle_name }}</li>
<li>{%- call extract_circle_name(circle_map, group_id) -%}{%- endcall -%}</li>
{%- endfor -%}
</ul></dd>
{%- else -%}
@@ -30,7 +30,7 @@
<dd>
{%- if ngroups == 1 -%}
{%- set group_id = invite.group_ids[0] -%}
<a href="{{ url_for(".edit_circle", id_=group_id) }}">{{ circle_map[invite.group_ids[0]] | circle_name }}</a>
{%- call extract_circle_name(circle_map, group_id) -%}{%- endcall -%}
{%- else -%}
<em>{% trans %}The user will not be added to any circle and will have no contacts.{% endtrans %}</em>
{%- endif -%}

View File

@@ -1,5 +1,5 @@
{% extends "admin_app.html" %}
{% from "library.j2" import action_button, icon, clipboard_button, form_button, custom_form_button %}
{% from "library.j2" import action_button, icon, clipboard_button, form_button, custom_form_button, extract_circle_name %}
{% block head_lead %}
{{ super() }}
{% include "copy-snippet.html" %}
@@ -34,12 +34,7 @@
{#- -#}
<ul class="inline">
{%- for group_id in invite.group_ids -%}
{%- set circle_info = circle_map[group_id] -%}
{%- if circle_info -%}
<li>{{ circle_map[group_id] | circle_name }}</li>
{%- else -%}
<li><em>{% trans %}deleted{% endtrans %}</em></li>
{%- endif -%}
<li>{%- call extract_circle_name(circle_map, group_id) -%}{%- endcall -%}</li>
{%- endfor -%}
</ul>
{#- -#}

View File

@@ -98,3 +98,12 @@
{%- endif -%}
{% endmacro %}
{% macro extract_circle_name(circle_map, id, caller=None) %}
{%- set circle_info = circle_map[id] -%}
{%- if circle_info -%}
<a href="{{ url_for('.edit_circle', id_=id) }}">{{ circle_info | circle_name }}</a>
{%- else -%}
<em>{% trans %}deleted{% endtrans %}</em>
{%- endif -%}
{% endmacro %}