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();
|
||||
return;
|
||||
}
|
||||
console.error("Unhandled widget action");
|
||||
}
|
||||
|
||||
_getStickerPickerWidget() {
|
||||
|
|
|
@ -36,8 +36,12 @@ function getUserWidgets() {
|
|||
if (!client) {
|
||||
throw new Error('User not logged in');
|
||||
}
|
||||
const userWidgets = client.getAccountData('m.widgets').getContent() || {};
|
||||
return Object.keys(userWidgets).map((key) => userWidgets[key]);
|
||||
const userWidgets = client.getAccountData('m.widgets');
|
||||
let userWidgetContent = {};
|
||||
if (userWidgets && userWidgets.getContent()) {
|
||||
userWidgetContent = userWidgets.getContent();
|
||||
}
|
||||
return Object.keys(userWidgetContent).map((key) => userWidgetContent[key]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue