1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +00:00

Can change group posts creation level

This commit is contained in:
Pierre HUBERT 2020-05-01 21:13:31 +02:00
parent d6f2df7002
commit f450a46e99
2 changed files with 29 additions and 1 deletions

View File

@ -27,7 +27,7 @@ class Group {
GroupMembershipLevel membershipLevel; GroupMembershipLevel membershipLevel;
GroupVisibilityLevel visibilityLevel; GroupVisibilityLevel visibilityLevel;
GroupRegistrationLevel registrationLevel; GroupRegistrationLevel registrationLevel;
final GroupPostCreationLevel postCreationLevel; GroupPostCreationLevel postCreationLevel;
String virtualDirectory; String virtualDirectory;
bool following; bool following;

View File

@ -184,9 +184,25 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
), ),
]; ];
List<MultiChoiceEntry<GroupPostCreationLevel>> get _postsCreationLevels => [
MultiChoiceEntry(
id: GroupPostCreationLevel.MEMBERS,
title: tr("All members"),
subtitle:
tr("All the members of the group can create posts on the group"),
),
MultiChoiceEntry(
id: GroupPostCreationLevel.MODERATORS,
title: tr("Moderators only"),
subtitle: tr(
"Only moderators and administrators of the group can create posts on it"),
),
];
Widget _buildAccessRestrictions() => SettingsSection( Widget _buildAccessRestrictions() => SettingsSection(
title: tr("Access restrictions"), title: tr("Access restrictions"),
tiles: [ tiles: [
// Group visibility
MultiChoicesSettingsTile( MultiChoicesSettingsTile(
title: tr("Group visibility"), title: tr("Group visibility"),
choices: _visibilityLevels, choices: _visibilityLevels,
@ -195,6 +211,8 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
_groupSettings.visibilityLevel = v; _groupSettings.visibilityLevel = v;
_updateSettings(); _updateSettings();
}), }),
// Group registration level
MultiChoicesSettingsTile( MultiChoicesSettingsTile(
title: tr("Group registration level"), title: tr("Group registration level"),
choices: _registrationLevels, choices: _registrationLevels,
@ -203,6 +221,16 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
_groupSettings.registrationLevel = v; _groupSettings.registrationLevel = v;
_updateSettings(); _updateSettings();
}), }),
// Group posts creation levels
MultiChoicesSettingsTile(
title: tr("Posts creation level"),
choices: _postsCreationLevels,
currentValue: _groupSettings.postCreationLevel,
onChanged: (s) {
_groupSettings.postCreationLevel = s;
_updateSettings();
}),
], ],
); );
} }