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

38 lines
1.1 KiB

/* global SnippetedMessages */
import moment from 'moment';
Template.snippetPage.helpers({
snippet() {
return SnippetedMessages.findOne({ _id: FlowRouter.getParam('snippetId') });
},
snippetContent() {
const message = SnippetedMessages.findOne({ _id: FlowRouter.getParam('snippetId') });
if (message === undefined) {
return null;
}
message.html = message.msg;
const markdown = RocketChat.Markdown.parse(message);
9 years ago
return markdown.tokens[0].text;
},
date() {
const snippet = SnippetedMessages.findOne({ _id: FlowRouter.getParam('snippetId') });
if (snippet !== undefined) {
return moment(snippet.ts).format(RocketChat.settings.get('Message_DateFormat'));
}
},
time() {
const snippet = SnippetedMessages.findOne({ _id: FlowRouter.getParam('snippetId') });
if (snippet !== undefined) {
return moment(snippet.ts).format(RocketChat.settings.get('Message_TimeFormat'));
}
},
});
Template.snippetPage.onCreated(function() {
const snippetId = FlowRouter.getParam('snippetId');
this.autorun(function() {
Meteor.subscribe('snippetedMessage', snippetId);
});
});