Merge pull request #1894 from turt2live/travis/fix-stickerpacks

Correctly identify sticker picker widgets
This commit is contained in:
Richard Lewis 2018-05-14 17:40:13 +01:00 committed by GitHub
commit 8c3a63a169
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,8 +58,7 @@ function getUserWidgetsArray() {
*/
function getStickerpickerWidgets() {
const widgets = getUserWidgetsArray();
const stickerpickerWidgets = widgets.filter((widget) => widget.type='m.stickerpicker');
return stickerpickerWidgets;
return widgets.filter((widget) => widget.content && widget.content.type === "m.stickerpicker");
}
/**
@ -73,7 +72,7 @@ function removeStickerpickerWidgets() {
}
const userWidgets = client.getAccountData('m.widgets').getContent() || {};
Object.entries(userWidgets).forEach(([key, widget]) => {
if (widget.type === 'm.stickerpicker') {
if (widget.content && widget.content.type === 'm.stickerpicker') {
delete userWidgets[key];
}
});