Skip to content

Commit cdc89c0

Browse files
committed
add the concept of eventTileOps for managing widget visibility based on vdh's PR feedback
1 parent d107151 commit cdc89c0

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎src/components/views/rooms/MessageContextMenu.js‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ var Resend = require("matrix-react-sdk/lib/Resend");
2727
module.exports = React.createClass({
2828
displayName: 'MessageContextMenu',
2929

30+
propTypes: {
31+
/* the MatrixEvent associated with the context menu */
32+
mxEvent: React.PropTypes.object.isRequired,
33+
34+
/* an optional EventTileOps implementation that can be used to unhide preview widgets */
35+
eventTileOps: React.PropTypes.object,
36+
37+
/* callback called when the menu is dismissed */
38+
onFinished: React.PropTypes.func,
39+
},
40+
3041
onResendClick: function() {
3142
Resend.resend(this.props.mxEvent);
3243
if (this.props.onFinished) this.props.onFinished();
@@ -69,10 +80,11 @@ module.exports = React.createClass({
6980
onUnhidePreviewClick: function() {
7081
if (global.localStorage) {
7182
// FIXME: factor this out with LinkPreviewWidget
72-
// FIXME: somehow propagate this to the EventTile such that it updates itself and realises the link has rematerialised
7383
global.localStorage.removeItem("hide_preview_" + this.props.mxEvent.getId());
7484
}
75-
this.props.mxEvent.widgetHidden = false;
85+
if (this.props.eventTileOps) {
86+
this.props.eventTileOps.unhideWidget();
87+
}
7688
if (this.props.onFinished) this.props.onFinished();
7789
},
7890

0 commit comments

Comments
 (0)