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-livechat/client/views/app/tabbar/visitorNavigation.js

37 lines
993 B

import { Mongo } from 'meteor/mongo';
import { Template } from 'meteor/templating';
import { ChatRoom } from 'meteor/rocketchat:ui';
import { t } from 'meteor/rocketchat:utils';
import moment from 'moment';
const visitorNavigationHistory = new Mongo.Collection('visitor_navigation_history');
Template.visitorNavigation.helpers({
loadingNavigation() {
return !Template.instance().pageVisited.ready();
},
pages() {
const room = ChatRoom.findOne({ _id: this.rid }, { fields: { 'v.token': 1 } });
if (room) {
return visitorNavigationHistory.find({ rid: room._id }, { sort: { ts: -1 } });
}
},
pageTitle() {
return this.navigation.page.title || t('Empty_title');
},
accessDateTime() {
return moment(this.ts).format('L LTS');
},
});
Template.visitorNavigation.onCreated(function() {
const currentData = Template.currentData();
if (currentData && currentData.rid) {
this.pageVisited = this.subscribe('livechat:visitorPageVisited', { rid: currentData.rid });
}
});