mirror of https://gitee.com/answerdev/answer.git
fix(tag): can not set synonym as tag itself
This commit is contained in:
parent
0ae6ddaa67
commit
b9ed2e5050
|
@ -109,6 +109,8 @@ backend:
|
||||||
other: "Should not contain synonym tags."
|
other: "Should not contain synonym tags."
|
||||||
cannot_update:
|
cannot_update:
|
||||||
other: "No permission to update."
|
other: "No permission to update."
|
||||||
|
cannot_set_synonym_as_itself:
|
||||||
|
other: "You cannot set the synonym of the current tag as itself."
|
||||||
theme:
|
theme:
|
||||||
not_found:
|
not_found:
|
||||||
other: "Theme not found."
|
other: "Theme not found."
|
||||||
|
|
|
@ -97,6 +97,8 @@ backend:
|
||||||
other: "不应包含同义词标签。"
|
other: "不应包含同义词标签。"
|
||||||
cannot_update:
|
cannot_update:
|
||||||
other: "没有更新标签权限。"
|
other: "没有更新标签权限。"
|
||||||
|
cannot_set_synonym_as_itself:
|
||||||
|
other: "你无法将当前标签的同义词设置为当前标签自己"
|
||||||
theme:
|
theme:
|
||||||
not_found:
|
not_found:
|
||||||
other: "主题未找到"
|
other: "主题未找到"
|
||||||
|
|
|
@ -58,4 +58,5 @@ const (
|
||||||
RevisionReviewUnderway = "error.revision.review_underway"
|
RevisionReviewUnderway = "error.revision.review_underway"
|
||||||
RevisionNoPermission = "error.revision.no_permission"
|
RevisionNoPermission = "error.revision.no_permission"
|
||||||
UserCannotUpdateYourRole = "error.user.cannot_update_your_role"
|
UserCannotUpdateYourRole = "error.user.cannot_update_your_role"
|
||||||
|
TagCannotSetSynonymAsItself = "error.tag.cannot_set_synonym_as_itself"
|
||||||
)
|
)
|
||||||
|
|
|
@ -216,6 +216,9 @@ func (ts *TagService) UpdateTagSynonym(ctx context.Context, req *schema.UpdateTa
|
||||||
|
|
||||||
// find all exist tag
|
// find all exist tag
|
||||||
for _, item := range req.SynonymTagList {
|
for _, item := range req.SynonymTagList {
|
||||||
|
if item.SlugName == mainTagInfo.SlugName {
|
||||||
|
return errors.BadRequest(reason.TagCannotSetSynonymAsItself)
|
||||||
|
}
|
||||||
addSynonymTagList = append(addSynonymTagList, item.SlugName)
|
addSynonymTagList = append(addSynonymTagList, item.SlugName)
|
||||||
}
|
}
|
||||||
tagListInDB, err := ts.tagCommonService.GetTagListByNames(ctx, addSynonymTagList)
|
tagListInDB, err := ts.tagCommonService.GetTagListByNames(ctx, addSynonymTagList)
|
||||||
|
|
Loading…
Reference in New Issue