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

Display group members to all users if it is public

This commit is contained in:
Pierre HUBERT 2021-03-17 18:56:09 +01:00
parent 6d1fc388d0
commit 07b42df06a
3 changed files with 13 additions and 12 deletions

View File

@ -58,15 +58,14 @@ class _AuthorizedGroupPageScreenState
_GroupPageTab(
widget: (c) => AboutGroupSection(group: _group),
label: tr("About"),
)
]..addAll(_group.isAtLeastModerator
? [
),
_GroupPageTab(
widget: (c) => GroupMembersSection(groupID: _group.id),
label: tr("Members"),
),
]
: []);
visible: _group.isAtLeastModerator || _group.isMembersListPublic,
)
].where((element) => element.visible).toList();
@override
void initState() {
@ -173,12 +172,15 @@ class _AuthorizedGroupPageScreenState
class _GroupPageTab {
final WidgetBuilder widget;
final bool visible;
final String label;
const _GroupPageTab({
@required this.widget,
this.visible = true,
@required this.label,
}) : assert(widget != null),
assert(visible != null),
assert(label != null);
Tab get tab => Tab(text: label);

View File

@ -58,7 +58,7 @@ class _GroupMembersSectionState extends State<GroupMembersSection> {
return Stack(
children: [
ListView(children: _members.map(_buildGroupMemberTile).toList()),
_buildInvitationFAB()
_group.isAtLeastModerator ? _buildInvitationFAB() : Container()
],
);
}
@ -172,7 +172,7 @@ class __GroupMembershipTileState extends State<_GroupMembershipTile> {
subtitle: Text(_membershipLevels
.firstWhere((f) => f.id == widget.membership.level)
.title),
trailing: _buildTrailing(),
trailing: widget.group.isAtLeastModerator ? _buildTrailing() : null,
);
}

View File

@ -52,7 +52,7 @@ class _GroupMembershipWidgetState extends SafeState<GroupMembershipWidget> {
return _buildVisitorState();
default:
throw Exception("Unkonwn group pmembership level state: $_level");
throw Exception("Unknown group membership level state: $_level");
}
}
@ -140,7 +140,6 @@ class _GroupMembershipWidgetState extends SafeState<GroupMembershipWidget> {
return RichText(
text: TextSpan(
text: tr("Request membership"),
style: TextStyle(color: Colors.blue),
recognizer: TapGestureRecognizer()
..onTap = () => _requestMembership()),
);