Skip to content

Commit

Permalink
broadcast reply
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed May 21, 2018
1 parent 7e2aa67 commit ed11745
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Binary file not shown.
Binary file not shown.
18 changes: 13 additions & 5 deletions packages/rocketchat-ui/client/lib/chatMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import s from 'underscore.string';
import moment from 'moment';
import toastr from 'toastr';

const reply = id => id && `[ ](${ RocketChat.MessageAction.getPermaLink(id) }) `;

this.ChatMessages = class ChatMessages {
init(node) {
this.editing = {};
Expand Down Expand Up @@ -190,8 +188,7 @@ this.ChatMessages = class ChatMessages {
const mentionUser = $(input).data('mention-user') || false;

if (reply !== undefined) {
const url = await RocketChat.MessageAction.getPermaLink(reply._id);
msg = `[ ](${ url }) `;
msg = `[ ](${ await RocketChat.MessageAction.getPermaLink(reply._id) }) `;
const roomInfo = RocketChat.models.Rooms.findOne(reply.rid, { fields: { t: 1 } });
if (roomInfo.t !== 'd' && reply.u.username !== Meteor.user().username && mentionUser) {
msg += `@${ reply.u.username } `;
Expand Down Expand Up @@ -404,10 +401,21 @@ this.ChatMessages = class ChatMessages {
}

restoreText(rid) {
const text = reply(FlowRouter.getQueryParam('reply')) || localStorage.getItem(`messagebox_${ rid }`);
const text = localStorage.getItem(`messagebox_${ rid }`);
if (typeof text === 'string' && this.input) {
this.input.value = text;
}
const msgId = FlowRouter.getQueryParam('reply');
if (!msgId) {
return;
}
const message = RocketChat.models.Messages.findOne(msgId);
if (message) {
return this.$input.data('reply', message).trigger('dataChange');
}
Meteor.call('getSingleMessage', msgId, (err, msg) => {
return !err && this.$input.data('reply', msg).trigger('dataChange');
});
}

keyup(rid, event) {
Expand Down

0 comments on commit ed11745

Please sign in to comment.