1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 06:49:22 +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;
GroupVisibilityLevel visibilityLevel;
GroupRegistrationLevel registrationLevel;
final GroupPostCreationLevel postCreationLevel;
GroupPostCreationLevel postCreationLevel;
String virtualDirectory;
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(
title: tr("Access restrictions"),
tiles: [
// Group visibility
MultiChoicesSettingsTile(
title: tr("Group visibility"),
choices: _visibilityLevels,
@ -195,6 +211,8 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
_groupSettings.visibilityLevel = v;
_updateSettings();
}),
// Group registration level
MultiChoicesSettingsTile(
title: tr("Group registration level"),
choices: _registrationLevels,
@ -203,6 +221,16 @@ class _GroupSettingsScreenState extends SafeState<GroupSettingsScreen> {
_groupSettings.registrationLevel = v;
_updateSettings();
}),
// Group posts creation levels
MultiChoicesSettingsTile(
title: tr("Posts creation level"),
choices: _postsCreationLevels,
currentValue: _groupSettings.postCreationLevel,
onChanged: (s) {
_groupSettings.postCreationLevel = s;
_updateSettings();
}),
],
);
}