@tiledesk/tiledesk-server 2.4.38 → 2.4.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -2
- package/app.js +7 -5
- package/event/botEvent.js +96 -81
- package/event/leadEvent.js +7 -3
- package/jobs.js +6 -1
- package/jobsManager.js +9 -4
- package/models/user.js +19 -11
- package/package.json +2 -2
- package/routes/users.js +24 -11
- package/services/subscriptionNotifierQueued.js +4 -2
- package/websocket/webSocketServer.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,20 @@
|
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
|
7
7
|
|
|
8
|
+
# 2.4.39
|
|
9
|
+
- Queued botSubscriptionNotifier
|
|
10
|
+
- added lead.create to the queue????? testare di nuovo
|
|
11
|
+
- @tiledesk/tiledesk-tybot-connector: 0.1.89
|
|
12
|
+
- jobsManager.listen(); //listen after pubmodules to enabled queued *.queueEnabled events
|
|
13
|
+
|
|
14
|
+
# 2.4.38
|
|
15
|
+
- str fix
|
|
8
16
|
|
|
9
17
|
# 2.4.37
|
|
10
18
|
- added replyto to email endpoint
|
|
11
19
|
- tiledesk/tiledesk-tybot-connector: 0.1.88
|
|
12
20
|
- added lead.create to the queue
|
|
13
|
-
- added subscriptionNotifiedQueued for the most common events (request.create, request.update, request.close, lead.create, project_user.update)
|
|
21
|
+
- added subscriptionNotifiedQueued for the most common events (message.create, request.create, request.update, request.close, lead.create, project_user.update)
|
|
14
22
|
|
|
15
23
|
|
|
16
24
|
# 2.4.36
|
|
@@ -19,7 +27,7 @@
|
|
|
19
27
|
# 2.4.35
|
|
20
28
|
- tiledesk/tiledesk-tybot-connector: 0.1.87
|
|
21
29
|
|
|
22
|
-
# 2.4.34
|
|
30
|
+
# 2.4.34 -> ERRORE PAGAMENTO
|
|
23
31
|
- tiledesk/tiledesk-tybot-connector:0.1.83
|
|
24
32
|
- stateless as default for Google Strategy
|
|
25
33
|
- added redis session for google auth. To enable it put ENABLE_REDIS_SESSION to true otherwise standard passport session is used
|
package/app.js
CHANGED
|
@@ -135,6 +135,7 @@ var RouterLogger = require('./models/routerLogger');
|
|
|
135
135
|
var cacheEnabler = require("./services/cacheEnabler");
|
|
136
136
|
const session = require('express-session');
|
|
137
137
|
const RedisStore = require("connect-redis").default
|
|
138
|
+
const botEvent = require('./event/botEvent');
|
|
138
139
|
|
|
139
140
|
require('./services/mongoose-cache-fn')(mongoose);
|
|
140
141
|
|
|
@@ -146,7 +147,9 @@ var subscriptionNotifierQueued = require('./services/subscriptionNotifierQueued'
|
|
|
146
147
|
|
|
147
148
|
|
|
148
149
|
var botSubscriptionNotifier = require('./services/BotSubscriptionNotifier');
|
|
149
|
-
botSubscriptionNotifier.start();
|
|
150
|
+
// botSubscriptionNotifier.start(); //queued
|
|
151
|
+
|
|
152
|
+
// botEvent.listen(); queued
|
|
150
153
|
|
|
151
154
|
var trainingService = require('./services/trainingService');
|
|
152
155
|
trainingService.start();
|
|
@@ -164,10 +167,7 @@ if (process.env.JOB_WORKER_ENABLED=="true" || process.env.JOB_WORKER_ENABLED ==
|
|
|
164
167
|
}
|
|
165
168
|
winston.info("JobsManager jobWorkerEnabled: "+ jobWorkerEnabled);
|
|
166
169
|
|
|
167
|
-
let jobsManager = new JobsManager(jobWorkerEnabled, geoService, subscriptionNotifierQueued);
|
|
168
|
-
jobsManager.listen();
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
let jobsManager = new JobsManager(jobWorkerEnabled, geoService, botEvent, subscriptionNotifierQueued, botSubscriptionNotifier);
|
|
171
171
|
|
|
172
172
|
var faqBotHandler = require('./services/faqBotHandler');
|
|
173
173
|
faqBotHandler.listen();
|
|
@@ -175,6 +175,8 @@ faqBotHandler.listen();
|
|
|
175
175
|
var pubModulesManager = require('./pubmodules/pubModulesManager');
|
|
176
176
|
pubModulesManager.init({express:express, mongoose:mongoose, passport:passport, databaseUri:databaseUri, routes:{}, jobsManager:jobsManager});
|
|
177
177
|
|
|
178
|
+
jobsManager.listen(); //listen after pubmodules to enabled queued *.queueEnabled events
|
|
179
|
+
|
|
178
180
|
var channelManager = require('./channels/channelManager');
|
|
179
181
|
channelManager.listen();
|
|
180
182
|
|
package/event/botEvent.js
CHANGED
|
@@ -14,6 +14,102 @@ class BotEvent extends EventEmitter {
|
|
|
14
14
|
this.queueEnabled = false;
|
|
15
15
|
this.setMaxListeners(11);
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
listen() {
|
|
20
|
+
//TODO modify to async
|
|
21
|
+
//messageEvent.on('message.received', function(message) {
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var messageCreateKey = 'message.create';
|
|
25
|
+
if (messageEvent.queueEnabled) {
|
|
26
|
+
messageCreateKey = 'message.create.queue';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
winston.info("Listening messageCreateKey" + messageCreateKey + " for Chatbot messages");
|
|
30
|
+
|
|
31
|
+
messageEvent.on(messageCreateKey, function(message) {
|
|
32
|
+
|
|
33
|
+
winston.debug("message", message);
|
|
34
|
+
|
|
35
|
+
// TODO usa meglio se attributes.reply_always=true
|
|
36
|
+
if (message.sender === "system" && message.text && message.text!="\\start") {
|
|
37
|
+
winston.debug("it s a message sent from system, exit");
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (message.text && ( message.text.indexOf("\\agent") > -1 || message.text.indexOf("\\close") > -1)) { //not reply to a message containing \\agent
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// if (message.text.startsWith("\\")) { //not reply to a message containing \
|
|
46
|
+
// return null;
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
var botId = getBotId(message);
|
|
50
|
+
|
|
51
|
+
winston.debug("botId: " + botId);
|
|
52
|
+
|
|
53
|
+
if (!botId) {
|
|
54
|
+
return null;
|
|
55
|
+
}else {
|
|
56
|
+
//loop fix for messages sent from external bot
|
|
57
|
+
// botprefix
|
|
58
|
+
if (message.sender === 'bot_'+botId || message.sender === botId) {
|
|
59
|
+
winston.debug("it s a message sent from bot, exit");
|
|
60
|
+
return null;
|
|
61
|
+
}else {
|
|
62
|
+
messageEvent.emit('message.received.for.bot', message); //UNUSED
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// qui potresti leggere anche +secret ed evitare prossima query in botNotification
|
|
68
|
+
let qbot = Faq_kb.findById(botId); //TODO add cache_bot_here
|
|
69
|
+
//TODO unselect secret. secret is unselectable by default in the model
|
|
70
|
+
|
|
71
|
+
if (cacheEnabler.faq_kb) {
|
|
72
|
+
winston.debug('message.id_project+":faq_kbs:id:"+botId: '+ message.id_project+":faq_kbs:id:"+botId);
|
|
73
|
+
qbot.cache(cacheUtil.defaultTTL, message.id_project+":faq_kbs:id:"+botId)
|
|
74
|
+
winston.debug('faq_kb cache enabled');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
qbot.exec(function(err, bot) {
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if (err) {
|
|
82
|
+
winston.error('Error getting object.', err);
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
if (!bot) {
|
|
86
|
+
winston.warn('Bot not found with id '+botId);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
winston.debug("bot debug", bot);
|
|
90
|
+
|
|
91
|
+
if (bot) {
|
|
92
|
+
if (bot.type==="internal") {
|
|
93
|
+
botEvent.emit('bot.message.received.notify.internal', message);
|
|
94
|
+
|
|
95
|
+
}else { //external
|
|
96
|
+
if (bot.url) {
|
|
97
|
+
var botNotification = {bot: bot, message: message};
|
|
98
|
+
botEvent.emit('bot.message.received.notify.external', botNotification);
|
|
99
|
+
}else {
|
|
100
|
+
winston.warn("bot url is not defined", bot);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
17
113
|
}
|
|
18
114
|
|
|
19
115
|
const botEvent = new BotEvent();
|
|
@@ -79,87 +175,6 @@ function getBotId(message) {
|
|
|
79
175
|
|
|
80
176
|
}
|
|
81
177
|
|
|
82
|
-
//TODO modify to async
|
|
83
|
-
//messageEvent.on('message.received', function(message) {
|
|
84
|
-
messageEvent.on('message.create', function(message) {
|
|
85
|
-
|
|
86
|
-
winston.debug("message", message);
|
|
87
|
-
|
|
88
|
-
// TODO usa meglio se attributes.reply_always=true
|
|
89
|
-
if (message.sender === "system" && message.text && message.text!="\\start") {
|
|
90
|
-
winston.debug("it s a message sent from system, exit");
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (message.text && ( message.text.indexOf("\\agent") > -1 || message.text.indexOf("\\close") > -1)) { //not reply to a message containing \\agent
|
|
95
|
-
return 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// if (message.text.startsWith("\\")) { //not reply to a message containing \
|
|
99
|
-
// return null;
|
|
100
|
-
// }
|
|
101
|
-
|
|
102
|
-
var botId = getBotId(message);
|
|
103
|
-
|
|
104
|
-
winston.debug("botId: " + botId);
|
|
105
|
-
|
|
106
|
-
if (!botId) {
|
|
107
|
-
return null;
|
|
108
|
-
}else {
|
|
109
|
-
//loop fix for messages sent from external bot
|
|
110
|
-
// botprefix
|
|
111
|
-
if (message.sender === 'bot_'+botId || message.sender === botId) {
|
|
112
|
-
winston.debug("it s a message sent from bot, exit");
|
|
113
|
-
return null;
|
|
114
|
-
}else {
|
|
115
|
-
messageEvent.emit('message.received.for.bot', message);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
let qbot = Faq_kb.findById(botId); //TODO add cache_bot_here
|
|
122
|
-
//TODO unselect secret. secret is unselectable by default in the model
|
|
123
|
-
|
|
124
|
-
if (cacheEnabler.faq_kb) {
|
|
125
|
-
winston.debug('message.id_project+":faq_kbs:id:"+botId: '+ message.id_project+":faq_kbs:id:"+botId);
|
|
126
|
-
qbot.cache(cacheUtil.defaultTTL, message.id_project+":faq_kbs:id:"+botId)
|
|
127
|
-
winston.debug('faq_kb cache enabled');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
qbot.exec(function(err, bot) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (err) {
|
|
135
|
-
winston.error('Error getting object.', err);
|
|
136
|
-
return 0;
|
|
137
|
-
}
|
|
138
|
-
if (!bot) {
|
|
139
|
-
winston.warn('Bot not found with id '+botId);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
winston.debug("bot", bot);
|
|
143
|
-
|
|
144
|
-
if (bot) {
|
|
145
|
-
if (bot.type==="internal") {
|
|
146
|
-
botEvent.emit('bot.message.received.notify.internal', message);
|
|
147
|
-
|
|
148
|
-
}else { //external
|
|
149
|
-
if (bot.url) {
|
|
150
|
-
var botNotification = {bot: bot, message: message};
|
|
151
|
-
botEvent.emit('bot.message.received.notify.external', botNotification);
|
|
152
|
-
}else {
|
|
153
|
-
winston.warn("bot url is not defined", bot);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
});
|
|
163
178
|
|
|
164
179
|
|
|
165
180
|
module.exports = botEvent;
|
package/event/leadEvent.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
const EventEmitter = require('events');
|
|
2
2
|
|
|
3
|
-
class LeadEvent extends EventEmitter {
|
|
3
|
+
class LeadEvent extends EventEmitter {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.queueEnabled = false;
|
|
7
|
+
this.setMaxListeners(11);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
4
10
|
|
|
5
11
|
const leadEvent = new LeadEvent();
|
|
6
12
|
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
14
|
module.exports = leadEvent;
|
package/jobs.js
CHANGED
|
@@ -23,6 +23,9 @@ let JobsManager = require('./jobsManager');
|
|
|
23
23
|
let geoService = require('./services/geoService');
|
|
24
24
|
// let subscriptionNotifier = require('./services/subscriptionNotifier');
|
|
25
25
|
var subscriptionNotifierQueued = require('./services/subscriptionNotifierQueued');
|
|
26
|
+
var botSubscriptionNotifier = require('./services/BotSubscriptionNotifier');
|
|
27
|
+
|
|
28
|
+
const botEvent = require('./event/botEvent');
|
|
26
29
|
|
|
27
30
|
require('./services/mongoose-cache-fn')(mongoose);
|
|
28
31
|
|
|
@@ -60,7 +63,7 @@ async function main()
|
|
|
60
63
|
|
|
61
64
|
// require('@tiledesk-ent/tiledesk-server-queue');
|
|
62
65
|
|
|
63
|
-
let jobsManager = new JobsManager(undefined, geoService, subscriptionNotifierQueued);
|
|
66
|
+
let jobsManager = new JobsManager(undefined, geoService, botEvent, subscriptionNotifierQueued, botSubscriptionNotifier);
|
|
64
67
|
|
|
65
68
|
jobsManager.listen();
|
|
66
69
|
|
|
@@ -72,6 +75,8 @@ async function main()
|
|
|
72
75
|
let activityArchiver = require('./pubmodules/activities').activityArchiver;
|
|
73
76
|
jobsManager.listenActivityArchiver(activityArchiver);
|
|
74
77
|
|
|
78
|
+
|
|
79
|
+
|
|
75
80
|
winston.info("Jobs started");
|
|
76
81
|
|
|
77
82
|
await new Promise(function () {});
|
package/jobsManager.js
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
var winston = require('./config/winston');
|
|
3
3
|
|
|
4
4
|
class JobsManager {
|
|
5
|
-
constructor(jobWorkerEnabled, geoService, subscriptionNotifierQueued) {
|
|
5
|
+
constructor(jobWorkerEnabled, geoService, botEvent, subscriptionNotifierQueued, botSubscriptionNotifier) {
|
|
6
6
|
this.geoService = geoService;
|
|
7
|
+
this.botEvent = botEvent;
|
|
7
8
|
// this.subscriptionNotifier = subscriptionNotifier;
|
|
8
9
|
this.subscriptionNotifierQueued = subscriptionNotifierQueued;
|
|
10
|
+
this.botSubscriptionNotifier = botSubscriptionNotifier;
|
|
9
11
|
|
|
10
12
|
this.emailNotificatio = undefined;
|
|
11
13
|
this.activityArchiver = undefined;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
|
|
14
15
|
this.jobWorkerEnabled = jobWorkerEnabled;
|
|
15
16
|
// this.jobWorkerEnabled = false;
|
|
16
17
|
// if (process.env.JOB_WORKER_ENABLED=="true" || process.env.JOB_WORKER_ENABLED == true) {
|
|
@@ -26,8 +27,12 @@ class JobsManager {
|
|
|
26
27
|
return winston.info("JobsManager jobWorkerEnabled is enabled. Skipping listeners");
|
|
27
28
|
}
|
|
28
29
|
this.geoService.listen();
|
|
30
|
+
this.botEvent.listen();
|
|
31
|
+
|
|
29
32
|
// this.subscriptionNotifier.start();
|
|
30
33
|
this.subscriptionNotifierQueued.start();
|
|
34
|
+
|
|
35
|
+
this.botSubscriptionNotifier.start();
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
listenEmailNotification(emailNotification) {
|
|
@@ -39,7 +44,7 @@ class JobsManager {
|
|
|
39
44
|
this.emailNotification.requestNotification.listen();
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
|
|
43
48
|
|
|
44
49
|
listenActivityArchiver(activityArchiver) {
|
|
45
50
|
winston.info("JobsManager listenActivityArchiver started");
|
package/models/user.js
CHANGED
|
@@ -15,7 +15,7 @@ var UserSchema = new Schema({
|
|
|
15
15
|
type: String,
|
|
16
16
|
required: true,
|
|
17
17
|
// https://stackoverflow.com/questions/12096262/how-to-protect-the-password-field-in-mongoose-mongodb-so-it-wont-return-in-a-qu
|
|
18
|
-
select: false
|
|
18
|
+
select: false
|
|
19
19
|
},
|
|
20
20
|
firstname: {
|
|
21
21
|
type: String,
|
|
@@ -31,10 +31,10 @@ var UserSchema = new Schema({
|
|
|
31
31
|
},
|
|
32
32
|
resetpswrequestid: {
|
|
33
33
|
type: String,
|
|
34
|
-
select: false
|
|
34
|
+
select: false
|
|
35
35
|
},
|
|
36
36
|
signedInAt: {
|
|
37
|
-
type:Date
|
|
37
|
+
type: Date
|
|
38
38
|
},
|
|
39
39
|
|
|
40
40
|
// db.users.find({authUrl: {$exists : false }}).forEach(function(mydoc) {
|
|
@@ -43,7 +43,7 @@ var UserSchema = new Schema({
|
|
|
43
43
|
|
|
44
44
|
authUrl: {
|
|
45
45
|
type: String,
|
|
46
|
-
index:true
|
|
46
|
+
index: true
|
|
47
47
|
},
|
|
48
48
|
attributes: {
|
|
49
49
|
type: Object,
|
|
@@ -54,10 +54,18 @@ var UserSchema = new Schema({
|
|
|
54
54
|
default: 100,
|
|
55
55
|
index: true,
|
|
56
56
|
// select: false
|
|
57
|
-
},
|
|
57
|
+
},
|
|
58
58
|
description: {
|
|
59
59
|
type: String,
|
|
60
60
|
},
|
|
61
|
+
public_email: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: false
|
|
64
|
+
},
|
|
65
|
+
public_website: {
|
|
66
|
+
type: String,
|
|
67
|
+
required: false
|
|
68
|
+
}
|
|
61
69
|
// authType: { // update db old data
|
|
62
70
|
// type: String,
|
|
63
71
|
// index:true,
|
|
@@ -68,9 +76,9 @@ var UserSchema = new Schema({
|
|
|
68
76
|
// ref: 'auth',
|
|
69
77
|
// //required: true
|
|
70
78
|
// },
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
}, {
|
|
80
|
+
timestamps: true
|
|
81
|
+
}
|
|
74
82
|
);
|
|
75
83
|
|
|
76
84
|
// UserSchema.set('toJSON', {
|
|
@@ -111,8 +119,8 @@ UserSchema.methods.comparePassword = function (passw, cb) {
|
|
|
111
119
|
|
|
112
120
|
UserSchema.virtual('fullName').get(function () {
|
|
113
121
|
return (this.firstname || '') + ' ' + (this.lastname || '');
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
});
|
|
123
|
+
|
|
116
124
|
|
|
117
125
|
//UserSchema.index({ email: 1, authType: 1 }, { unique: true });
|
|
118
126
|
|
|
@@ -126,6 +134,6 @@ var UserModel = mongoose.model('user', UserSchema);
|
|
|
126
134
|
if (process.env.MONGOOSE_SYNCINDEX) {
|
|
127
135
|
UserModel.syncIndexes();
|
|
128
136
|
winston.info("UserModel syncIndexes")
|
|
129
|
-
|
|
137
|
+
}
|
|
130
138
|
|
|
131
139
|
module.exports = UserModel;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiledesk/tiledesk-server",
|
|
3
3
|
"description": "The Tiledesk server module",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.39",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node ./bin/www",
|
|
7
7
|
"pretest": "mongodb-runner start",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tiledesk/tiledesk-kaleyra-proxy": "^0.1.7",
|
|
45
45
|
"@tiledesk/tiledesk-messenger-connector": "0.1.9",
|
|
46
46
|
"@tiledesk/tiledesk-rasa-connector": "^1.0.10",
|
|
47
|
-
"@tiledesk/tiledesk-tybot-connector": "^0.1.
|
|
47
|
+
"@tiledesk/tiledesk-tybot-connector": "^0.1.89",
|
|
48
48
|
"@tiledesk/tiledesk-whatsapp-connector": "^0.1.50",
|
|
49
49
|
"amqplib": "^0.5.5",
|
|
50
50
|
"app-root-path": "^3.0.0",
|
package/routes/users.js
CHANGED
|
@@ -7,23 +7,36 @@ var winston = require('../config/winston');
|
|
|
7
7
|
const authEvent = require('../event/authEvent');
|
|
8
8
|
const uuidv4 = require('uuid/v4');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
10
|
router.put('/', function (req, res) {
|
|
15
11
|
|
|
16
12
|
winston.debug('UPDATE USER - REQ BODY ', req.body);
|
|
17
13
|
|
|
18
14
|
var update = {};
|
|
19
|
-
|
|
20
|
-
update.firstname = req.body.firstname;
|
|
21
|
-
update.lastname = req.body.lastname;
|
|
22
|
-
update.attributes = req.body.attributes;
|
|
23
|
-
update.description = req.body.description;
|
|
24
|
-
|
|
25
|
-
|
|
26
15
|
|
|
16
|
+
// update.firstname = req.body.firstname;
|
|
17
|
+
// update.lastname = req.body.lastname;
|
|
18
|
+
// update.attributes = req.body.attributes;
|
|
19
|
+
// update.description = req.body.description;
|
|
20
|
+
|
|
21
|
+
if (req.body.firstname != undefined) {
|
|
22
|
+
update.firstname = req.body.firstname;
|
|
23
|
+
}
|
|
24
|
+
if (req.body.lastname != undefined) {
|
|
25
|
+
update.lastname = req.body.lastname;
|
|
26
|
+
}
|
|
27
|
+
if (req.body.attributes != undefined) {
|
|
28
|
+
update.attributes = req.body.attributes;
|
|
29
|
+
}
|
|
30
|
+
if (req.body.description != undefined) {
|
|
31
|
+
update.description = req.body.description;
|
|
32
|
+
}
|
|
33
|
+
if (req.body.public_email != undefined) {
|
|
34
|
+
update.public_email = req.body.public_email;
|
|
35
|
+
}
|
|
36
|
+
if (req.body.public_website != undefined) {
|
|
37
|
+
update.public_website = req.body.public_website;
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
User.findByIdAndUpdate(req.user.id, update, { new: true, upsert: true }, function (err, updatedUser) {
|
|
28
41
|
if (err) {
|
|
29
42
|
winston.error("Error putting user",err);
|
|
@@ -27,11 +27,13 @@ class SubscriptionNotifierQueued {
|
|
|
27
27
|
if (messageEvent.queueEnabled) {
|
|
28
28
|
messageCreateKey = 'message.create.queue';
|
|
29
29
|
}
|
|
30
|
+
winston.debug('SubscriptionNotifierQueued messageCreateKey: ' + messageCreateKey);
|
|
31
|
+
|
|
30
32
|
messageEvent.on(messageCreateKey, function(message) { //queued tested
|
|
31
33
|
setImmediate(() => {
|
|
32
|
-
winston.debug('
|
|
34
|
+
winston.debug('SubscriptionNotifierQueued message.create');
|
|
33
35
|
subscriptionNotifier.subscribe('message.create', message);
|
|
34
|
-
winston.debug('
|
|
36
|
+
winston.debug('SubscriptionNotifierQueued message.create sent');
|
|
35
37
|
});
|
|
36
38
|
});
|
|
37
39
|
|
|
@@ -643,7 +643,7 @@ class WebSocketServer {
|
|
|
643
643
|
if (messageEvent.queueEnabled) {
|
|
644
644
|
messageCreateKey = 'message.create.queue.pubsub';
|
|
645
645
|
}
|
|
646
|
-
winston.debug('messageCreateKey: ' + messageCreateKey);
|
|
646
|
+
winston.debug('WS messageCreateKey: ' + messageCreateKey);
|
|
647
647
|
|
|
648
648
|
messageEvent.on(messageCreateKey, function (message) {
|
|
649
649
|
setImmediate(async () => {
|