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.1 KiB

/* global SnippetedMessages */
import { DateFormat } from 'meteor/rocketchat:lib';
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);
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 DateFormat.formatTime(snippet.ts);
}
},
});
Template.snippetPage.onCreated(function() {
const snippetId = FlowRouter.getParam('snippetId');
this.autorun(function() {
Meteor.subscribe('snippetedMessage', snippetId);
});
});