Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
82f53276
Commit
82f53276
authored
Jul 26, 2019
by
Piotr Gawron
Browse files
fetch proper project when sending email
parent
b9c02b5f
Pipeline
#12110
passed with stage
in 8 minutes and 43 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
service/src/main/java/lcsb/mapviewer/services/impl/CommentService.java
View file @
82f53276
...
...
@@ -14,8 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
import
lcsb.mapviewer.common.ObjectUtils
;
import
lcsb.mapviewer.model.Project
;
import
lcsb.mapviewer.model.map.Comment
;
import
lcsb.mapviewer.model.map.model.Model
;
import
lcsb.mapviewer.model.map.model.ModelData
;
import
lcsb.mapviewer.model.map.model.*
;
import
lcsb.mapviewer.model.user.User
;
import
lcsb.mapviewer.persist.dao.map.CommentDao
;
import
lcsb.mapviewer.services.interfaces.*
;
...
...
@@ -93,9 +92,20 @@ public class CommentService implements ICommentService {
commentDao
.
add
(
comment
);
try
{
Project
project
=
submodel
.
getProject
();
if
(
project
==
null
)
{
for
(
SubmodelConnection
sc
:
submodel
.
getParentModels
())
{
if
(
sc
instanceof
ModelSubmodelConnection
)
{
project
=
((
ModelSubmodelConnection
)
sc
).
getParentModel
().
getModel
().
getProject
();
if
(
project
!=
null
)
{
break
;
}
}
}
}
EmailSender
emailSender
=
new
EmailSender
(
configurationService
);
emailSender
.
sendEmail
(
"New comment appeard in the "
+
submodel
.
getProject
().
getProjectId
(),
content
,
submodel
.
getProject
().
getNotifyEmail
());
emailSender
.
sendEmail
(
"New comment appeard in the "
+
project
.
getProjectId
(),
content
,
project
.
getNotifyEmail
());
}
catch
(
MessagingException
e
)
{
logger
.
error
(
"Problem with sending email."
,
e
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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