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
a9286462
Commit
a9286462
authored
Nov 19, 2012
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文章、评论同步信息
parent
abe438a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
...ain/java/org/b3log/solo/api/symphony/ArticleReceiver.java
+6
-2
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
...ain/java/org/b3log/solo/api/symphony/CommentReceiver.java
+8
-4
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
.../main/java/org/b3log/solo/event/rhythm/ArticleSender.java
+6
-6
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
...ain/java/org/b3log/solo/event/symphony/CommentSender.java
+5
-5
No files found.
core/src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
View file @
a9286462
...
...
@@ -42,7 +42,7 @@ import org.jsoup.Jsoup;
* Article receiver (from B3log Symphony).
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
1, Oct 12
, 2012
* @version 1.0.0.
2, Nov 19
, 2012
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -131,8 +131,12 @@ public final class ArticleReceiver {
article
.
put
(
Common
.
POST_TO_COMMUNITY
,
false
);
article
.
put
(
Article
.
ARTICLE_COMMENTABLE
,
true
);
article
.
put
(
Article
.
ARTICLE_VIEW_PWD
,
""
);
String
content
=
article
.
getString
(
Article
.
ARTICLE_CONTENT
);
final
String
articleId
=
article
.
getString
(
Keys
.
OBJECT_ID
);
content
+=
"<br/><p><i>该文章同步自 <a href='http://symphony.b3log.org/article/"
+
articleId
+
"'>B3log 社区</a></i></p>"
;
article
.
put
(
Article
.
ARTICLE_CONTENT
,
content
);
final
String
articleId
=
articleMgmtService
.
addArticle
(
requestJSONObject
);
articleMgmtService
.
addArticle
(
requestJSONObject
);
ret
.
put
(
Keys
.
OBJECT_ID
,
articleId
);
ret
.
put
(
Keys
.
MSG
,
"add article succ"
);
...
...
core/src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
View file @
a9286462
...
...
@@ -65,7 +65,7 @@ import org.json.JSONObject;
* Comment receiver (from B3log Symphony).
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.
1, Oct 17
, 2012
* @version 1.0.0.
2, Nov 19
, 2012
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -130,6 +130,7 @@ public final class CommentReceiver {
* "comment": {
* "userB3Key": "",
* "oId": "",
* "commentSymphonyArticleId": "",
* "commentOnArticleId": "",
* "commentAuthorName": "",
* "commentAuthorEmail": "",
...
...
@@ -177,12 +178,15 @@ public final class CommentReceiver {
final
String
commentName
=
symphonyCmt
.
getString
(
"commentAuthorName"
);
final
String
commentEmail
=
symphonyCmt
.
getString
(
"commentAuthorEmail"
).
trim
().
toLowerCase
();
final
String
commentURL
=
"http://"
+
symphonyCmt
.
optString
(
"commentAuthorURL"
);
final
String
commentContent
=
symphonyCmt
.
getString
(
Comment
.
COMMENT_CONTENT
);
final
String
commentId
=
symphonyCmt
.
optString
(
Keys
.
OBJECT_ID
);
String
commentContent
=
symphonyCmt
.
getString
(
Comment
.
COMMENT_CONTENT
);
commentContent
+=
"<br/><p><i>该评论同步自 <a href='http://symphony.b3log.org/article/"
+
symphonyCmt
.
optString
(
"commentSymphonyArticleId"
)
+
"#"
+
commentId
+
"'>B3log 社区</a></i></p>"
;
final
String
originalCommentId
=
symphonyCmt
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
// Step 1: Add comment
final
JSONObject
comment
=
new
JSONObject
();
JSONObject
originalComment
=
null
;
final
String
commentId
=
symphonyCmt
.
optString
(
Keys
.
OBJECT_ID
);
comment
.
put
(
Keys
.
OBJECT_ID
,
commentId
);
comment
.
put
(
Comment
.
COMMENT_NAME
,
commentName
);
comment
.
put
(
Comment
.
COMMENT_EMAIL
,
commentEmail
);
...
...
@@ -209,7 +213,7 @@ public final class CommentReceiver {
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
,
""
);
comment
.
put
(
Comment
.
COMMENT_ORIGINAL_COMMENT_NAME
,
""
);
}
setCommentThumbnailURL
(
comment
);
ret
.
put
(
Comment
.
COMMENT_THUMBNAIL_URL
,
comment
.
getString
(
Comment
.
COMMENT_THUMBNAIL_URL
));
// Sets comment on article....
...
...
core/src/main/java/org/b3log/solo/event/rhythm/ArticleSender.java
View file @
a9286462
...
...
@@ -41,7 +41,7 @@ import org.json.JSONObject;
* This listener is responsible for sending article to B3log Rhythm.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.2.
2, Nov 2
, 2012
* @version 1.0.2.
3, Nov 19
, 2012
* @since 0.3.1
*/
public
final
class
ArticleSender
extends
AbstractEventListener
<
JSONObject
>
{
...
...
@@ -95,11 +95,11 @@ public final class ArticleSender extends AbstractEventListener<JSONObject> {
}
final
String
blogHost
=
preference
.
getString
(
Preference
.
BLOG_HOST
).
toLowerCase
();
//
if (blogHost.contains("localhost")) {
//
LOGGER.log(Level.INFO, "Blog Solo runs on local server, so should not send this article[id={0}, title={1}] to Rhythm",
//
new Object[]{originalArticle.getString(Keys.OBJECT_ID), originalArticle.getString(Article.ARTICLE_TITLE)});
//
return;
//
}
if
(
blogHost
.
contains
(
"localhost"
))
{
LOGGER
.
log
(
Level
.
INFO
,
"Blog Solo runs on local server, so should not send this article[id={0}, title={1}] to Rhythm"
,
new
Object
[]{
originalArticle
.
getString
(
Keys
.
OBJECT_ID
),
originalArticle
.
getString
(
Article
.
ARTICLE_TITLE
)});
return
;
}
final
HTTPRequest
httpRequest
=
new
HTTPRequest
();
httpRequest
.
setURL
(
ADD_ARTICLE_URL
);
...
...
core/src/main/java/org/b3log/solo/event/symphony/CommentSender.java
View file @
a9286462
...
...
@@ -89,11 +89,11 @@ public final class CommentSender extends AbstractEventListener<JSONObject> {
}
final
String
blogHost
=
preference
.
getString
(
Preference
.
BLOG_HOST
).
toLowerCase
();
//
if (blogHost.contains("localhost")) {
//
LOGGER.log(Level.INFO, "Blog Solo runs on local server, so should not send this comment[id={0}] to Symphony",
// new Object[]{or
ginalComment.getString(Keys.OBJECT_ID)});
//
return;
//
}
if
(
blogHost
.
contains
(
"localhost"
))
{
LOGGER
.
log
(
Level
.
INFO
,
"Blog Solo runs on local server, so should not send this comment[id={0}] to Symphony"
,
new
Object
[]{
ori
ginalComment
.
getString
(
Keys
.
OBJECT_ID
)});
return
;
}
final
HTTPRequest
httpRequest
=
new
HTTPRequest
();
httpRequest
.
setURL
(
ADD_COMMENT_URL
);
...
...
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