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

This commit is contained in:
haitaoo 2023-02-14 17:46:00 +08:00
parent d8409d5e26
commit ce88efb174
2 changed files with 21 additions and 6 deletions

View File

@ -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

View File

@ -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);
},