Skip to content

Commit

Permalink
Merge pull request #4418 from yakyouk/f/dialog-token-update
Browse files Browse the repository at this point in the history
fix permission token update, use dialog adapter token for kick
  • Loading branch information
netpro2k authored Sep 28, 2021
2 parents bd61583 + db11e3a commit 2077c3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/naf-dialog-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -944,12 +944,12 @@ export class DialogAdapter extends EventEmitter {
}
}

kick(clientId, permsToken) {
kick(clientId) {
return this._protoo
.request("kick", {
room_id: this.room,
user_id: clientId,
token: permsToken
token: this._joinToken
})
.then(() => {
document.body.dispatchEvent(new CustomEvent("kicked", { detail: { clientId: clientId } }));
Expand Down
8 changes: 2 additions & 6 deletions src/utils/hub-channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ export default class HubChannel extends EventTarget {
if (this.fetchPermissionsTimeout) {
clearTimeout(this.fetchPermissionsTimeout);
}
this.fetchPermissionsTimeout = setTimeout(async () => {
const result = await this.fetchPermissions();
this.dispatchEvent(new CustomEvent("permissions-refreshed", { detail: result }));
}, nextRefresh);
this.fetchPermissionsTimeout = setTimeout(this.fetchPermissions, nextRefresh);
};

sendEnteringEvent = async () => {
Expand Down Expand Up @@ -430,8 +427,7 @@ export default class HubChannel extends EventTarget {
isHidden = sessionId => this._blockedSessionIds.has(sessionId);

kick = async sessionId => {
const permsToken = await this.fetchPermissions();
APP.dialog.kick(sessionId, permsToken);
APP.dialog.kick(sessionId);
this.channel.push("kick", { session_id: sessionId });
};

Expand Down

0 comments on commit 2077c3f

Please sign in to comment.