Skip to content
Snippets Groups Projects
Commit 1c9ea7c1 authored by Gabriel Engel's avatar Gabriel Engel Committed by GitHub
Browse files

Merge pull request #5858 from Kiran-Rao/addUserToDefaultChannels

addUserToDefaultChannels let to const
parents d33c7e08 5bec3512
No related merge requests found
RocketChat.addUserToDefaultChannels = function(user, silenced) {
RocketChat.callbacks.run('beforeJoinDefaultChannels', user);
let defaultRooms = RocketChat.models.Rooms.findByDefaultAndTypes(true, ['c', 'p'], {fields: {usernames: 0}}).fetch();
const defaultRooms = RocketChat.models.Rooms.findByDefaultAndTypes(true, ['c', 'p'], {fields: {usernames: 0}}).fetch();
defaultRooms.forEach((room) => {
// put user in default rooms
let muted = room.ro && !RocketChat.authz.hasPermission(user._id, 'post-readonly');
const muted = room.ro && !RocketChat.authz.hasPermission(user._id, 'post-readonly');
RocketChat.models.Rooms.addUsernameById(room._id, user.username, muted);
if (!RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(room._id, user._id)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment