mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Create name/title Widget utils
This commit is contained in:
parent
11e349d6c8
commit
2527344294
@ -76,7 +76,7 @@ export default class PersistentApp extends React.Component {
|
||||
userId={MatrixClientPeg.get().credentials.userId}
|
||||
show={true}
|
||||
creatorUserId={app.creatorUserId}
|
||||
widgetPageTitle={(app.data && app.data.title) ? app.data.title : ''}
|
||||
widgetPageTitle={WidgetUtils.getWidgetDataTitle(app)}
|
||||
waitForIframeLoad={app.waitForIframeLoad}
|
||||
whitelistCapabilities={capWhitelist}
|
||||
showDelete={false}
|
||||
|
@ -171,7 +171,7 @@ export default class AppsDrawer extends React.Component {
|
||||
userId={this.props.userId}
|
||||
show={this.props.showApps}
|
||||
creatorUserId={app.creatorUserId}
|
||||
widgetPageTitle={(app.data && app.data.title) ? app.data.title : ''}
|
||||
widgetPageTitle={WidgetUtils.getWidgetDataTitle(app)}
|
||||
waitForIframeLoad={app.waitForIframeLoad}
|
||||
whitelistCapabilities={capWhitelist}
|
||||
/>);
|
||||
|
@ -387,6 +387,7 @@
|
||||
"Common names and surnames are easy to guess": "Common names and surnames are easy to guess",
|
||||
"Straight rows of keys are easy to guess": "Straight rows of keys are easy to guess",
|
||||
"Short keyboard patterns are easy to guess": "Short keyboard patterns are easy to guess",
|
||||
"Unknown App": "Unknown App",
|
||||
"Help us improve %(brand)s": "Help us improve %(brand)s",
|
||||
"Send <UsageDataLink>anonymous usage data</UsageDataLink> which helps us improve %(brand)s. This will use a <PolicyLink>cookie</PolicyLink>.": "Send <UsageDataLink>anonymous usage data</UsageDataLink> which helps us improve %(brand)s. This will use a <PolicyLink>cookie</PolicyLink>.",
|
||||
"I want to help": "I want to help",
|
||||
|
@ -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…
Reference in New Issue
Block a user