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
24c1ffbf
Unverified
Commit
24c1ffbf
authored
Sep 04, 2019
by
Van
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/3.6.5-dev' into 3.6.5-dev
parents
23acec9d
9b3bea87
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
src/main/java/org/b3log/solo/processor/console/CategoryConsole.java
...ava/org/b3log/solo/processor/console/CategoryConsole.java
+6
-1
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
+9
-5
src/main/java/org/b3log/solo/service/CategoryQueryService.java
...ain/java/org/b3log/solo/service/CategoryQueryService.java
+5
-2
No files found.
src/main/java/org/b3log/solo/processor/console/CategoryConsole.java
View file @
24c1ffbf
...
...
@@ -51,7 +51,8 @@ import java.util.Set;
* Category console request processing.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.1.3.5, Jul 22, 2019
* @author <a href="https://hacpai.com/member/lzh984294471">lzh984294471</a>
* @version 1.1.3.6, Sep 1, 2019
* @since 2.0.0
*/
@RequestProcessor
...
...
@@ -154,6 +155,7 @@ public class CategoryConsole {
* @param context the specified request context
* @throws Exception exception
*/
@SuppressWarnings
(
"unchecked"
)
public
void
getCategory
(
final
RequestContext
context
)
{
final
JsonRenderer
renderer
=
new
JsonRenderer
();
context
.
setRenderer
(
renderer
);
...
...
@@ -169,6 +171,9 @@ public class CategoryConsole {
final
StringBuilder
tagBuilder
=
new
StringBuilder
();
final
List
<
JSONObject
>
tags
=
(
List
<
JSONObject
>)
result
.
opt
(
Category
.
CATEGORY_T_TAGS
);
for
(
final
JSONObject
tag
:
tags
)
{
if
(
null
==
tag
||
!
tag
.
has
(
Tag
.
TAG_TITLE
))
{
// 修复修改分类时空指针错误 https://github.com/b3log/solo/pull/12876
continue
;
}
tagBuilder
.
append
(
tag
.
optString
(
Tag
.
TAG_TITLE
)).
append
(
","
);
}
tagBuilder
.
deleteCharAt
(
tagBuilder
.
length
()
-
1
);
...
...
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
View file @
24c1ffbf
...
...
@@ -52,7 +52,7 @@ import static org.b3log.solo.model.Article.*;
* Article management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.
1.6, Aug 18
, 2019
* @version 1.3.
2.0, Sep 1
, 2019
* @since 0.3.5
*/
@Service
...
...
@@ -117,6 +117,12 @@ public class ArticleMgmtService {
@Inject
private
CommentRepository
commentRepository
;
/**
* Category-tag repository.
*/
@Inject
private
CategoryTagRepository
categoryTagRepository
;
/**
* Permalink query service.
*/
...
...
@@ -810,19 +816,16 @@ public class ArticleMgmtService {
* @throws JSONException json exception
* @throws RepositoryException repository exception
*/
private
void
removeTagArticleRelations
(
final
String
articleId
,
final
String
...
tagIds
)
throws
JSONException
,
RepositoryException
{
private
void
removeTagArticleRelations
(
final
String
articleId
,
final
String
...
tagIds
)
throws
JSONException
,
RepositoryException
{
final
List
<
String
>
tagIdList
=
Arrays
.
asList
(
tagIds
);
final
List
<
JSONObject
>
tagArticleRelations
=
tagArticleRepository
.
getByArticleId
(
articleId
);
for
(
int
i
=
0
;
i
<
tagArticleRelations
.
size
();
i
++)
{
final
JSONObject
tagArticleRelation
=
tagArticleRelations
.
get
(
i
);
String
relationId
;
if
(
tagIdList
.
isEmpty
())
{
// Removes all if un-specified
relationId
=
tagArticleRelation
.
getString
(
Keys
.
OBJECT_ID
);
tagArticleRepository
.
remove
(
relationId
);
}
else
{
if
(
tagIdList
.
contains
(
tagArticleRelation
.
getString
(
Tag
.
TAG
+
"_"
+
Keys
.
OBJECT_ID
)))
{
relationId
=
tagArticleRelation
.
getString
(
Keys
.
OBJECT_ID
);
...
...
@@ -833,6 +836,7 @@ public class ArticleMgmtService {
final
String
tagId
=
tagArticleRelation
.
optString
(
Tag
.
TAG
+
"_"
+
Keys
.
OBJECT_ID
);
final
int
articleCount
=
tagArticleRepository
.
getArticleCount
(
tagId
);
if
(
1
>
articleCount
)
{
categoryTagRepository
.
removeByTagId
(
tagId
);
tagRepository
.
remove
(
tagId
);
}
}
...
...
src/main/java/org/b3log/solo/service/CategoryQueryService.java
View file @
24c1ffbf
...
...
@@ -43,7 +43,8 @@ import java.util.List;
* Category query service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.3, Jan 15, 2019
* @author <a href="https://hacpai.com/member/lzh984294471">lzh984294471</a>
* @version 1.0.1.4, Sep 1, 2019
* @since 2.0.0
*/
@Service
...
...
@@ -115,7 +116,9 @@ public class CategoryQueryService {
for
(
final
JSONObject
relation
:
relations
)
{
final
String
tagId
=
relation
.
optString
(
Tag
.
TAG
+
"_"
+
Keys
.
OBJECT_ID
);
final
JSONObject
tag
=
tagRepository
.
get
(
tagId
);
if
(
null
==
tag
)
{
// 修复修改分类时空指针错误 https://github.com/b3log/solo/pull/12876
continue
;
}
ret
.
add
(
tag
);
}
}
catch
(
final
RepositoryException
e
)
{
...
...
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