Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Members option from non-workspace member #32857

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pages/ReportDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ function ReportDetailsPage(props) {
return items;
}

if ((!isUserCreatedPolicyRoom && participants.length) || (isUserCreatedPolicyRoom && (!ReportUtils.isPublicRoom(props.report) || isPolicyMember))) {
// The Members page is only shown when:
// - The report is not a user created room with participants to show i.e. DM, Group Chat, etc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A tiny thing, but shouldn't it be "etc." instead of "etc"?

Copy link
Contributor

@cubuspl42 cubuspl42 Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okey, not necessarily I guess: https://en.wikipedia.org/wiki/Et_cetera

// - The report is a user created room and the room and the current user is a workspace member i.e. non-workspace members should not see this option.
if ((!isUserCreatedPolicyRoom && participants.length) || (isUserCreatedPolicyRoom && isPolicyMember)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB but should we create a helper function that better describes these checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the extra documentation here now it should be easier to understand the intended logic. In this case, it's nice to have the explanation on the report "details" page vs. abstracted somewhere.

items.push({
key: CONST.REPORT_DETAILS_MENU_ITEM.MEMBERS,
translationKey: 'common.members',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/RoomMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function RoomMembersPage(props) {
testID={RoomMembersPage.displayName}
>
<FullPageNotFoundView
shouldShow={_.isEmpty(props.report) || (ReportUtils.isPublicRoom(props.report) && !isPolicyMember)}
shouldShow={_.isEmpty(props.report) || !isPolicyMember}
subtitleKey={_.isEmpty(props.report) ? undefined : 'roomMembersPage.notAuthorized'}
onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(props.report.reportID))}
>
Expand Down
Loading