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

[FIX] Undefined room name in push and e-mail notifications #10318

1 change: 0 additions & 1 deletion example-build-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ DEPLOY_DIR=/var/www/rocket.chat

### BUILD
meteor npm install
meteor npm run postinstall

# on the very first build, meteor build command should fail due to a bug on emojione package (related to phantomjs installation)
# the command below forces the error to happen before build command (not needed on subsequent builds)
Expand Down
3 changes: 3 additions & 0 deletions packages/rocketchat-lib/server/lib/roomTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ RocketChat.roomTypes = new class roomTypesServer extends RoomTypesCommon {
return this.roomTypes[roomType] && this.roomTypes[roomType].roomFind;
}

getRoomName(roomType, roomData) {
return this.roomTypes[roomType] && this.roomTypes[roomType].roomName && this.roomTypes[roomType].roomName(roomData);
}

/**
* Run the publish for a room type
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-lib/server/lib/sendEmailOnMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import s from 'underscore.string';
function getEmailContent({ messageContent, message, user, room }) {
const lng = user && user.language || RocketChat.settings.get('language') || 'en';

const roomName = s.escapeHTML(`#${ RocketChat.settings.get('UI_Allow_room_names_with_special_chars') ? room.fname || room.name : room.name }`);
const roomName = s.escapeHTML(`#${ RocketChat.roomTypes.getRoomName(room.t, room) }`);

const userName = s.escapeHTML(RocketChat.settings.get('UI_Use_Real_Name') ? message.u.name || message.u.username : message.u.username);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room, userId) {
let push_room = '';
if (RocketChat.settings.get('Push_show_username_room')) {
push_username = user.username;
push_room = `#${ room.name }`;
push_room = `#${ RocketChat.roomTypes.getRoomName(room.t, room) }`;
}

if (room.t == null || room.t === 'd') {
Expand Down