2023-04-21 17:03:35 +02:00
|
|
|
import ComboBox from 'select-kit/components/combo-box';
|
2020-03-24 10:35:46 +01:00
|
|
|
import { computed } from "@ember/object";
|
|
|
|
import { makeArray } from "discourse-common/lib/helpers";
|
|
|
|
|
2023-04-21 17:03:35 +02:00
|
|
|
export default ComboBox.extend({
|
|
|
|
content: computed("groups.[]", "field.content.[]", function() {
|
2023-04-17 16:24:33 +02:00
|
|
|
const whitelist = makeArray(this.field.content);
|
2023-04-21 17:03:35 +02:00
|
|
|
return this.groups.filter(group => {
|
2023-04-21 17:16:55 +02:00
|
|
|
return !whitelist.length || whitelist.indexOf(group.id) > -1;
|
2023-04-21 17:03:35 +02:00
|
|
|
}).map(g => {
|
|
|
|
return {
|
|
|
|
id: g.id,
|
|
|
|
name: g.full_name
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|