Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(TagInfo): Set the correct permissions and prompt text for deleting tags

haitaooce88efb174d2
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index f00aa68e..ce9a04da 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -454,10 +454,13 @@ ui:
synonyms_text: The following tags will be remapped to
delete:
title: Delete this tag
- content: >-
- <p>We do not allowed deleting tag with posts.</p><p>Please remove this tag
- from the posts first.</p>
- content2: Are you sure you wish to delete?
+ tip_with_posts: >-
+ <p>We do not allowed <strong>deleting tag with posts</strong>.</p>
+ <p>Please remove this tag from the posts first.</p>
+ tip_with_synonyms: >-
+ <p>We do not allowed <strong>deleting tag with synonyms</strong>.</p>
+ <p>Please remove the synonyms from this tag first.</p>
+ tip: Are you sure you wish to delete?
close: Close
edit_tag:
title: Edit Tag
diff --git a/ui/src/pages/Tags/Info/index.tsx b/ui/src/pages/Tags/Info/index.tsx
index c28600e7..7a1e2d4c 100644
--- a/ui/src/pages/Tags/Info/index.tsx
+++ b/ui/src/pages/Tags/Info/index.tsx
@@ -86,15 +86,27 @@ const TagIntroduction = () => {
if (synonymsData?.synonyms && synonymsData.synonyms.length > 0) {
Modal.confirm({
title: t('delete.title'),
- content: t('delete.content2'),
+ content: t('delete.tip_with_synonyms'),
showConfirm: false,
cancelText: t('delete.close'),
});
return;
}
+ if (tagInfo.question_count > 0) {
+ Modal.confirm({
+ title: t('delete.title'),
+ content: t('delete.tip_with_posts'),
+ showConfirm: false,
+ cancelText: t('delete.close'),
+ });
+ return;
+ }
+
Modal.confirm({
title: t('delete.title'),
- content: t('delete.content'),
+ content: t('delete.tip'),
+ confirmText: t('delete', { keyPrefix: 'btns' }),
+ confirmBtnVariant: 'danger',
onConfirm: () => {
deleteTag(tagInfo.tag_id);
},