mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-05 05:38:41 +03:00
Check for empty user widgets.
This commit is contained in:
parent
393236ba34
commit
f3943bef51
2 changed files with 6 additions and 3 deletions
|
@ -87,7 +87,6 @@ export default class Stickerpack extends React.Component {
|
||||||
this._getStickerPickerWidget();
|
this._getStickerPickerWidget();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.error("Unhandled widget action");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_getStickerPickerWidget() {
|
_getStickerPickerWidget() {
|
||||||
|
|
|
@ -36,8 +36,12 @@ function getUserWidgets() {
|
||||||
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 userWidgets = client.getAccountData('m.widgets');
|
||||||
return Object.keys(userWidgets).map((key) => userWidgets[key]);
|
let userWidgetContent = {};
|
||||||
|
if (userWidgets && userWidgets.getContent()) {
|
||||||
|
userWidgetContent = userWidgets.getContent();
|
||||||
|
}
|
||||||
|
return Object.keys(userWidgetContent).map((key) => userWidgetContent[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue