Skip to content

Commit 54661cc

Browse files
Change _unstable_getSharedRooms to _unstable_getMutualRooms (#2271)
* change shared to mutual * revert name change * use new unstable feature flag * support both unstable endpoints
1 parent b58d09a commit 54661cc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/client.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -6410,12 +6410,18 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
64106410
* @return {module:http-api.MatrixError} Rejects: with an error response.
64116411
*/
64126412
public async _unstable_getSharedRooms(userId: string): Promise<string[]> { // eslint-disable-line
6413-
if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) {
6414-
throw Error('Server does not support shared_rooms API');
6413+
const sharedRoomsSupport = await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666");
6414+
const mutualRoomsSupport = await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666.mutual_rooms");
6415+
6416+
if (!sharedRoomsSupport && !mutualRoomsSupport) {
6417+
throw Error('Server does not support mutual_rooms API');
64156418
}
6416-
const path = utils.encodeUri("/uk.half-shot.msc2666/user/shared_rooms/$userId", {
6417-
$userId: userId,
6418-
});
6419+
6420+
const path = utils.encodeUri(
6421+
`/uk.half-shot.msc2666/user/${mutualRoomsSupport ? 'mutual_rooms' : 'shared_rooms'}/$userId`,
6422+
{ $userId: userId },
6423+
);
6424+
64196425
const res = await this.http.authedRequest<{ joined: string[] }>(
64206426
undefined, Method.Get, path, undefined, undefined,
64216427
{ prefix: PREFIX_UNSTABLE },

0 commit comments

Comments
 (0)