Compare commits

...

2 Commits

Author SHA1 Message Date
RiotRobot d428e7119a v40.1.0 2026-01-27 12:39:19 +00:00
ElementRobot 5532066178 Recalculate room name on loading members (#5158) (#5164)
Co-authored-by: David Baker <dbkr@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2026-01-27 12:33:09 +00:00
4 changed files with 46 additions and 6 deletions
+21
View File
@@ -1,3 +1,24 @@
Changes in [40.1.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v40.1.0) (2026-01-27)
==================================================================================================
## 🦖 Deprecations
* Deprecate unused `EventShieldReason` reason codes ([#5127](https://github.com/matrix-org/matrix-js-sdk/pull/5127)). Contributed by @richvdh.
## ✨ Features
* Add stable m.oauth UIA stage enum ([#5138](https://github.com/matrix-org/matrix-js-sdk/pull/5138)). Contributed by @hughns.
* Add `MatrixEvent.getKeyForwardingUser` ([#5128](https://github.com/matrix-org/matrix-js-sdk/pull/5128)). Contributed by @richvdh.
* Add types for (unstable) policy servers ([#5116](https://github.com/matrix-org/matrix-js-sdk/pull/5116)). Contributed by @turt2live.
## 🐛 Bug Fixes
* [Backport staging] Recalculate room name on loading members ([#5164](https://github.com/matrix-org/matrix-js-sdk/pull/5164)). Contributed by @RiotRobot.
* Avoid rapidly retrying failed requests ([#5146](https://github.com/matrix-org/matrix-js-sdk/pull/5146)). Contributed by @andybalaam.
* [matrixRTC] MatrixRTCSessions, add missing event reemission. ([#5144](https://github.com/matrix-org/matrix-js-sdk/pull/5144)). Contributed by @toger5.
* Use normal base64 encoding for RTC backend identities ([#5129](https://github.com/matrix-org/matrix-js-sdk/pull/5129)). Contributed by @robintown.
* export parseCallNotificationContent and isMyMembership from RTC types ([#5132](https://github.com/matrix-org/matrix-js-sdk/pull/5132)). Contributed by @Half-Shot.
Changes in [40.0.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v40.0.0) (2026-01-13)
==================================================================================================
## 🚨 BREAKING CHANGES
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "matrix-js-sdk",
"version": "40.1.0-rc.0",
"version": "40.1.0",
"description": "Matrix Client-Server SDK for Javascript",
"engines": {
"node": ">=22.0.0"
+22 -5
View File
@@ -2103,7 +2103,7 @@ describe("Room", function () {
}
const memberEvent = utils.mkMembership({
user: "@user_a:bar",
user: userA,
mship: KnownMembership.Join,
room: roomId,
event: true,
@@ -2114,7 +2114,7 @@ describe("Room", function () {
const client = createClientMock([memberEvent]);
const room = new Room(roomId, client as any, null!, { lazyLoadMembers: true });
await room.loadMembersIfNeeded();
const memberA = room.getMember("@user_a:bar")!;
const memberA = room.getMember(userA)!;
expect(memberA.name).toEqual("User A");
const storedMembers = client.store.storedMembers!;
expect(storedMembers.length).toEqual(1);
@@ -2123,7 +2123,7 @@ describe("Room", function () {
it("should take members from storage if available", async function () {
const memberEvent2 = utils.mkMembership({
user: "@user_a:bar",
user: userA,
mship: KnownMembership.Join,
room: roomId,
event: true,
@@ -2134,7 +2134,7 @@ describe("Room", function () {
await room.loadMembersIfNeeded();
const memberA = room.getMember("@user_a:bar")!;
const memberA = room.getMember(userA)!;
expect(memberA.name).toEqual("User A");
});
@@ -2145,9 +2145,26 @@ describe("Room", function () {
client.members.mockReturnValue({ chunk: [memberEvent] });
await room.loadMembersIfNeeded();
const memberA = room.getMember("@user_a:bar")!;
const memberA = room.getMember(userA)!;
expect(memberA.name).toEqual("User A");
});
it("should emit room name change event if loading members causes the room name to change", async function () {
const otherMemberEvent = utils.mkMembership({
user: userB,
mship: KnownMembership.Join,
room: roomId,
event: true,
name: "User B",
});
const client = createClientMock([memberEvent, otherMemberEvent]);
const room = new Room(roomId, client as any, userA, { lazyLoadMembers: true });
expect(room.name).toEqual("!foo:bar");
await room.loadMembersIfNeeded();
expect(room.name).toEqual("User B");
});
});
describe("getMyMembership", function () {
+2
View File
@@ -1103,6 +1103,8 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
const inMemoryUpdate = this.loadMembers()
.then((result) => {
this.currentState.setOutOfBandMembers(result.memberEvents);
// recalculate the room name: it may have been based on members, so may have changed
this.recalculate();
return result.fromServer;
})
.catch((err) => {