1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09: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( _GroupPageTab(
widget: (c) => AboutGroupSection(group: _group), widget: (c) => AboutGroupSection(group: _group),
label: tr("About"), label: tr("About"),
),
_GroupPageTab(
widget: (c) => GroupMembersSection(groupID: _group.id),
label: tr("Members"),
visible: _group.isAtLeastModerator || _group.isMembersListPublic,
) )
]..addAll(_group.isAtLeastModerator ].where((element) => element.visible).toList();
? [
_GroupPageTab(
widget: (c) => GroupMembersSection(groupID: _group.id),
label: tr("Members"),
),
]
: []);
@override @override
void initState() { void initState() {
@ -173,12 +172,15 @@ class _AuthorizedGroupPageScreenState
class _GroupPageTab { class _GroupPageTab {
final WidgetBuilder widget; final WidgetBuilder widget;
final bool visible;
final String label; final String label;
const _GroupPageTab({ const _GroupPageTab({
@required this.widget, @required this.widget,
this.visible = true,
@required this.label, @required this.label,
}) : assert(widget != null), }) : assert(widget != null),
assert(visible != null),
assert(label != null); assert(label != null);
Tab get tab => Tab(text: label); Tab get tab => Tab(text: label);

View File

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

View File

@ -52,7 +52,7 @@ class _GroupMembershipWidgetState extends SafeState<GroupMembershipWidget> {
return _buildVisitorState(); return _buildVisitorState();
default: 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( return RichText(
text: TextSpan( text: TextSpan(
text: tr("Request membership"), text: tr("Request membership"),
style: TextStyle(color: Colors.blue),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () => _requestMembership()), ..onTap = () => _requestMembership()),
); );