Don't show 'unpin' for persistent widgets
This will mostly fix https://github.com/vector-im/element-web/issues/15139 although it could still break in a race condition.
This commit is contained in:
parent
017765df24
commit
eeb4c5696f
2 changed files with 10 additions and 8 deletions
|
@ -26,8 +26,8 @@ export default class WidgetContextMenu extends React.Component {
|
||||||
// Callback for when the revoke button is clicked. Required.
|
// Callback for when the revoke button is clicked. Required.
|
||||||
onRevokeClicked: PropTypes.func.isRequired,
|
onRevokeClicked: PropTypes.func.isRequired,
|
||||||
|
|
||||||
// Callback for when the unpin button is clicked. Required.
|
// Callback for when the unpin button is clicked. If absent, unpin will be hidden.
|
||||||
onUnpinClicked: PropTypes.func.isRequired,
|
onUnpinClicked: PropTypes.func,
|
||||||
|
|
||||||
// Callback for when the snapshot button is clicked. Button not shown
|
// Callback for when the snapshot button is clicked. Button not shown
|
||||||
// without a callback.
|
// without a callback.
|
||||||
|
@ -86,11 +86,13 @@ export default class WidgetContextMenu extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.props.onUnpinClicked) {
|
||||||
options.push(
|
options.push(
|
||||||
<MenuItem className="mx_WidgetContextMenu_option" onClick={this.onUnpinClicked} key="unpin">
|
<MenuItem className="mx_WidgetContextMenu_option" onClick={this.onUnpinClicked} key="unpin">
|
||||||
{_t("Unpin")}
|
{_t("Unpin")}
|
||||||
</MenuItem>,
|
</MenuItem>,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.props.onReloadClicked) {
|
if (this.props.onReloadClicked) {
|
||||||
options.push(
|
options.push(
|
||||||
|
|
|
@ -841,7 +841,7 @@ export default class AppTile extends React.Component {
|
||||||
contextMenu = (
|
contextMenu = (
|
||||||
<ContextMenu {...aboveLeftOf(elementRect, null)} onFinished={this._closeContextMenu}>
|
<ContextMenu {...aboveLeftOf(elementRect, null)} onFinished={this._closeContextMenu}>
|
||||||
<WidgetContextMenu
|
<WidgetContextMenu
|
||||||
onUnpinClicked={this._onUnpinClicked}
|
onUnpinClicked={ActiveWidgetStore.getWidgetPersistence(this.props.app.id) ? null : this._onUnpinClicked}
|
||||||
onRevokeClicked={this._onRevokeClicked}
|
onRevokeClicked={this._onRevokeClicked}
|
||||||
onEditClicked={showEditButton ? this._onEditClick : undefined}
|
onEditClicked={showEditButton ? this._onEditClick : undefined}
|
||||||
onDeleteClicked={showDeleteButton ? this._onDeleteClick : undefined}
|
onDeleteClicked={showDeleteButton ? this._onDeleteClick : undefined}
|
||||||
|
|
Loading…
Reference in a new issue