Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Mar 16, 2020
1 parent ec13454 commit 9afea45
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
8 changes: 2 additions & 6 deletions app/lib/lib/roomTypes/direct.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,8 @@ export class DirectMessageRoomType extends RoomTypeConfig {
}
}

allowMemberAction(room, action) {
switch (action) {
case RoomMemberActions.MUTE:
default:
return false;
}
allowMemberAction(/* room, action */) {
return false;
}

enableMembersListProfile() {
Expand Down
8 changes: 2 additions & 6 deletions app/lib/lib/roomTypes/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,8 @@ export class PublicRoomType extends RoomTypeConfig {
}
}

allowMemberAction(room, action) {
switch (action) {
case RoomMemberActions.MUTE:
default:
return true;
}
allowMemberAction(/* room, action */) {
return true;
}

getUiText(context) {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/server/methods/addUsersToRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Meteor.methods({
const userInRoom = subscription != null;

// Can't add to direct room ever
if (room.t === 'd') { // TODO CHANGE
if (room.t === 'd') {
throw new Meteor.Error('error-cant-invite-for-direct-room', 'Can\'t invite user to direct rooms', {
method: 'addUsersToRoom',
});
Expand Down
2 changes: 1 addition & 1 deletion app/slashcommands-unarchiveroom/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Unarchive(command, params, item) {
}

// You can not archive direct messages.
if (!roomTypes.getConfig(room.t).allowRoomSettingChange(room, RoomMemberActions.ARCHIVE)) {
if (!roomTypes.getConfig(room.t).allowMemberAction(room, RoomMemberActions.ARCHIVE)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion server/methods/removeUserFromRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Meteor.methods({

const room = Rooms.findOneById(data.rid);

if (!room || !roomTypes.getConfig(room.t).allowRoomSettingChange(room, RoomMemberActions.REMOVE_USER)) {
if (!room || !roomTypes.getConfig(room.t).allowMemberAction(room, RoomMemberActions.REMOVE_USER)) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'removeUserFromRoom',
});
Expand Down

0 comments on commit 9afea45

Please sign in to comment.