Skip to content

Commit

Permalink
Regression: User thread join message (RocketChat#13656)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhardwajaditya authored and sampaiodiego committed Mar 11, 2019
1 parent a53731e commit c42b43f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,7 @@
"User_is_now_an_admin": "User is now an admin",
"User_is_unblocked": "User is unblocked",
"User_joined_channel": "Has joined the channel.",
"User_joined_conversation":"Has joined the conversation",
"User_joined_channel_female": "Has joined the channel.",
"User_joined_channel_male": "Has joined the channel.",
"User_left": "Has left the channel.",
Expand Down
10 changes: 10 additions & 0 deletions packages/rocketchat-lib/lib/MessageTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ Meteor.startup(function() {
};
},
});
MessageTypes.registerType({
id: 'ut',
system: true,
message: 'User_joined_conversation',
data(message) {
return {
user: message.u.username,
};
},
});
MessageTypes.registerType({
id: 'wm',
system: true,
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-lib/server/functions/addUserToRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const addUserToRoom = function(rid, user, inviter, silenced) {
username: inviter.username,
},
});
} else if (room.prid) {
Messages.createUserJoinWithRoomIdAndUserThread(rid, user, { ts: now });
} else {
Messages.createUserJoinWithRoomIdAndUser(rid, user, { ts: now });
}
Expand Down
5 changes: 5 additions & 0 deletions packages/rocketchat-models/server/models/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,11 @@ export class Messages extends Base {
return this.createWithTypeRoomIdMessageAndUser('uj', roomId, message, user, extraData);
}

createUserJoinWithRoomIdAndUserThread(roomId, user, extraData) {
const message = user.username;
return this.createWithTypeRoomIdMessageAndUser('ut', roomId, message, user, extraData);
}

createUserLeaveWithRoomIdAndUser(roomId, user, extraData) {
const message = user.username;
return this.createWithTypeRoomIdMessageAndUser('ul', roomId, message, user, extraData);
Expand Down

0 comments on commit c42b43f

Please sign in to comment.