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

Regression: Missing room scope on teams channels permission #22137

Merged
merged 1 commit into from
May 27, 2021
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
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