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
9b3bea87
Unverified
Commit
9b3bea87
authored
Sep 01, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
Fix #12880
parent
e2a96625
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
+9
-5
No files found.
src/main/java/org/b3log/solo/service/ArticleMgmtService.java
View file @
9b3bea87
...
@@ -52,7 +52,7 @@ import static org.b3log.solo.model.Article.*;
...
@@ -52,7 +52,7 @@ import static org.b3log.solo.model.Article.*;
* Article management service.
* Article management service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @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
* @since 0.3.5
*/
*/
@Service
@Service
...
@@ -117,6 +117,12 @@ public class ArticleMgmtService {
...
@@ -117,6 +117,12 @@ public class ArticleMgmtService {
@Inject
@Inject
private
CommentRepository
commentRepository
;
private
CommentRepository
commentRepository
;
/**
* Category-tag repository.
*/
@Inject
private
CategoryTagRepository
categoryTagRepository
;
/**
/**
* Permalink query service.
* Permalink query service.
*/
*/
...
@@ -810,19 +816,16 @@ public class ArticleMgmtService {
...
@@ -810,19 +816,16 @@ public class ArticleMgmtService {
* @throws JSONException json exception
* @throws JSONException json exception
* @throws RepositoryException repository exception
* @throws RepositoryException repository exception
*/
*/
private
void
removeTagArticleRelations
(
final
String
articleId
,
final
String
...
tagIds
)
private
void
removeTagArticleRelations
(
final
String
articleId
,
final
String
...
tagIds
)
throws
JSONException
,
RepositoryException
{
throws
JSONException
,
RepositoryException
{
final
List
<
String
>
tagIdList
=
Arrays
.
asList
(
tagIds
);
final
List
<
String
>
tagIdList
=
Arrays
.
asList
(
tagIds
);
final
List
<
JSONObject
>
tagArticleRelations
=
tagArticleRepository
.
getByArticleId
(
articleId
);
final
List
<
JSONObject
>
tagArticleRelations
=
tagArticleRepository
.
getByArticleId
(
articleId
);
for
(
int
i
=
0
;
i
<
tagArticleRelations
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
tagArticleRelations
.
size
();
i
++)
{
final
JSONObject
tagArticleRelation
=
tagArticleRelations
.
get
(
i
);
final
JSONObject
tagArticleRelation
=
tagArticleRelations
.
get
(
i
);
String
relationId
;
String
relationId
;
if
(
tagIdList
.
isEmpty
())
{
// Removes all if un-specified
if
(
tagIdList
.
isEmpty
())
{
// Removes all if un-specified
relationId
=
tagArticleRelation
.
getString
(
Keys
.
OBJECT_ID
);
relationId
=
tagArticleRelation
.
getString
(
Keys
.
OBJECT_ID
);
tagArticleRepository
.
remove
(
relationId
);
tagArticleRepository
.
remove
(
relationId
);
}
else
{
}
else
{
if
(
tagIdList
.
contains
(
tagArticleRelation
.
getString
(
Tag
.
TAG
+
"_"
+
Keys
.
OBJECT_ID
)))
{
if
(
tagIdList
.
contains
(
tagArticleRelation
.
getString
(
Tag
.
TAG
+
"_"
+
Keys
.
OBJECT_ID
)))
{
relationId
=
tagArticleRelation
.
getString
(
Keys
.
OBJECT_ID
);
relationId
=
tagArticleRelation
.
getString
(
Keys
.
OBJECT_ID
);
...
@@ -833,6 +836,7 @@ public class ArticleMgmtService {
...
@@ -833,6 +836,7 @@ public class ArticleMgmtService {
final
String
tagId
=
tagArticleRelation
.
optString
(
Tag
.
TAG
+
"_"
+
Keys
.
OBJECT_ID
);
final
String
tagId
=
tagArticleRelation
.
optString
(
Tag
.
TAG
+
"_"
+
Keys
.
OBJECT_ID
);
final
int
articleCount
=
tagArticleRepository
.
getArticleCount
(
tagId
);
final
int
articleCount
=
tagArticleRepository
.
getArticleCount
(
tagId
);
if
(
1
>
articleCount
)
{
if
(
1
>
articleCount
)
{
categoryTagRepository
.
removeByTagId
(
tagId
);
tagRepository
.
remove
(
tagId
);
tagRepository
.
remove
(
tagId
);
}
}
}
}
...
...
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