Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
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-1
Commits
a8a55dae
Commit
a8a55dae
authored
Dec 31, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去除“同步自”文案
parent
e7db0b76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
18 deletions
+15
-18
src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
...ain/java/org/b3log/solo/api/symphony/ArticleReceiver.java
+11
-13
src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
...ain/java/org/b3log/solo/api/symphony/CommentReceiver.java
+4
-5
No files found.
src/main/java/org/b3log/solo/api/symphony/ArticleReceiver.java
View file @
a8a55dae
...
...
@@ -15,7 +15,6 @@
*/
package
org
.
b3log
.
solo
.
api
.
symphony
;
import
javax.inject.Inject
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -41,12 +40,11 @@ import org.b3log.solo.util.QueryResults;
import
org.json.JSONObject
;
import
org.jsoup.Jsoup
;
/**
* Article receiver (from B3log Symphony).
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.
6, Oct
1, 2015
* @version 1.0.1.
7, Dec 3
1, 2015
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -100,8 +98,7 @@ public class ArticleReceiver {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* <pre>
* @param request the specified http servlet request, for example, <pre>
* {
* "article": {
* "oId": "",
...
...
@@ -113,13 +110,14 @@ public class ArticleReceiver {
* }
* }
* </pre>
*
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HTTPRequestMethod
.
POST
)
public
void
addArticle
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
throws
Exception
{
throws
Exception
{
final
JSONRenderer
renderer
=
new
JSONRenderer
();
context
.
setRenderer
(
renderer
);
...
...
@@ -156,8 +154,8 @@ public class ArticleReceiver {
String
content
=
article
.
getString
(
Article
.
ARTICLE_CONTENT
);
final
String
articleId
=
article
.
getString
(
Keys
.
OBJECT_ID
);
content
+=
"\n\n<p style='font-size: 12px;'><i>该文章同步自 <a href='http://hacpai.com/article/"
+
articleId
+
"' target='_blank'>黑客派</a></i></p>"
;
//
content += "\n\n<p style='font-size: 12px;'><i>该文章同步自 <a href='http://hacpai.com/article/" + articleId
//
+ "' target='_blank'>黑客派</a></i></p>";
article
.
put
(
Article
.
ARTICLE_CONTENT
,
content
);
articleMgmtService
.
addArticle
(
requestJSONObject
);
...
...
@@ -190,8 +188,7 @@ public class ArticleReceiver {
* </pre>
* </p>
*
* @param request the specified http servlet request, for example,
* <pre>
* @param request the specified http servlet request, for example, <pre>
* {
* "article": {
* "oId": "", // Symphony Article#clientArticleId
...
...
@@ -203,13 +200,14 @@ public class ArticleReceiver {
* }
* }
* </pre>
*
* @param response the specified http servlet response
* @param context the specified http request context
* @throws Exception exception
*/
@RequestProcessing
(
value
=
"/apis/symphony/article"
,
method
=
HTTPRequestMethod
.
PUT
)
public
void
updateArticle
(
final
HttpServletRequest
request
,
final
HttpServletResponse
response
,
final
HTTPRequestContext
context
)
throws
Exception
{
throws
Exception
{
final
JSONRenderer
renderer
=
new
JSONRenderer
();
context
.
setRenderer
(
renderer
);
...
...
@@ -253,8 +251,8 @@ public class ArticleReceiver {
article
.
put
(
Article
.
ARTICLE_VIEW_PWD
,
""
);
String
content
=
article
.
getString
(
Article
.
ARTICLE_CONTENT
);
content
+=
"\n\n<p style='font-size: 12px;'><i>该文章同步自 <a href='http://hacpai.com/article/"
+
articleId
+
"' target='_blank'>黑客派</a></i></p>"
;
//
content += "\n\n<p style='font-size: 12px;'><i>该文章同步自 <a href='http://hacpai.com/article/" + articleId
//
+ "' target='_blank'>黑客派</a></i></p>";
article
.
put
(
Article
.
ARTICLE_CONTENT
,
content
);
articleMgmtService
.
updateArticle
(
requestJSONObject
);
...
...
src/main/java/org/b3log/solo/api/symphony/CommentReceiver.java
View file @
a8a55dae
...
...
@@ -38,7 +38,6 @@ import org.b3log.latke.urlfetch.URLFetchService;
import
org.b3log.latke.urlfetch.URLFetchServiceFactory
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.latke.util.Strings
;
import
org.b3log.solo.SoloServletListener
;
import
org.b3log.solo.event.EventTypes
;
import
org.b3log.solo.model.Article
;
import
org.b3log.solo.model.Comment
;
...
...
@@ -57,7 +56,7 @@ import org.json.JSONObject;
* Comment receiver (from B3log Symphony).
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.1.1
0, Dec 29
, 2015
* @version 1.1.1.1
1, Dec 31
, 2015
* @since 0.5.5
*/
@RequestProcessor
...
...
@@ -201,9 +200,9 @@ public class CommentReceiver {
final
String
commentId
=
symphonyCmt
.
optString
(
Keys
.
OBJECT_ID
);
String
commentContent
=
symphonyCmt
.
getString
(
Comment
.
COMMENT_CONTENT
);
commentContent
+=
"<p class='cmtFromSym'><i>该评论同步自 <a href='"
+
SoloServletListener
.
B3LOG_SYMPHONY_SERVE_PATH
+
"/article/"
+
symphonyCmt
.
optString
(
"commentSymphonyArticleId"
)
+
"#"
+
commentId
+
"' target='_blank'>黑客派</a></i></p>"
;
//
commentContent += "<p class='cmtFromSym'><i>该评论同步自 <a href='" + SoloServletListener.B3LOG_SYMPHONY_SERVE_PATH
//
+ "/article/" + symphonyCmt.optString("commentSymphonyArticleId") + "#" + commentId
//
+ "' target='_blank'>黑客派</a></i></p>";
final
String
originalCommentId
=
symphonyCmt
.
optString
(
Comment
.
COMMENT_ORIGINAL_COMMENT_ID
);
// Step 1: Add comment
final
JSONObject
comment
=
new
JSONObject
();
...
...
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