1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

fix(tags): tag selection modal shown when no tags can be selected (#3448)

This commit is contained in:
Sami Mazouz
2022-06-20 16:53:11 +01:00
committed by GitHub
parent 3e56bd3dc6
commit 613523c9b4

View File

@@ -65,10 +65,15 @@ export default function () {
const chosenSecondaryTags = chosenTags.filter((tag) => tag.position() === null);
const selectableTags = getSelectableTags();
const minPrimaryTags = parseInt(app.forum.attribute('minPrimaryTags'));
const minSecondaryTags = parseInt(app.forum.attribute('minSecondaryTags'));
const maxPrimaryTags = parseInt(app.forum.attribute('maxPrimaryTags'));
const maxSecondaryTags = parseInt(app.forum.attribute('maxSecondaryTags'));
if (
(!chosenTags.length ||
chosenPrimaryTags.length < app.forum.attribute('minPrimaryTags') ||
chosenSecondaryTags.length < app.forum.attribute('minSecondaryTags')) &&
((!chosenTags.length && maxPrimaryTags !== 0 && maxSecondaryTags !== 0) ||
chosenPrimaryTags.length < minPrimaryTags ||
chosenSecondaryTags.length < minSecondaryTags) &&
selectableTags.length
) {
app.modal.show(TagDiscussionModal, {