Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Only return the approved widget capabilities instead of accepting all…
Browse files Browse the repository at this point in the history
… requested capabilities (#7454)

* Only return the approved widget capabilities instead of accepting all requested capabilities

* Restore the original logic that only keeps accepted permissions if they were requested

Signed-off-by: Dominik Henneke <dominik.henneke@nordeck.net>
  • Loading branch information
dhenneke authored Jan 6, 2022
1 parent dc2d52c commit b3202de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/stores/widgets/StopGapWidgetDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { IContent, IEvent, MatrixEvent } from "matrix-js-sdk/src/models/event";
import { Room } from "matrix-js-sdk/src/models/room";
import { logger } from "matrix-js-sdk/src/logger";

import { iterableDiff, iterableUnion } from "../../utils/iterables";
import { iterableDiff, iterableIntersection } from "../../utils/iterables";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import ActiveRoomObserver from "../../ActiveRoomObserver";
import Modal from "../../Modal";
Expand Down Expand Up @@ -131,7 +131,9 @@ export class StopGapWidgetDriver extends WidgetDriver {
}
}

const allAllowed = new Set(iterableUnion(allowedSoFar, requested));
// discard all previously allowed capabilities if they are not requested
// TODO: this results in an unexpected behavior when this function is called during the capabilities renegotiation of MSC2974 that will be resolved later.
const allAllowed = new Set(iterableIntersection(allowedSoFar, requested));

if (rememberApproved) {
setRememberedCapabilitiesForWidget(this.forWidget, Array.from(allAllowed));
Expand Down

0 comments on commit b3202de

Please sign in to comment.