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,
|
version: WIDGET_API_VERSION,
|
||||||
});
|
});
|
||||||
} else if (action === 'sticker_message') {
|
} else if (action === 'sticker_message') {
|
||||||
console.warn('got widget sticker message', widgetId);
|
dis.dispatch({action: 'sticker_message', data: event.data.widgetData, widgetId: event.data.widgetId});
|
||||||
dis.dispatch({action: 'sticker_message', data: event.data.data});
|
|
||||||
} else {
|
} else {
|
||||||
console.warn("Widget postMessage event unhandled");
|
console.warn("Widget postMessage event unhandled");
|
||||||
this.sendError(event, {message: "The postMessage was unhandled"});
|
this.sendError(event, {message: "The postMessage was unhandled"});
|
||||||
|
|
|
@ -350,16 +350,18 @@ export default React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAction(payload) {
|
_onAction(payload) {
|
||||||
switch (payload) {
|
if (payload.widgetId === this.props.id) {
|
||||||
case payload.action === 'sticker_message':
|
switch (payload.action) {
|
||||||
if (this._hasCapability('sticker_message')) {
|
case 'sticker_message':
|
||||||
dis.dispatch({action: 'post_sticker_message', data: payload.data});
|
if (this._hasCapability('sticker_message')) {
|
||||||
} else {
|
dis.dispatch({action: 'post_sticker_message', data: payload.data});
|
||||||
console.warn('Ignoring sticker message. Invalid capability');
|
} else {
|
||||||
}
|
console.warn('Ignoring sticker message. Invalid capability');
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set remote content title on AppTile
|
* Set remote content title on AppTile
|
||||||
|
|
Loading…
Reference in a new issue