You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-19 05:22:13 +03:00
Set page title from widget data, if available.
This commit is contained in:
@@ -79,7 +79,7 @@ export default React.createClass({
|
||||
hasPermissionToLoad: hasPermissionToLoad === 'true' || newProps.userId === newProps.creatorUserId,
|
||||
error: null,
|
||||
deleting: false,
|
||||
widgetPageTitle: null,
|
||||
widgetPageTitle: newProps.widgetPageTitle,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -197,7 +197,10 @@ export default React.createClass({
|
||||
initialising: false,
|
||||
});
|
||||
|
||||
this._updateWidgetTitle(params.url);
|
||||
// Fetch page title from remote content if not already set
|
||||
if (!this.state.widgetPageTitle) {
|
||||
this._fetchWidgetTitle(params.url);
|
||||
}
|
||||
}, (err) => {
|
||||
console.error("Failed to get scalar_token", err);
|
||||
this.setState({
|
||||
@@ -303,7 +306,7 @@ export default React.createClass({
|
||||
* Set remote content title on AppTile
|
||||
* @param {string} url Url to check for title
|
||||
*/
|
||||
_updateWidgetTitle(url) {
|
||||
_fetchWidgetTitle(url) {
|
||||
this._scalarClient.getScalarPageTitle(url).then((widgetPageTitle) => {
|
||||
if (widgetPageTitle) {
|
||||
this.setState({widgetPageTitle: widgetPageTitle});
|
||||
|
||||
@@ -224,6 +224,7 @@ module.exports = React.createClass({
|
||||
userId={this.props.userId}
|
||||
show={this.props.showApps}
|
||||
creatorUserId={app.creatorUserId}
|
||||
widgetPageTitle={(app.data && app.data.widgetPageTitle) ? app.data.widgetPageTitle : ''}
|
||||
/>);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user