From: Daniele Cinti Date: Tue, 13 Sep 2016 13:11:03 +0000 (+0200) Subject: Built motion from commit 9750695.|0.0.141 X-Git-Tag: 20/10/16~79 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=a37e8f51227322d587a7d2b183ac47b903e5d308;p=motion.git Built motion from commit 9750695.|0.0.141 --- diff --git a/release-notes/changelog_0.0.141.txt b/release-notes/changelog_0.0.141.txt index bac1ae5..f805e39 100644 --- a/release-notes/changelog_0.0.141.txt +++ b/release-notes/changelog_0.0.141.txt @@ -1,5 +1,6 @@ # xCALLY MOTION Changelog +- * 9750695 - 2016-09-13: fix duplicate events - * 0cbc254 - 2016-09-13: server side models interval + user - * 0c84ddb - 2016-09-13: sever side update tools + app.js - * f8ce2ee - 2016-09-13: automation chat update (server side - emitter) diff --git a/server/config/tools/interval.js b/server/config/tools/interval.js index e5ec6f1..f89478b 100644 --- a/server/config/tools/interval.js +++ b/server/config/tools/interval.js @@ -17,12 +17,12 @@ function Interval() { emitter.on('MailRoom.beforeDestroy', function(doc, options) { if (doc.IntervalId !== null) { - updatevoiceExtension(interval); + updatevoiceExtension(doc); } }); emitter.on('MailRoom.afterCreate', function(doc, options) { - if (interval.IntervalId !== null) { - updatevoiceExtension(interval); + if (doc.IntervalId !== null) { + updatevoiceExtension(doc); } }); } @@ -70,5 +70,4 @@ function updatevoiceExtension(interval) { }); } - module.exports = Interval; diff --git a/server/models/tools_interval.js b/server/models/tools_interval.js index b223bde..de98180 100644 --- a/server/models/tools_interval.js +++ b/server/models/tools_interval.js @@ -2,8 +2,6 @@ const emitter = require('cluster-emitter'); -var emitter = require('cluster-emitter'); - module.exports = function(sequelize, DataTypes) { var Interval = sequelize.define('Interval', { name: { @@ -16,17 +14,6 @@ module.exports = function(sequelize, DataTypes) { } }, { tableName: 'tools_intervals', - hooks: { - afterCreate: function(doc) { - emitter.to(['master']).emit('Interval.afterCreate', doc); - }, - afterUpdate: function(doc) { - emitter.to(['master']).emit('Interval.afterUpdate', doc); - }, - afterDestroy: function(doc) { - emitter.to(['master']).emit('Interval.afterDestroy', doc); - } - }, associate: function(models) { Interval.hasMany(models.Interval, { as: 'SubIntervals',