1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 06:49:22 +00:00

Update the "allowEveryoneToAddMembers" settings

This commit is contained in:
Pierre HUBERT 2020-04-26 14:20:44 +02:00
parent 1b5169eb56
commit 9a4b61aff3
2 changed files with 19 additions and 3 deletions

View File

@ -58,6 +58,7 @@ class ConversationsHelper {
if (settings.isOwner) {
request.addString("name", settings.hasName ? settings.name : "false");
request.addString("members", settings.members.join(","));
request.addBool("canEveryoneAddMembers", settings.canEveryoneAddMembers);
}
final response = await request.exec();

View File

@ -46,6 +46,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
_nameController.text = widget.initialSettings.name;
_members = widget.initialUsers;
_followConversation = widget.initialSettings.following;
_canEveryoneAddMembers = widget.initialSettings.canEveryoneAddMembers;
}
}
@ -108,7 +109,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
// Follow conversation ?
Row(
children: <Widget>[
Switch(
Switch.adaptive(
value: _followConversation,
onChanged: (b) => setState(() {
_followConversation = b;
@ -118,6 +119,21 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
],
),
// Allow every members of the conversation to add users ?
Row(
children: <Widget>[
Switch.adaptive(
value: _canEveryoneAddMembers,
onChanged: isOwner
? (b) => setState(() {
_canEveryoneAddMembers = b;
})
: null,
),
Text(tr("Allow all members of the conversation to add users"))
],
),
// Submit button
RaisedButton(
onPressed: _members.length < 1 ? null : _submitForm,
@ -160,8 +176,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
if (isUpdating)
error = !(await ConversationsHelper().updateConversation(settings));
else {
conversationID =
await ConversationsHelper().createConversation(settings);
conversationID = await ConversationsHelper().createConversation(settings);
if (conversationID < 1) error = true;
}