Correctly handle sticker message events.

This commit is contained in:
Richard Lewis 2018-01-04 18:58:55 +00:00
parent da199da798
commit d20aebfbd7
2 changed files with 13 additions and 12 deletions

View file

@ -325,8 +325,7 @@ export default class WidgetMessaging extends MatrixPostMessageApi {
version: WIDGET_API_VERSION,
});
} else if (action === 'sticker_message') {
console.warn('got widget sticker message', widgetId);
dis.dispatch({action: 'sticker_message', data: event.data.data});
dis.dispatch({action: 'sticker_message', data: event.data.widgetData, widgetId: event.data.widgetId});
} else {
console.warn("Widget postMessage event unhandled");
this.sendError(event, {message: "The postMessage was unhandled"});

View file

@ -350,8 +350,9 @@ export default React.createClass({
},
_onAction(payload) {
switch (payload) {
case payload.action === 'sticker_message':
if (payload.widgetId === this.props.id) {
switch (payload.action) {
case 'sticker_message':
if (this._hasCapability('sticker_message')) {
dis.dispatch({action: 'post_sticker_message', data: payload.data});
} else {
@ -359,6 +360,7 @@ export default React.createClass({
}
break;
}
}
},
/**