Merge pull request #3336 from matrix-org/travis/fix-removing-widgets
No-op removals of widgets that don't exist
This commit is contained in:
commit
e9b44c9802
1 changed files with 6 additions and 2 deletions
|
@ -354,7 +354,9 @@ export default class WidgetUtils {
|
||||||
if (!client) {
|
if (!client) {
|
||||||
throw new Error('User not logged in');
|
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]) => {
|
Object.entries(userWidgets).forEach(([key, widget]) => {
|
||||||
if (widget.content && widget.content.type === "m.integration_manager") {
|
if (widget.content && widget.content.type === "m.integration_manager") {
|
||||||
delete userWidgets[key];
|
delete userWidgets[key];
|
||||||
|
@ -382,7 +384,9 @@ export default class WidgetUtils {
|
||||||
if (!client) {
|
if (!client) {
|
||||||
throw new Error('User not logged in');
|
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]) => {
|
Object.entries(userWidgets).forEach(([key, widget]) => {
|
||||||
if (widget.content && widget.content.type === 'm.stickerpicker') {
|
if (widget.content && widget.content.type === 'm.stickerpicker') {
|
||||||
delete userWidgets[key];
|
delete userWidgets[key];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue