Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix permission token update, use dialog adapter token for kick #4418

Merged
merged 1 commit into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetchPermissions calls setPermissionsFromToken which dispatches permissions_updated so we don't need to dispatch here.

}, 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