-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
rocketchat-channel-settings coffee to js #6551
rocketchat-channel-settings coffee to js #6551
Conversation
constructor() { | ||
this.options = new ReactiveVar({}); | ||
} | ||
addOption(config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you keep the comments?
this.options = new ReactiveVar({}); | ||
} | ||
addOption(config) { | ||
if (!(config && config.id)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (config == null || config.id == null) {
getOptions(currentData, group) { | ||
const allOptions = _.toArray(this.options.get()); | ||
const allowedOptions = _.compact(_.map(allOptions, function(option) { | ||
if ((option.validation == null) || option.validation()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the extra parenthesis
const allOptions = _.toArray(this.options.get()); | ||
const allowedOptions = _.compact(_.map(allOptions, function(option) { | ||
if ((option.validation == null) || option.validation()) { | ||
option.data = Object.assign(option.data || {}, currentData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
option.data = Object.assign({}, option.data, currentData);
}, | ||
canView(room) { | ||
let ref; | ||
if ((ref = room.t) !== 'c' && ref !== 'p') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (['c', 'p'].includes(room.t) === false) {
let action; | ||
swal.disableButtons(); | ||
if (confirmed) { | ||
action = value ? 'archiveRoom' : 'unarchiveRoom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare the variable here
@@ -0,0 +1,44 @@ | |||
|
|||
RocketChat.saveRoomType = function(rid, roomType, user, sendMessage = true) { | |||
if (sendMessage == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
let message; | ||
const result = RocketChat.models.Rooms.setTypeById(rid, roomType) && RocketChat.models.Subscriptions.updateTypeByRoomId(rid, roomType); | ||
if (result && sendMessage) { | ||
if (roomType === 'c') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the let message
to here
method: 'saveRoomSettings' | ||
}); | ||
} | ||
if (setting !== 'roomName' && setting !== 'roomTopic' && setting !== 'roomAnnouncement' && setting !== 'roomDescription' && setting !== 'roomType' && setting !== 'readOnly' && setting !== 'reactWhenReadOnly' && setting !== 'systemMessages' && setting !== 'default' && setting !== 'joinCode') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use an array to reduce this condition
…zo/Rocket.Chat into rocketchat-channel-settings
@@ -10,7 +10,7 @@ Meteor.methods({ | |||
method: 'saveRoomSettings' | |||
}); | |||
} | |||
if (setting !== 'roomName' && setting !== 'roomTopic' && setting !== 'roomAnnouncement' && setting !== 'roomDescription' && setting !== 'roomType' && setting !== 'readOnly' && setting !== 'reactWhenReadOnly' && setting !== 'systemMessages' && setting !== 'default' && setting !== 'joinCode') { | |||
if (!['roomName', 'roomTopic', 'roomAnnouncement', 'roomDescription', 'roomType', 'readOnly', 'reactWhenReadOnly', 'systemMessages', 'default', 'joinCode'].some((s) => s === setting)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why some
instead of includes
?
No description provided.