Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo
Commits
a6929dad
Commit
a6929dad
authored
Oct 01, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运行在本地的话不发送评论/回复提醒邮件
parent
0875bc87
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
58 deletions
+65
-58
src/main/java/org/b3log/solo/event/comment/ArticleCommentReplyNotifier.java
...b3log/solo/event/comment/ArticleCommentReplyNotifier.java
+13
-8
src/main/java/org/b3log/solo/service/CommentMgmtService.java
src/main/java/org/b3log/solo/service/CommentMgmtService.java
+52
-50
No files found.
src/main/java/org/b3log/solo/event/comment/ArticleCommentReplyNotifier.java
View file @
a6929dad
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
*/
*/
package
org
.
b3log
.
solo
.
event
.
comment
;
package
org
.
b3log
.
solo
.
event
.
comment
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.event.AbstractEventListener
;
import
org.b3log.latke.event.AbstractEventListener
;
...
@@ -39,12 +38,11 @@ import org.b3log.solo.repository.impl.CommentRepositoryImpl;
...
@@ -39,12 +38,11 @@ import org.b3log.solo.repository.impl.CommentRepositoryImpl;
import
org.b3log.solo.service.PreferenceQueryService
;
import
org.b3log.solo.service.PreferenceQueryService
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
/**
/**
* This listener is responsible for processing article comment reply.
* This listener is responsible for processing article comment reply.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.1.6, May 17, 2013
* @version 1.
1.1.6, Oct 1, 2015
* @since 0.3.1
* @since 0.3.1
*/
*/
public
final
class
ArticleCommentReplyNotifier
extends
AbstractEventListener
<
JSONObject
>
{
public
final
class
ArticleCommentReplyNotifier
extends
AbstractEventListener
<
JSONObject
>
{
...
@@ -66,19 +64,26 @@ public final class ArticleCommentReplyNotifier extends AbstractEventListener<JSO
...
@@ -66,19 +64,26 @@ public final class ArticleCommentReplyNotifier extends AbstractEventListener<JSO
final
JSONObject
article
=
eventData
.
optJSONObject
(
Article
.
ARTICLE
);
final
JSONObject
article
=
eventData
.
optJSONObject
(
Article
.
ARTICLE
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Processing an event[type={0}, data={1}] in listener[className={2}]"
,
new
Object
[]
{
event
.
getType
(),
eventData
,
ArticleCommentReplyNotifier
.
class
.
getName
()});
new
Object
[]
{
event
.
getType
(),
eventData
,
ArticleCommentReplyNotifier
.
class
.
getName
()});
final
String
originalCommentId
=
comment
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
final
String
originalCommentId
=
comment
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
if
(
Strings
.
isEmptyOrNull
(
originalCommentId
))
{
if
(
Strings
.
isEmptyOrNull
(
originalCommentId
))
{
LOGGER
.
log
(
Level
.
DEBUG
,
"This comment[id={0}] is not a reply"
,
comment
.
optString
(
Keys
.
OBJECT_ID
));
LOGGER
.
log
(
Level
.
DEBUG
,
"This comment[id={0}] is not a reply"
,
comment
.
optString
(
Keys
.
OBJECT_ID
));
return
;
}
if
(
Latkes
.
getServePath
().
contains
(
"localhost"
))
{
LOGGER
.
log
(
Level
.
INFO
,
"Solo runs on local server, so should not send mail"
);
return
;
return
;
}
}
final
LatkeBeanManager
beanManager
=
Lifecycle
.
getBeanManager
();
final
LatkeBeanManager
beanManager
=
Lifecycle
.
getBeanManager
();
final
PreferenceQueryService
preferenceQueryService
=
beanManager
.
getReference
(
PreferenceQueryService
.
class
);
final
PreferenceQueryService
preferenceQueryService
=
beanManager
.
getReference
(
PreferenceQueryService
.
class
);
final
CommentRepository
commentRepository
=
beanManager
.
getReference
(
CommentRepositoryImpl
.
class
);
final
CommentRepository
commentRepository
=
beanManager
.
getReference
(
CommentRepositoryImpl
.
class
);
try
{
try
{
final
String
commentEmail
=
comment
.
getString
(
Comment
.
COMMENT_EMAIL
);
final
String
commentEmail
=
comment
.
getString
(
Comment
.
COMMENT_EMAIL
);
final
JSONObject
originalComment
=
commentRepository
.
get
(
originalCommentId
);
final
JSONObject
originalComment
=
commentRepository
.
get
(
originalCommentId
);
...
@@ -120,11 +125,11 @@ public final class ArticleCommentReplyNotifier extends AbstractEventListener<JSO
...
@@ -120,11 +125,11 @@ public final class ArticleCommentReplyNotifier extends AbstractEventListener<JSO
}
}
final
String
mailBody
=
replyNotificationTemplate
.
getString
(
"body"
).
replace
(
"${postLink}"
,
articleLink
).
replace
(
"${postTitle}"
,
articleTitle
).
replace
(
"${replier}"
,
commenter
).
replace
(
"${replyURL}"
,
Latkes
.
getServePath
()
+
commentSharpURL
).
replace
(
final
String
mailBody
=
replyNotificationTemplate
.
getString
(
"body"
).
replace
(
"${postLink}"
,
articleLink
).
replace
(
"${postTitle}"
,
articleTitle
).
replace
(
"${replier}"
,
commenter
).
replace
(
"${replyURL}"
,
Latkes
.
getServePath
()
+
commentSharpURL
).
replace
(
"${replyContent}"
,
commentContent
);
"${replyContent}"
,
commentContent
);
message
.
setHtmlBody
(
mailBody
);
message
.
setHtmlBody
(
mailBody
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
LOGGER
.
log
(
Level
.
DEBUG
,
"Sending a mail[mailSubject={0}, mailBody=[{1}] to [{2}]"
,
new
Object
[]
{
mailSubject
,
mailBody
,
originalCommentEmail
});
new
Object
[]
{
mailSubject
,
mailBody
,
originalCommentEmail
});
mailService
.
send
(
message
);
mailService
.
send
(
message
);
}
catch
(
final
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
...
...
src/main/java/org/b3log/solo/service/CommentMgmtService.java
View file @
a6929dad
This diff is collapsed.
Click to expand it.
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