Create name/title Widget utils
This commit is contained in:
parent
11e349d6c8
commit
2527344294
4 changed files with 14 additions and 2 deletions
|
@ -32,6 +32,7 @@ import {Capability} from "../widgets/WidgetApi";
|
|||
import {Room} from "matrix-js-sdk/src/models/room";
|
||||
import {WidgetType} from "../widgets/WidgetType";
|
||||
import {objectClone} from "./objects";
|
||||
import {_t} from "../languageHandler";
|
||||
|
||||
export default class WidgetUtils {
|
||||
/* Returns true if user is able to send state events to modify widgets in this room
|
||||
|
@ -486,4 +487,14 @@ export default class WidgetUtils {
|
|||
IntegrationManagers.sharedInstance().getPrimaryManager().open(room, 'type_' + app.type, app.id);
|
||||
}
|
||||
}
|
||||
|
||||
static getWidgetName(app) {
|
||||
if (!app || !app.name) return "";
|
||||
return app.name.trim() || _t("Unknown App");
|
||||
}
|
||||
|
||||
static getWidgetDataTitle(app) {
|
||||
if (!app || !app.data || !app.data.title) return "";
|
||||
return app.data.title.trim();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue