The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/packages/rocketchat-message-snippet/client/page/snippetPage.js

36 lines
1.0 KiB

/* global Messages */
Template.snippetPage.helpers({
snippet: function() {
return Messages.findOne({ _id: FlowRouter.getParam('snippetId') });
},
snippetContent: function() {
let message = Messages.findOne({ _id: FlowRouter.getParam('snippetId') });
if (message === undefined) {
return null;
}
message.html = message.msg;
let markdownCode = new RocketChat.MarkdownCode(message);
return markdownCode.tokens[0].text;
},
date() {
let snippet = Messages.findOne({ _id: FlowRouter.getParam('snippetId') });
if (snippet !== undefined) {
return moment(snippet.ts).format(RocketChat.settings.get('Message_DateFormat'));
}
},
time() {
let snippet = Messages.findOne({ _id: FlowRouter.getParam('snippetId') });
if (snippet !== undefined) {
return moment(snippet.ts).format(RocketChat.settings.get('Message_TimeFormat'));
}
}
});
Template.snippetPage.onCreated(function() {
let snippetId = FlowRouter.getParam('snippetId');
this.autorun(function() {
Meteor.subscribe('snippetedMessage', snippetId);
});
});