Correctly handle sticker message events.
This commit is contained in:
parent
da199da798
commit
d20aebfbd7
2 changed files with 13 additions and 12 deletions
|
@ -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"});
|
||||
|
|
|
@ -350,16 +350,18 @@ export default React.createClass({
|
|||
},
|
||||
|
||||
_onAction(payload) {
|
||||
switch (payload) {
|
||||
case payload.action === 'sticker_message':
|
||||
if (this._hasCapability('sticker_message')) {
|
||||
dis.dispatch({action: 'post_sticker_message', data: payload.data});
|
||||
} else {
|
||||
console.warn('Ignoring sticker message. Invalid capability');
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
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 {
|
||||
console.warn('Ignoring sticker message. Invalid capability');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set remote content title on AppTile
|
||||
|
|
Loading…
Reference in a new issue