Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
54bdf0f0
authored
Dec 18, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
solving problem with chat emails
parent
83edc34f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
sails/src/api/controllers/MessageController.js
sails/src/api/controllers/MessageController.js
View file @
54bdf0f0
...
@@ -42,10 +42,10 @@ module.exports = {
...
@@ -42,10 +42,10 @@ module.exports = {
return
([
Promise
.
resolve
(
msg
),
StuSup
.
find
({
id_stu
:
params
.
id_stu
}).
populate
(
'supervisor'
)]);
return
([
Promise
.
resolve
(
msg
),
StuSup
.
find
({
id_stu
:
params
.
id_stu
}).
populate
(
'supervisor'
)]);
})
})
.
spread
((
msg
,
stusups
)
=>
{
.
spread
((
msg
,
stusups
)
=>
{
var
emails
=
""
;
var
emails
=
[]
;
for
(
var
i
=
0
;
i
<
stusups
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
stusups
.
length
;
i
++
)
{
if
(
stusups
[
i
].
supervisor
.
id
!==
params
.
id_sup
)
if
(
stusups
[
i
].
supervisor
.
id
!==
params
.
id_sup
)
emails
=
emails
+
" "
+
stusups
[
i
].
supervisor
.
email
;
emails
.
append
(
stusups
[
i
].
supervisor
.
email
)
;
}
}
// Email body
// Email body
...
@@ -68,10 +68,12 @@ module.exports = {
...
@@ -68,10 +68,12 @@ module.exports = {
locale
:
msg
.
supervisor
.
lang
||
'es-es'
locale
:
msg
.
supervisor
.
lang
||
'es-es'
});
});
sails
.
log
.
debug
(
"Sending chat notification on student "
+
msg
.
student
.
id
+
" to "
+
emails
.
join
());
// Send Emails
// Send Emails
mailService
.
mailer
()
mailService
.
mailer
()
.
send
({
.
send
({
to
:
emails
,
to
:
emails
.
join
()
,
text
:
message
,
text
:
message
,
subject
:
subject
subject
:
subject
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment