@tiledesk/tiledesk-server 2.3.5 → 2.3.7-1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/docker-community-worker-push-latest.yml +23 -0
- package/.github/workflows/docker-image-tag-worker-community-tag-push.yml +22 -0
- package/CHANGELOG.md +361 -3
- package/Dockerfile-jobs +31 -0
- package/app.js +62 -69
- package/channels/chat21/chat21Handler.js +37 -6
- package/channels/chat21/chat21WebHook.js +52 -29
- package/channels/chat21/package-lock.json +663 -706
- package/channels/chat21/package.json +2 -2
- package/config/labels/widget.json +337 -136
- package/deploy.sh +2 -0
- package/event/messageEvent.js +110 -9
- package/jobs.js +80 -0
- package/jobsManager.js +47 -0
- package/middleware/has-role.js +10 -3
- package/middleware/ipFilter.js +220 -0
- package/middleware/passport.js +8 -2
- package/models/department.js +1 -1
- package/models/faq.js +77 -25
- package/models/faq_kb.js +19 -0
- package/models/message.js +10 -8
- package/models/project.js +10 -0
- package/models/project_user.js +10 -0
- package/models/request.js +12 -1
- package/package.json +12 -11
- package/pubmodules/activities/activityArchiver.js +216 -90
- package/pubmodules/activities/routes/activity.js +1 -1
- package/pubmodules/apps/index.js +8 -0
- package/pubmodules/apps/listener.js +27 -0
- package/pubmodules/cache/index.js +2 -0
- package/pubmodules/cache/mongoose-cachegoose-fn.js +630 -0
- package/pubmodules/canned/cannedResponse.js +4 -0
- package/pubmodules/canned/cannedResponseRoute.js +10 -5
- package/pubmodules/dialogflow/index.js +10 -0
- package/pubmodules/dialogflow/listener.js +66 -0
- package/pubmodules/emailNotification/requestNotification.js +58 -28
- package/pubmodules/events/eventRoute.js +49 -24
- package/pubmodules/messageTransformer/messageHandlebarsTransformerInterceptor.js +6 -1
- package/pubmodules/messageTransformer/messageTransformerInterceptor.js +10 -4
- package/pubmodules/pubModulesManager.js +173 -7
- package/pubmodules/queue/index.js +4 -0
- package/pubmodules/queue/reconnect.js +331 -0
- package/pubmodules/queue/reconnectFanout.js +256 -0
- package/pubmodules/rasa/listener.js +5 -5
- package/pubmodules/routing-queue/index.js +3 -0
- package/pubmodules/routing-queue/listener.js +328 -0
- package/pubmodules/rules/conciergeBot.js +4 -4
- package/pubmodules/scheduler/tasks/closeAgentUnresponsiveRequestTask.js +6 -1
- package/pubmodules/scheduler/tasks/closeBotUnresponsiveRequestTask.js +7 -1
- package/pubmodules/tilebot/index.js +11 -0
- package/pubmodules/tilebot/listener.js +85 -0
- package/pubmodules/trigger/rulesTrigger.js +137 -14
- package/pubmodules/trigger/start.js +5 -1
- package/pubmodules/whatsapp/index.js +7 -0
- package/pubmodules/whatsapp/listener.js +32 -0
- package/routes/auth.js +7 -2
- package/routes/campaigns.js +3 -3
- package/routes/department.js +3 -2
- package/routes/email.js +32 -2
- package/routes/faq.js +37 -2
- package/routes/faq_kb.js +496 -133
- package/routes/faqpub.js +5 -0
- package/routes/lead.js +56 -0
- package/routes/message.js +196 -14
- package/routes/messagesRoot.js +39 -0
- package/routes/project.js +76 -4
- package/routes/project_user.js +11 -1
- package/routes/project_user_test.js +19 -0
- package/routes/request.js +134 -30
- package/routes/troubleshooting.js +12 -0
- package/routes/users-util.js +39 -0
- package/routes/users.js +1 -1
- package/routes/widget.js +64 -2
- package/services/BotSubscriptionNotifier.js +5 -0
- package/services/banUserNotifier.js +86 -0
- package/services/cacheEnabler.js +56 -0
- package/services/chatbotService.js +101 -0
- package/services/departmentService.js +25 -3
- package/services/emailService.js +170 -28
- package/services/faqBotHandler.js +2 -3
- package/services/faqService.js +28 -3
- package/services/geoService.js +36 -6
- package/services/labelService.js +1 -1
- package/services/leadService.js +3 -2
- package/services/messageService.js +4 -2
- package/services/modulesManager.js +23 -76
- package/services/operatingHoursService.js +9 -4
- package/services/requestService.js +75 -39
- package/services/subscriptionNotifier.js +9 -4
- package/services/trainingService.js +106 -0
- package/template/email/assignedEmailMessage.html +21 -11
- package/template/email/assignedRequest.html +21 -11
- package/template/email/beenInvitedExistingUser.html +16 -6
- package/template/email/beenInvitedNewUser.html +16 -6
- package/template/email/emailDirect.html +130 -0
- package/template/email/newMessage.html +18 -8
- package/template/email/newMessageFollower.html +22 -12
- package/template/email/passwordChanged.html +15 -5
- package/template/email/pooledEmailMessage.html +21 -11
- package/template/email/pooledRequest.html +20 -10
- package/template/email/resetPassword.html +15 -5
- package/template/email/sendTranscript.html +7 -4
- package/template/email/ticket.html +17 -7
- package/template/email/verify.html +15 -5
- package/test/cannedRoute.js +157 -0
- package/test/chatbot-mock.js +127 -0
- package/test/example-json-intents.txt +1 -0
- package/test/example-json.txt +1 -0
- package/test/example.json +1 -0
- package/test/faqRoute.js +353 -208
- package/test/faqkbRoute.js +669 -64
- package/test/imageRoute.js +1 -1
- package/test/messageRoute.js +387 -5
- package/test/requestRoute.js +6 -6
- package/test/requestService.js +55 -4
- package/test-int/cache-project.js +90 -0
- package/test-int/cache-project_user.js +88 -0
- package/utils/UIDGenerator.js +20 -0
- package/utils/cacheUtil.js +2 -2
- package/utils/orgUtil.js +3 -3
- package/utils/promiseUtil.js +31 -0
- package/utils/recipientEmailUtil.js +66 -0
- package/utils/sendEmailUtil.js +34 -0
- package/utils/sendMessageUtil.js +1 -1
- package/utils/stringUtil.js +12 -0
- package/websocket/webSocketServer.js +33 -10
@@ -11,9 +11,19 @@
|
|
11
11
|
img {
|
12
12
|
max-width: 100%;
|
13
13
|
margin-left:16px;
|
14
|
-
margin-bottom:16px;
|
15
14
|
text-align:center !important;
|
16
15
|
}
|
16
|
+
img.CToWUd {
|
17
|
+
margin-bottom: 16px;
|
18
|
+
max-width: 200px !important;
|
19
|
+
width: 200px !important;
|
20
|
+
min-width: 200px !important;
|
21
|
+
outline: none;
|
22
|
+
text-decoration: none;
|
23
|
+
border: none;
|
24
|
+
height: auto;
|
25
|
+
margin-left: 0px;
|
26
|
+
}
|
17
27
|
body {
|
18
28
|
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em;
|
19
29
|
}
|
@@ -82,7 +92,7 @@
|
|
82
92
|
|
83
93
|
<div style="text-align:center">
|
84
94
|
<a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
|
85
|
-
<img src="https://tiledesk.com/wp-content/uploads/
|
95
|
+
<img src="https://tiledesk.com/wp-content/uploads/2023/01/tiledesk_log_email_200.png" class="CToWUd">
|
86
96
|
</a>
|
87
97
|
</div>
|
88
98
|
</tr>
|
@@ -102,7 +112,7 @@
|
|
102
112
|
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
103
113
|
|
104
114
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
105
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
115
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
106
116
|
{{#ifEquals message.type "text"}}
|
107
117
|
<div style="white-space: pre-wrap;">{{{msgText}}}</div>
|
108
118
|
{{/ifEquals}}
|
@@ -120,26 +130,26 @@
|
|
120
130
|
|
121
131
|
|
122
132
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
123
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
133
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
124
134
|
Project name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{project.name}}</strong>
|
125
135
|
</td>
|
126
136
|
</tr>
|
127
137
|
|
128
138
|
|
129
139
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
130
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
140
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
131
141
|
Department name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.department.name}}</strong>
|
132
142
|
</td>
|
133
143
|
</tr>
|
134
144
|
|
135
145
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
136
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
146
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
137
147
|
From email : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.lead.email}}</strong>
|
138
148
|
</td>
|
139
149
|
</tr>
|
140
150
|
|
141
151
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
142
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
152
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
143
153
|
Contact name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.lead.fullname}}</strong>
|
144
154
|
</td>
|
145
155
|
</tr>
|
@@ -151,7 +161,7 @@
|
|
151
161
|
</tr> -->
|
152
162
|
|
153
163
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
154
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
164
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
155
165
|
Channel : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
156
166
|
|
157
167
|
{{#ifEquals request.channel.name "chat21"}}
|
@@ -166,7 +176,7 @@
|
|
166
176
|
</tr>
|
167
177
|
|
168
178
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
169
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
179
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
170
180
|
<a href="{{baseScope.baseUrl}}/#/project/{{request.id_project}}/wsrequest/{{request.request_id}}/messages">Open the dashboard</a>.
|
171
181
|
|
172
182
|
</td>
|
@@ -177,7 +187,7 @@
|
|
177
187
|
|
178
188
|
|
179
189
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
180
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
190
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
181
191
|
</td>
|
182
192
|
</tr>
|
183
193
|
</table>
|
@@ -187,7 +197,7 @@
|
|
187
197
|
<div class="footer" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
|
188
198
|
<table width="100%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
189
199
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
190
|
-
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;
|
200
|
+
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;" align="center" valign="top">
|
191
201
|
<span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
|
192
202
|
<br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span>
|
193
203
|
</td>
|
@@ -10,9 +10,19 @@
|
|
10
10
|
img {
|
11
11
|
max-width: 100%;
|
12
12
|
margin-left:16px;
|
13
|
-
margin-bottom:16px;
|
14
13
|
text-align:center !important;
|
15
14
|
}
|
15
|
+
img.CToWUd {
|
16
|
+
margin-bottom: 16px;
|
17
|
+
max-width: 200px !important;
|
18
|
+
width: 200px !important;
|
19
|
+
min-width: 200px !important;
|
20
|
+
outline: none;
|
21
|
+
text-decoration: none;
|
22
|
+
border: none;
|
23
|
+
height: auto;
|
24
|
+
margin-left: 0px;
|
25
|
+
}
|
16
26
|
body {
|
17
27
|
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em;
|
18
28
|
}
|
@@ -82,7 +92,7 @@
|
|
82
92
|
|
83
93
|
<div style="text-align:center">
|
84
94
|
<a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
|
85
|
-
<img src="https://tiledesk.com/wp-content/uploads/
|
95
|
+
<img src="https://tiledesk.com/wp-content/uploads/2023/01/tiledesk_log_email_200.png" class="CToWUd">
|
86
96
|
</a>
|
87
97
|
</div>
|
88
98
|
</tr>
|
@@ -103,7 +113,7 @@
|
|
103
113
|
|
104
114
|
|
105
115
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
106
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
116
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
107
117
|
<div style="white-space: pre-wrap;">{{{msgText}}}</div>
|
108
118
|
</td>
|
109
119
|
</tr>
|
@@ -112,7 +122,7 @@
|
|
112
122
|
|
113
123
|
|
114
124
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
115
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
125
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
116
126
|
Project name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{project.name}}</strong>
|
117
127
|
</td>
|
118
128
|
</tr>
|
@@ -120,19 +130,19 @@
|
|
120
130
|
|
121
131
|
|
122
132
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
123
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
133
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
124
134
|
Department name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.department.name}}</strong>
|
125
135
|
</td>
|
126
136
|
</tr>
|
127
137
|
|
128
138
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
129
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
139
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
130
140
|
Source page : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.sourcePage}}</strong>
|
131
141
|
</td>
|
132
142
|
</tr>
|
133
143
|
|
134
144
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
135
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
145
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
136
146
|
Contact name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{request.lead.fullname}}</strong>
|
137
147
|
</td>
|
138
148
|
</tr>
|
@@ -140,7 +150,7 @@
|
|
140
150
|
|
141
151
|
|
142
152
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
143
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
153
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
144
154
|
Channel : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
145
155
|
|
146
156
|
{{#ifEquals request.channel.name "chat21"}}
|
@@ -155,7 +165,7 @@
|
|
155
165
|
</tr>
|
156
166
|
|
157
167
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
158
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
168
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
159
169
|
<a href="{{baseScope.baseUrl}}/#/project/{{request.id_project}}/wsrequest/{{request.request_id}}/messages">Open the dashboard</a>.
|
160
170
|
|
161
171
|
</td>
|
@@ -176,7 +186,7 @@
|
|
176
186
|
<div class="footer" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
|
177
187
|
<table width="100%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
178
188
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
179
|
-
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;
|
189
|
+
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;" align="center" valign="top">
|
180
190
|
<span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
|
181
191
|
<br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span>
|
182
192
|
</td>
|
@@ -9,9 +9,19 @@
|
|
9
9
|
img {
|
10
10
|
max-width: 100%;
|
11
11
|
margin-left:16px;
|
12
|
-
margin-bottom:16px;
|
13
12
|
text-align:center !important;
|
14
13
|
}
|
14
|
+
img.CToWUd {
|
15
|
+
margin-bottom: 16px;
|
16
|
+
max-width: 200px !important;
|
17
|
+
width: 200px !important;
|
18
|
+
min-width: 200px !important;
|
19
|
+
outline: none;
|
20
|
+
text-decoration: none;
|
21
|
+
border: none;
|
22
|
+
height: auto;
|
23
|
+
margin-left: 0px;
|
24
|
+
}
|
15
25
|
body {
|
16
26
|
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em;
|
17
27
|
}
|
@@ -71,7 +81,7 @@
|
|
71
81
|
|
72
82
|
<div style="text-align:center">
|
73
83
|
<a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
|
74
|
-
<img src="https://tiledesk.com/wp-content/uploads/
|
84
|
+
<img src="https://tiledesk.com/wp-content/uploads/2023/01/tiledesk_log_email_200.png" class="CToWUd">
|
75
85
|
</a>
|
76
86
|
</div>
|
77
87
|
|
@@ -84,7 +94,7 @@
|
|
84
94
|
|
85
95
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
86
96
|
|
87
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
97
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
88
98
|
<h2 style="text-align: center; letter-spacing: 1px; ">
|
89
99
|
Password reset request
|
90
100
|
</h2>
|
@@ -108,7 +118,7 @@
|
|
108
118
|
</tr>
|
109
119
|
|
110
120
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
111
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
121
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
112
122
|
</td>
|
113
123
|
</tr>
|
114
124
|
</table>
|
@@ -118,7 +128,7 @@
|
|
118
128
|
<div class="footer" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
|
119
129
|
<table width="100%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
120
130
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
121
|
-
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;
|
131
|
+
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;" align="center" valign="top">
|
122
132
|
<span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
|
123
133
|
<br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span>
|
124
134
|
</td>
|
@@ -75,7 +75,8 @@
|
|
75
75
|
|
76
76
|
<div style="text-align:center">
|
77
77
|
<a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
|
78
|
-
<img src="https://tiledesk.com/tiledesk-logo.png" style="width:50%;outline:none;text-decoration:none;border:none;min-height:36px" class="CToWUd">
|
78
|
+
<!-- <img src="https://tiledesk.com/tiledesk-logo.png" style="width:50%;outline:none;text-decoration:none;border:none;min-height:36px" class="CToWUd"> -->
|
79
|
+
<img src="https://tiledesk.com/wp-content/uploads/2023/01/tiledesk_log_email_200.png" style="max-width:200px;outline:none;text-decoration:none;border:none;height:auto;margin-left:0px;" class="CToWUd">
|
79
80
|
</a>
|
80
81
|
</div>
|
81
82
|
</tr>
|
@@ -91,7 +92,9 @@
|
|
91
92
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
92
93
|
|
93
94
|
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
|
94
|
-
<strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"
|
95
|
+
<!-- <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">-->
|
96
|
+
Hi,
|
97
|
+
<!-- </strong> -->
|
95
98
|
<br><br> here's the transcript of your conversation.
|
96
99
|
|
97
100
|
</td>
|
@@ -107,7 +110,7 @@
|
|
107
110
|
|
108
111
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
109
112
|
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
|
110
|
-
<strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
113
|
+
<!-- <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"> -->
|
111
114
|
|
112
115
|
|
113
116
|
|
@@ -117,7 +120,7 @@
|
|
117
120
|
|
118
121
|
|
119
122
|
|
120
|
-
|
123
|
+
<!-- </strong> -->
|
121
124
|
</td>
|
122
125
|
</tr>
|
123
126
|
|
@@ -10,9 +10,19 @@
|
|
10
10
|
img {
|
11
11
|
max-width: 100%;
|
12
12
|
margin-left:16px;
|
13
|
-
margin-bottom:16px;
|
14
13
|
text-align:center !important;
|
15
14
|
}
|
15
|
+
img.CToWUd {
|
16
|
+
margin-bottom: 16px;
|
17
|
+
max-width: 200px !important;
|
18
|
+
width: 200px !important;
|
19
|
+
min-width: 200px !important;
|
20
|
+
outline: none;
|
21
|
+
text-decoration: none;
|
22
|
+
border: none;
|
23
|
+
height: auto;
|
24
|
+
margin-left: 0px;
|
25
|
+
}
|
16
26
|
body {
|
17
27
|
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em;
|
18
28
|
}
|
@@ -75,7 +85,7 @@
|
|
75
85
|
|
76
86
|
<div style="text-align:center">
|
77
87
|
<a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
|
78
|
-
<img src="https://tiledesk.com/wp-content/uploads/
|
88
|
+
<img src="https://tiledesk.com/wp-content/uploads/2023/01/tiledesk_log_email_200.png" class="CToWUd">
|
79
89
|
</a>
|
80
90
|
</div>
|
81
91
|
</td>
|
@@ -97,7 +107,7 @@
|
|
97
107
|
|
98
108
|
|
99
109
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
100
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
110
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
101
111
|
Sender: <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{message.senderFullname}}</strong>
|
102
112
|
</td>
|
103
113
|
</tr>
|
@@ -105,7 +115,7 @@
|
|
105
115
|
|
106
116
|
|
107
117
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
108
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
118
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
109
119
|
{{#ifEquals message.type "text"}}
|
110
120
|
<div style="white-space: pre-wrap;">{{{msgText}}}</div>
|
111
121
|
{{/ifEquals}}
|
@@ -161,7 +171,7 @@
|
|
161
171
|
|
162
172
|
|
163
173
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
164
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
174
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
165
175
|
|
166
176
|
Click <a href="{{seamlessPage}}{{tokenQueryString}}">here</a> to continue by chat the conversation.
|
167
177
|
</td>
|
@@ -170,7 +180,7 @@
|
|
170
180
|
|
171
181
|
|
172
182
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
173
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
183
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
174
184
|
</td>
|
175
185
|
</tr>
|
176
186
|
</table>
|
@@ -180,7 +190,7 @@
|
|
180
190
|
<div class="footer" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
|
181
191
|
<table width="100%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
182
192
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
183
|
-
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;
|
193
|
+
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;" align="center" valign="top">
|
184
194
|
<span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
|
185
195
|
<!-- <br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span> -->
|
186
196
|
</td>
|
@@ -10,9 +10,19 @@
|
|
10
10
|
img {
|
11
11
|
max-width: 100%;
|
12
12
|
margin-left:16px;
|
13
|
-
margin-bottom:16px;
|
14
13
|
text-align:center !important;
|
15
14
|
}
|
15
|
+
img.CToWUd {
|
16
|
+
margin-bottom: 16px;
|
17
|
+
max-width: 200px !important;
|
18
|
+
width: 200px !important;
|
19
|
+
min-width: 200px !important;
|
20
|
+
outline: none;
|
21
|
+
text-decoration: none;
|
22
|
+
border: none;
|
23
|
+
height: auto;
|
24
|
+
margin-left: 0px;
|
25
|
+
}
|
16
26
|
body {
|
17
27
|
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em;
|
18
28
|
}
|
@@ -75,7 +85,7 @@
|
|
75
85
|
|
76
86
|
<div style="text-align:center">
|
77
87
|
<a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
|
78
|
-
<img src="https://tiledesk.com/tiledesk-logo.png"
|
88
|
+
<img src="https://tiledesk.com/tiledesk-logo.png" class="CToWUd">
|
79
89
|
</a>
|
80
90
|
</div>
|
81
91
|
</tr>
|
@@ -97,7 +107,7 @@
|
|
97
107
|
<table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
98
108
|
|
99
109
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
100
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
110
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
101
111
|
<strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">Hi {{savedUser.firstname}} {{savedUser.lastname}},</strong>
|
102
112
|
<!-- <br> welcome on TileDesk.com. -->
|
103
113
|
<br><br> Thank you for signin up with TileDesk.
|
@@ -108,7 +118,7 @@
|
|
108
118
|
</tr>
|
109
119
|
|
110
120
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
111
|
-
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;
|
121
|
+
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top">
|
112
122
|
</td>
|
113
123
|
</tr>
|
114
124
|
</table>
|
@@ -118,7 +128,7 @@
|
|
118
128
|
<div class="footer" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
|
119
129
|
<table width="100%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
120
130
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
121
|
-
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;
|
131
|
+
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0;" align="center" valign="top">
|
122
132
|
<span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
|
123
133
|
<br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span>
|
124
134
|
</td>
|
@@ -0,0 +1,157 @@
|
|
1
|
+
//During the test the env variable is set to test
|
2
|
+
process.env.NODE_ENV = 'test';
|
3
|
+
|
4
|
+
//Require the dev-dependencies
|
5
|
+
let chai = require('chai');
|
6
|
+
let expect = require('chai').expect;
|
7
|
+
|
8
|
+
let chaiHttp = require('chai-http');
|
9
|
+
let server = require('../app');
|
10
|
+
const projectService = require('../services/projectService');
|
11
|
+
const userService = require('../services/userService');
|
12
|
+
var RoleConstants = require("../models/roleConstants");
|
13
|
+
const Project_user = require('../models/project_user');
|
14
|
+
let should = chai.should();
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
chai.use(chaiHttp);
|
19
|
+
|
20
|
+
describe('CannedRoute', () => {
|
21
|
+
|
22
|
+
it('new canned by owner/admin', (done) => {
|
23
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
24
|
+
var pwd = "pwd";
|
25
|
+
|
26
|
+
userService.signup(email, pwd, "Test Firstname", "Test Lastname").then(savedUser => {
|
27
|
+
projectService.create("test1", savedUser._id).then(savedProject => {
|
28
|
+
|
29
|
+
chai.request(server)
|
30
|
+
.post('/' + savedProject._id + '/canned/')
|
31
|
+
.auth(email, pwd)
|
32
|
+
.set('content-type', 'application/json')
|
33
|
+
.send({ "title": "Test Title", "text": "Test Text" })
|
34
|
+
.end((err, res) => {
|
35
|
+
res.should.have.status(200);
|
36
|
+
res.body.should.be.a('object');
|
37
|
+
res.body.should.have.property('title').eql("Test Title");
|
38
|
+
res.body.should.have.property('text').eql("Test Text");
|
39
|
+
res.body.should.have.property('createdBy').eql(savedUser._id.toString());
|
40
|
+
res.body.should.have.property('shared').eql(true);
|
41
|
+
|
42
|
+
done();
|
43
|
+
})
|
44
|
+
})
|
45
|
+
})
|
46
|
+
})
|
47
|
+
|
48
|
+
it('new canned by agent', (done) => {
|
49
|
+
var email = "test-signup-" + Date.now() + "@email.com";
|
50
|
+
var pwd = "pwd";
|
51
|
+
|
52
|
+
userService.signup(email, pwd, "Test Firstname", "Test Lastname").then(savedUser => {
|
53
|
+
projectService.create("test1", savedUser._id).then(savedProject => {
|
54
|
+
|
55
|
+
Project_user.findOneAndUpdate({id_project: savedProject._id, id_user: savedUser._id }, { role: RoleConstants.AGENT }, function(err, savedProject_user){
|
56
|
+
chai.request(server)
|
57
|
+
.post('/' + savedProject._id + '/canned/')
|
58
|
+
.auth(email, pwd)
|
59
|
+
.set('content-type', 'application/json')
|
60
|
+
.send({ title: "Test Title", text: "Test Text" })
|
61
|
+
.end((err, res) => {
|
62
|
+
res.body.should.be.a('object');
|
63
|
+
res.body.should.have.property('title').eql("Test Title");
|
64
|
+
res.body.should.have.property('text').eql("Test Text");
|
65
|
+
res.body.should.have.property('createdBy').eql(savedUser._id.toString());
|
66
|
+
res.body.should.have.property('shared').eql(false);
|
67
|
+
|
68
|
+
done();
|
69
|
+
})
|
70
|
+
})
|
71
|
+
})
|
72
|
+
})
|
73
|
+
})
|
74
|
+
|
75
|
+
it('get canned', (done) => {
|
76
|
+
|
77
|
+
var email_owner = "owner-signup-" + Date.now() + "@email.com";
|
78
|
+
var email_agent = "agent-signup-" + Date.now() + "@email.com";
|
79
|
+
var pwd = "pwd";
|
80
|
+
|
81
|
+
userService.signup(email_owner, pwd, "Owner Firstname", "Owner Lastname").then(savedOwner => {
|
82
|
+
userService.signup(email_agent, pwd, "Agent Firstname", "Agent Lastname").then(savedAgent => {
|
83
|
+
projectService.create("test1", savedOwner._id).then(savedProject => {
|
84
|
+
|
85
|
+
// invite Agent on savedProject (?)
|
86
|
+
chai.request(server)
|
87
|
+
.post('/' + savedProject._id + "/project_users/invite")
|
88
|
+
.auth(email_owner, pwd)
|
89
|
+
.set('content-type', 'application/json')
|
90
|
+
.send({ email: email_agent, role: "agent", userAvailable: false })
|
91
|
+
.end((err, res) => {
|
92
|
+
res.should.have.status(200);
|
93
|
+
|
94
|
+
|
95
|
+
chai.request(server)
|
96
|
+
.post('/' + savedProject._id + "/canned/")
|
97
|
+
.auth(email_owner, pwd)
|
98
|
+
.set('content-type', 'application/json')
|
99
|
+
.send({ title: "Test1 Title", text: "Test1 Text" })
|
100
|
+
.end((err, res) => {
|
101
|
+
|
102
|
+
res.should.have.status(200);
|
103
|
+
res.body.should.be.a('object');
|
104
|
+
|
105
|
+
chai.request(server)
|
106
|
+
.post('/' + savedProject._id + "/canned/")
|
107
|
+
.auth(email_agent, pwd)
|
108
|
+
.set('content-type', 'application/json')
|
109
|
+
.send({ title: "Test2 Title", text: "Test2 Text" })
|
110
|
+
.end((err, res) => {
|
111
|
+
|
112
|
+
res.should.have.status(200);
|
113
|
+
res.body.should.be.a('object');
|
114
|
+
|
115
|
+
chai.request(server)
|
116
|
+
.get('/' + savedProject._id + "/canned/")
|
117
|
+
.auth(email_owner, pwd)
|
118
|
+
.set('content-type', 'application-json')
|
119
|
+
.send()
|
120
|
+
.end((err, res) => {
|
121
|
+
|
122
|
+
res.should.have.status(200);
|
123
|
+
//res.body.should.be.a('array');
|
124
|
+
|
125
|
+
expect(res.body).to.be.an('array')
|
126
|
+
expect(res.body.length).to.equal(1);
|
127
|
+
|
128
|
+
chai.request(server)
|
129
|
+
.get('/' + savedProject._id + "/canned/")
|
130
|
+
.auth(email_agent, pwd)
|
131
|
+
.set('content-type', 'application-json')
|
132
|
+
.send()
|
133
|
+
.end((err, res) => {
|
134
|
+
|
135
|
+
res.should.have.status(200);
|
136
|
+
//res.body.should.be.a('array');
|
137
|
+
|
138
|
+
expect(res.body).to.be.an('array')
|
139
|
+
expect(res.body.length).to.equal(2);
|
140
|
+
|
141
|
+
done();
|
142
|
+
|
143
|
+
})
|
144
|
+
|
145
|
+
|
146
|
+
})
|
147
|
+
|
148
|
+
|
149
|
+
})
|
150
|
+
|
151
|
+
})
|
152
|
+
})
|
153
|
+
})
|
154
|
+
})
|
155
|
+
})
|
156
|
+
}).timeout(5000);
|
157
|
+
})
|