Skip to content

Commit

Permalink
Regression: Missing room scope on teams channels permission (#22137)
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Fabris authored May 27, 2021
1 parent d6f510b commit 5a6475e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions client/views/room/MemberListRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import UserInfo from './contextualBar/UserInfo';
import { useTab, useTabBarClose, useTabContext } from './providers/ToolboxProvider';

const getUid = (room, ownUserId) => {
if (room.uids.length === 1) {
if (room.uids?.length === 1) {
return room.uids[0];
}

const uid = room.uids.filter((uid) => uid !== ownUserId).shift();
const uid = room.uids?.filter((uid) => uid !== ownUserId).shift();

// Self DMs used to be created with the userId duplicated.
// Sometimes rooms can have 2 equal uids, but it's a self DM.
return uid ?? room.uids[0];
return uid ? room.uids[0] : undefined;
};

const MemberListRouter = ({ rid }) => {
Expand Down
4 changes: 2 additions & 2 deletions client/views/teams/contextualBar/channels/RoomActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const RoomActions = ({ room, reload }) => {
const dispatchToastMessage = useToastMessageDispatch();

const canDeleteTeamChannel = usePermission(type === 'c' ? 'delete-c' : 'delete-p', rid);
const canEditTeamChannel = usePermission('edit-team-channel');
const canRemoveTeamChannel = usePermission('remove-team-channel');
const canEditTeamChannel = usePermission('edit-team-channel', rid);
const canRemoveTeamChannel = usePermission('remove-team-channel', rid);

const updateRoomEndpoint = useEndpointActionExperimental('POST', 'teams.updateRoom');
const removeRoomEndpoint = useEndpointActionExperimental(
Expand Down
4 changes: 2 additions & 2 deletions client/views/teams/contextualBar/channels/TeamsChannelItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ const TeamsChannelItem = ({ room, onClickView, reload }) => {

const [showButton, setShowButton] = useState();

const canRemoveTeamChannel = usePermission('remove-team-channel');
const canEditTeamChannel = usePermission('edit-team-channel');
const canRemoveTeamChannel = usePermission('remove-team-channel', rid);
const canEditTeamChannel = usePermission('edit-team-channel', rid);
const canDeleteTeamChannel = usePermission(type === 'c' ? 'delete-c' : 'delete-p', rid);

const isReduceMotionEnabled = usePrefersReducedMotion();
Expand Down

0 comments on commit 5a6475e

Please sign in to comment.