mirror of
https://github.com/flarum/framework.git
synced 2025-02-27 22:46:42 +08:00
Fix duplicate tags in TagDiscussionModal
Add an inclusion check for the tag itself as well as its parent before adding it to the list of selected tags.
This commit is contained in:
parent
bdb55e45c4
commit
b64e5d0998
@ -68,14 +68,13 @@ export default class TagDiscussionModal extends Modal {
|
|||||||
// If this tag has a parent, we'll also need to add the parent tag to the
|
// If this tag has a parent, we'll also need to add the parent tag to the
|
||||||
// selected list if it's not already in there.
|
// selected list if it's not already in there.
|
||||||
const parent = tag.parent();
|
const parent = tag.parent();
|
||||||
if (parent) {
|
if (parent && this.selected.indexOf(parent) === -1) {
|
||||||
const index = this.selected.indexOf(parent);
|
this.selected.push(parent);
|
||||||
if (index === -1) {
|
|
||||||
this.selected.push(parent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selected.push(tag);
|
if (this.selected.indexOf(tag) === -1) {
|
||||||
|
this.selected.push(tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user