Skip to content

Commit

Permalink
fix createroom type p extradata
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Mar 1, 2018
1 parent 70bb3f0 commit 7580754
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ Template.channelSettingsEditing.onCreated(function() {
isToggle: true,
processing: new ReactiveVar(false),
canView() {
return room.broadcast;
return RocketChat.roomTypes.roomTypes[room.t].allowRoomSettingChange(room, RoomSettingsEnum.BROADCAST);
},
canEdit() {
return false;
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-lib/lib/roomTypes/private.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export class PrivateRoomType extends RoomTypeConfig {

allowRoomSettingChange(room, setting) {
switch (setting) {
case RoomSettingsEnum.BROADCAST:
return room.broadcast;
case RoomSettingsEnum.READ_ONLY:
return !room.broadcast;
case RoomSettingsEnum.REACT_WHEN_READ_ONLY:
Expand Down
8 changes: 3 additions & 5 deletions packages/rocketchat-lib/lib/roomTypes/public.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* globals openRoom */
import {RoomTypeConfig, RoomTypeRouteConfig, UiTextContext} from '../RoomTypeConfig';
import { RoomTypeConfig, RoomTypeRouteConfig, RoomSettingsEnum, UiTextContext } from '../RoomTypeConfig';

export class PublicRoomRoute extends RoomTypeRouteConfig {
constructor() {
Expand Down Expand Up @@ -63,16 +63,14 @@ export class PublicRoomType extends RoomTypeConfig {
return RocketChat.authz.hasAtLeastOnePermission(['add-user-to-any-c-room', 'add-user-to-joined-room'], room._id);
}

allowRoomSettingChange() {
return true;
}

enableMembersListProfile() {
return true;
}

allowRoomSettingChange(room, setting) {
switch (setting) {
case RoomSettingsEnum.BROADCAST:
return room.broadcast;
case RoomSettingsEnum.READ_ONLY:
return !room.broadcast;
case RoomSettingsEnum.REACT_WHEN_READ_ONLY:
Expand Down
5 changes: 2 additions & 3 deletions packages/rocketchat-lib/server/methods/createChannel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Meteor.methods({
createChannel(name, members, readOnly = false, customFields = {}) {
createChannel(name, members, readOnly = false, customFields = {}, extraData = {}) {
check(name, String);
check(members, Match.Optional([String]));

Expand All @@ -10,7 +10,6 @@ Meteor.methods({
if (!RocketChat.authz.hasPermission(Meteor.userId(), 'create-c')) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'createChannel' });
}

return RocketChat.createRoom('c', name, Meteor.user() && Meteor.user().username, members, readOnly, {customFields});
return RocketChat.createRoom('c', name, Meteor.user() && Meteor.user().username, members, readOnly, {customFields, ...extraData});
}
});

0 comments on commit 7580754

Please sign in to comment.