Merge branch 'develop' into rob/apps-not-e2ee

This commit is contained in:
Robert Swain 2017-08-21 10:30:38 +02:00
commit 2eac869e27
4 changed files with 46 additions and 41 deletions

View file

@ -252,18 +252,21 @@ function textForWidgetEvent(event) {
const senderName = event.sender ? event.sender.name : event.getSender(); const senderName = event.sender ? event.sender.name : event.getSender();
const previousContent = event.getPrevContent() || {}; const previousContent = event.getPrevContent() || {};
const {name, type, url} = event.getContent() || {}; const {name, type, url} = event.getContent() || {};
let widgetName = widgetName || name || type || previousContent.type; let widgetName = name || previousContent.name || type || previousContent.type || '';
widgetName = widgetName ? widgetName + ' ' : ''; // Apply sentence case to widget name
if (widgetName && widgetName.length > 0) {
widgetName = widgetName[0].toUpperCase() + widgetName.slice(1) + ' ';
}
// If the widget was removed, its content should be {}, but this is sufficiently // If the widget was removed, its content should be {}, but this is sufficiently
// equivalent to that condition. // equivalent to that condition.
if (url) { if (url) {
return _t('%(senderName)s added a %(widgetName)swidget', { return _t('%(widgetName)s widget added by %(senderName)s', {
senderName, widgetName, widgetName, senderName,
}); });
} else { } else {
return _t('%(senderName)s removed a %(widgetName)swidget', { return _t('%(widgetName)s widget removed by %(senderName)s', {
senderName, widgetName, widgetName, senderName,
}); });
} }
} }

View file

@ -223,44 +223,46 @@ export default React.createClass({
safeWidgetUrl = url.format(parsedWidgetUrl); safeWidgetUrl = url.format(parsedWidgetUrl);
} }
if (this.state.loading) { if (this.props.show) {
appTileBody = ( if (this.state.loading) {
<div className='mx_AppTileBody mx_AppLoading'> appTileBody = (
<MessageSpinner msg='Loading...'/> <div className='mx_AppTileBody mx_AppLoading'>
</div> <MessageSpinner msg='Loading...'/>
); </div>
} else if (this.state.hasPermissionToLoad == true) { );
if (this.isMixedContent()) { } else if (this.state.hasPermissionToLoad == true) {
if (this.isMixedContent()) {
appTileBody = (
<div className="mx_AppTileBody">
<AppWarning
errorMsg="Error - Mixed content"
/>
</div>
);
} else {
appTileBody = (
<div className="mx_AppTileBody">
<iframe
ref="appFrame"
src={safeWidgetUrl}
allowFullScreen="true"
sandbox={sandboxFlags}
></iframe>
</div>
);
}
} else {
const isRoomEncrypted = MatrixClientPeg.get().isRoomEncrypted(this.props.room.roomId);
appTileBody = ( appTileBody = (
<div className="mx_AppTileBody"> <div className="mx_AppTileBody">
<AppWarning <AppPermission
errorMsg="Error - Mixed content" isRoomEncrypted={isRoomEncrypted}
url={this.state.widgetUrl}
onPermissionGranted={this._grantWidgetPermission}
/> />
</div> </div>
); );
} else if (this.props.show) {
appTileBody = (
<div className="mx_AppTileBody">
<iframe
ref="appFrame"
src={safeWidgetUrl}
allowFullScreen="true"
sandbox={sandboxFlags}
></iframe>
</div>
);
} }
} else {
const isRoomEncrypted = MatrixClientPeg.get().isRoomEncrypted(this.props.room.roomId);
appTileBody = (
<div className="mx_AppTileBody">
<AppPermission
isRoomEncrypted={isRoomEncrypted}
url={this.state.widgetUrl}
onPermissionGranted={this._grantWidgetPermission}
/>
</div>
);
} }
// editing is done in scalar // editing is done in scalar

View file

@ -171,7 +171,7 @@ const Pill = React.createClass({
} }
pillClass = 'mx_UserPill'; pillClass = 'mx_UserPill';
href = null; href = null;
onClick = this.onUserPillClicked.bind(this); onClick = this.onUserPillClicked;
} }
} }
break; break;

View file

@ -972,7 +972,7 @@
"Failed to upload image": "Failed to upload image", "Failed to upload image": "Failed to upload image",
"Failed to update group": "Failed to update group", "Failed to update group": "Failed to update group",
"Hide avatars in user and room mentions": "Hide avatars in user and room mentions", "Hide avatars in user and room mentions": "Hide avatars in user and room mentions",
"%(senderName)s added a %(widgetName)swidget": "%(senderName)s added a %(widgetName)swidget", "%(widgetName)s widget added by %(senderName)s": "%(widgetName)s widget added by %(senderName)s",
"%(senderName)s removed a %(widgetName)swidget": "%(senderName)s removed a %(widgetName)swidget", "%(widgetName)s widget removed by %(senderName)s": "%(widgetName)s widget removed by %(senderName)s",
"Robot check is currently unavailable on desktop - please use a <a>web browser</a>": "Robot check is currently unavailable on desktop - please use a <a>web browser</a>" "Robot check is currently unavailable on desktop - please use a <a>web browser</a>": "Robot check is currently unavailable on desktop - please use a <a>web browser</a>"
} }