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 #3336 from matrix-org/travis/fix-removing-widgets
Browse files Browse the repository at this point in the history
No-op removals of widgets that don't exist
  • Loading branch information
turt2live authored Aug 22, 2019
2 parents 088568e + 19b7d18 commit e9b44c9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/WidgetUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ export default class WidgetUtils {
if (!client) {
throw new Error('User not logged in');
}
const userWidgets = client.getAccountData('m.widgets').getContent() || {};
const widgets = client.getAccountData('m.widgets');
if (!widgets) return;
const userWidgets = widgets.getContent() || {};
Object.entries(userWidgets).forEach(([key, widget]) => {
if (widget.content && widget.content.type === "m.integration_manager") {
delete userWidgets[key];
Expand Down Expand Up @@ -382,7 +384,9 @@ export default class WidgetUtils {
if (!client) {
throw new Error('User not logged in');
}
const userWidgets = client.getAccountData('m.widgets').getContent() || {};
const widgets = client.getAccountData('m.widgets');
if (!widgets) return;
const userWidgets = widgets.getContent() || {};
Object.entries(userWidgets).forEach(([key, widget]) => {
if (widget.content && widget.content.type === 'm.stickerpicker') {
delete userWidgets[key];
Expand Down

0 comments on commit e9b44c9

Please sign in to comment.