mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08: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
@ -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 New Issue
Block a user