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:
Joffrey JAFFEUX 2019-04-01 16:08:14 +02:00 committed by GitHub
parent a6596662dc
commit 4b1b135ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -255,10 +255,12 @@ export default Ember.Controller.extend({
_setupPopupMenuOption(callback) {
let option = callback();
if (option.condition) {
option.condition = this.get(option.condition);
} else {
if (typeof option.condition === "undefined") {
option.condition = true;
} else if (typeof option.condition === "boolean") {
// uses existing value
} else {
option.condition = this.get(option.condition);
}
return option;