Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1894 from turt2live/travis/fix-stickerpacks
Browse files Browse the repository at this point in the history
Correctly identify sticker picker widgets
  • Loading branch information
rxl881 authored May 14, 2018
2 parents 7588d43 + 210fcf0 commit 8c3a63a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/**
Expand All @@ -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];
}
});
Expand Down

0 comments on commit 8c3a63a

Please sign in to comment.