1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +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) { if (settings.isOwner) {
request.addString("name", settings.hasName ? settings.name : "false"); request.addString("name", settings.hasName ? settings.name : "false");
request.addString("members", settings.members.join(",")); request.addString("members", settings.members.join(","));
request.addBool("canEveryoneAddMembers", settings.canEveryoneAddMembers);
} }
final response = await request.exec(); final response = await request.exec();

View File

@ -46,6 +46,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
_nameController.text = widget.initialSettings.name; _nameController.text = widget.initialSettings.name;
_members = widget.initialUsers; _members = widget.initialUsers;
_followConversation = widget.initialSettings.following; _followConversation = widget.initialSettings.following;
_canEveryoneAddMembers = widget.initialSettings.canEveryoneAddMembers;
} }
} }
@ -108,7 +109,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
// Follow conversation ? // Follow conversation ?
Row( Row(
children: <Widget>[ children: <Widget>[
Switch( Switch.adaptive(
value: _followConversation, value: _followConversation,
onChanged: (b) => setState(() { onChanged: (b) => setState(() {
_followConversation = b; _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 // Submit button
RaisedButton( RaisedButton(
onPressed: _members.length < 1 ? null : _submitForm, onPressed: _members.length < 1 ? null : _submitForm,
@ -160,8 +176,7 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
if (isUpdating) if (isUpdating)
error = !(await ConversationsHelper().updateConversation(settings)); error = !(await ConversationsHelper().updateConversation(settings));
else { else {
conversationID = conversationID = await ConversationsHelper().createConversation(settings);
await ConversationsHelper().createConversation(settings);
if (conversationID < 1) error = true; if (conversationID < 1) error = true;
} }