Skip to content
Snippets Groups Projects
Unverified Commit 71d33283 authored by graywolf336's avatar graywolf336
Browse files

Add a setting to make the timezone configurable in the Smarsh Connector

parent 97622a4d
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,9 @@ function _getLink(attachment) {
RocketChat.smarsh.generateEml = () => {
Meteor.defer(() => {
const smarshMissingEmail = RocketChat.settings.get('Smarsh_MissingEmail_Email');
const timeZone = RocketChat.settings.get('Smarsh_Timezone');
RocketChat.models.Rooms.find().forEach((room) => {
const smarshHistory = RocketChat.smarsh.History.findOne({ _id: room._id });
const query = { rid: room._id };
......@@ -41,7 +44,7 @@ RocketChat.smarsh.generateEml = () => {
//The timestamp
rows.push(open20td);
rows.push(moment(message.ts).tz('America/Los_Angeles').format('YYYY-MM-DD HH-mm-ss z'));
rows.push(moment(message.ts).tz(timeZone).format('YYYY-MM-DD HH-mm-ss z'));
rows.push(closetd);
//The sender
......@@ -55,7 +58,7 @@ RocketChat.smarsh.generateEml = () => {
if (sender.emails && sender.emails[0] && sender.emails[0].address) {
rows.push(`${sender.name} <${sender.emails[0].address}>`);
} else {
rows.push(`${sender.name} <${RocketChat.settings.get('Smarsh_MissingEmail_Email')}>`);
rows.push(`${sender.name} <${smarshMissingEmail}>`);
}
rows.push(closetd);
......
......@@ -20,6 +20,18 @@ RocketChat.settings.addGroup('Smarsh', function addSettings() {
i18nLabel: 'Smarsh_MissingEmail_Email',
placeholder: 'no-email@example.com'
});
const zoneValues = moment.tz.names().map(function _timeZonesToSettings(name) {
return {
key: name,
i18nLabel: name
};
});
this.add('Smarsh_Timezone', 'America/Los_Angeles', {
type: 'select',
values: zoneValues
});
this.add('Smarsh_Interval', 'every_30_minutes', {
type: 'select',
values: [{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment