diff options
author | jelle van der Waa <jelle@vdwaa.nl> | 2017-12-28 21:44:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-28 21:44:01 +0100 |
commit | f69e76d2479843e1b2a0b5bc52ca6583348c71af (patch) | |
tree | c60a31b835eb177dc3881d8b2b0587faed33bf0f | |
parent | a4cc538c3bb9a23e6b77ccc03a279185863efd3c (diff) | |
parent | e94ac60ec21a15fc19c19a587c51ed8999150384 (diff) | |
download | archweb-f69e76d2479843e1b2a0b5bc52ca6583348c71af.tar.gz archweb-f69e76d2479843e1b2a0b5bc52ca6583348c71af.zip |
Merge pull request #70 from kyrias/mirror-status-json-email
Add admin emails to the mirror status JSON output when logged in
-rw-r--r-- | mirrors/views/api.py | 3 | ||||
-rw-r--r-- | templates/mirrors/mirror_details.html | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/mirrors/views/api.py b/mirrors/views/api.py index 581a0d5e..a04c93f3 100644 --- a/mirrors/views/api.py +++ b/mirrors/views/api.py @@ -92,6 +92,9 @@ def mirror_details_json(request, name): show_all=authorized) data = status_info.copy() data['version'] = 3 + if authorized and request.user.has_perm('mirror.change_mirror'): + data['admin_email'] = mirror.admin_email + data['alternate_email'] = mirror.alternate_email to_json = json.dumps(data, ensure_ascii=False, cls=ExtendedMirrorStatusJSONEncoder) response = HttpResponse(to_json, content_type='application/json') diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html index 401a57e7..40e76190 100644 --- a/templates/mirrors/mirror_details.html +++ b/templates/mirrors/mirror_details.html @@ -53,6 +53,7 @@ <th>Rsync IPs:</th> <td class="wrap">{{mirror.rsync_ips.all|join:', '}}</td> </tr> + {% if perms.mirrors.change_mirror %} <tr> <th>Admin Email:</th> <td>{% if mirror.admin_email %}<a href="mailto:{{ mirror.admin_email }}">{{ mirror.admin_email }}</a>{% else %}None{% endif %}</td> @@ -61,6 +62,7 @@ <th>Alternate Email:</th> <td>{% if mirror.alternate_email %}<a href="mailto:{{ mirror.alternate_email }}">{{ mirror.alternate_email }}</a>{% else %}None{% endif %}</td> </tr> + {% endif %} <tr> <th>Flyspray Issue:</th> <td>{% if mirror.bug %}<a href="https://bugs.archlinux.org/task/{{ mirror.bug }}">FS#{{ mirror.bug }}</a>{% endif %}</td> |