mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: handles boolean with popupMenuOption (#7299)
Handle the case of https://github.com/discourse/DiscoTOC doing this kind of setup: ``` return { action: "insertDtoc", icon: "align-left", label: themePrefix("insert_table_of_contents"), condition: !composerController.get("model.canCategorize") }; ``` In this case there's no function to call, it's already set.
This commit is contained in:
parent
a6596662dc
commit
4b1b135ede
@ -255,10 +255,12 @@ export default Ember.Controller.extend({
|
|||||||
_setupPopupMenuOption(callback) {
|
_setupPopupMenuOption(callback) {
|
||||||
let option = callback();
|
let option = callback();
|
||||||
|
|
||||||
if (option.condition) {
|
if (typeof option.condition === "undefined") {
|
||||||
option.condition = this.get(option.condition);
|
|
||||||
} else {
|
|
||||||
option.condition = true;
|
option.condition = true;
|
||||||
|
} else if (typeof option.condition === "boolean") {
|
||||||
|
// uses existing value
|
||||||
|
} else {
|
||||||
|
option.condition = this.get(option.condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
return option;
|
return option;
|
||||||
|
Loading…
Reference in New Issue
Block a user