mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 11:47:23 +03:00
Oops, actually get account data event.
Also ignore any account data events that aren;t widgets.
This commit is contained in:
parent
f4d69e26e9
commit
d0ec467c34
1 changed files with 8 additions and 1 deletions
|
@ -293,13 +293,20 @@ function inviteUser(event, roomId, userId) {
|
|||
*/
|
||||
function waitForUserWidget(widgetId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (ev.getContent() && ev.getContent()[widgetId] !== undefined) {
|
||||
const currentAccountDataEvent = MatrixClientPeg.get().getAccountData('m.widgets');
|
||||
if (
|
||||
currentAccountDataEvent &&
|
||||
currentAccountDataEvent.getContent() &&
|
||||
currentAccountDataEvent.getContent()[widgetId] !== undefined
|
||||
) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
let timerId;
|
||||
function onAccountData(ev) {
|
||||
if (ev.getType() != 'm.widgets') return;
|
||||
|
||||
if (ev.getContent() && ev.getContent()[widgetId] !== undefined) {
|
||||
MatrixClientPeg.get().removeListener('accountData', onAccountData);
|
||||
clearTimeout(timerId);
|
||||
|
|
Loading…
Reference in a new issue