Add support for circles with MUCs

This commit is contained in:
Jonas Schäfer
2021-01-26 15:36:23 +01:00
parent 5f1a45082e
commit df75fbaa1b
3 changed files with 46 additions and 18 deletions

View File

@@ -100,6 +100,7 @@ class AdminInviteInfo:
class AdminGroupInfo:
id_: str
name: str
muc_jid: typing.Optional[str]
members: typing.Collection[str]
@classmethod
@@ -110,6 +111,7 @@ class AdminGroupInfo:
return cls(
id_=data["id"],
name=data["name"],
muc_jid=data.get("muc_jid") or None,
members=data.get("members", []),
)
@@ -944,10 +946,12 @@ class ProsodyClient:
self,
name: str,
*,
create_muc: bool = True,
session: aiohttp.ClientSession,
) -> AdminGroupInfo:
payload = {
"name": name,
"create_muc": create_muc,
}
async with session.post(

View File

@@ -1,5 +1,9 @@
{% extends "admin_app.html" %}
{% from "library.j2" import form_button, standard_button, value_or_hint, custom_form_button %}
{% from "library.j2" import form_button, standard_button, value_or_hint, custom_form_button, clipboard_button %}
{% block head_lead %}
{{ super() }}
{% include "copy-snippet.html" %}
{% endblock %}
{% block content %}
<h1>{% trans circle_name=(target_circle | circle_name) %}Edit circle {{ circle_name }}{% endtrans %}</h1>
<form method="POST">
@@ -10,6 +14,17 @@
{{ form.name.label }}
{{ form.name }}
</div>
<div class="f-ebox">
{%- if target_circle.muc_jid -%}
<label for="circle-muc-jid">{% trans %}Group chat address{% endtrans %}</label>
<input type="text" readonly="readonly" id="circle-muc-jid" value="{{ target_circle.muc_jid }}">
{%- call clipboard_button(target_circle.muc_jid, show_label=True) -%}
{%- trans -%}Copy address{%- endtrans -%}
{%- endcall -%}
{%- else -%}
<p>{% trans %}This circle has no group chat associated.{% endtrans %}<p>
{%- endif -%}
</div>
<div class="f-bbox">
{%- call standard_button("back", url_for(".circles"), class="secondary") -%}
{% trans %}Back{% endtrans %}

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-01-26 16:11+0100\n"
"POT-Creation-Date: 2021-01-26 16:12+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -381,7 +381,7 @@ msgid ""
msgstr ""
#: snikket_web/templates/admin_delete_user.html:23
#: snikket_web/templates/admin_edit_circle.html:15
#: snikket_web/templates/admin_edit_circle.html:30
#: snikket_web/templates/admin_edit_invite.html:45
#: snikket_web/templates/admin_reset_user_password.html:25
#: snikket_web/templates/user_logout.html:13
@@ -390,49 +390,62 @@ msgstr ""
msgid "Back"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:4
#: snikket_web/templates/admin_edit_circle.html:8
#, python-format
msgid "Edit circle %(circle_name)s"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:8
#: snikket_web/templates/admin_edit_circle.html:12
msgid "Circle information"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:19
msgid "Delete circle"
msgid "Group chat address"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:20
msgid "Deleting a circle does not delete any users in the circle."
#: snikket_web/templates/admin_edit_circle.html:22
#: snikket_web/templates/invite_success.html:15
msgid "Copy address"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:25
msgid "Circle members"
msgid "This circle has no group chat associated."
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:34
msgid "Delete circle"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:35
msgid "Deleting a circle does not delete any users in the circle."
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:40
msgid "Circle members"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:55
#, python-format
msgid "Remove user %(username)s from circle"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:48
#: snikket_web/templates/admin_edit_circle.html:63
msgid "This circle currently has no members."
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:50
#: snikket_web/templates/admin_edit_circle.html:65
msgid "Invite more members"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:53
#: snikket_web/templates/admin_edit_circle.html:68
msgid "Add existing user"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:64
#: snikket_web/templates/admin_edit_circle.html:79
msgid "No users left"
msgstr ""
#: snikket_web/templates/admin_edit_circle.html:65
#: snikket_web/templates/admin_edit_circle.html:80
msgid "All users on this service are already in this circle."
msgstr ""
@@ -734,10 +747,6 @@ msgstr ""
msgid "Congratulations! You successfully registered on %(site_name)s as %(jid)s."
msgstr ""
#: snikket_web/templates/invite_success.html:15
msgid "Copy address"
msgstr ""
#: snikket_web/templates/invite_success.html:17
msgid ""
"You can not set up your legacy XMPP client with the above address and the"