You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Merge branch 'develop' into dbkr/new_unread_count_format
This commit is contained in:
@@ -743,12 +743,12 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
return userId; // XXX: why userId and not displayname or something?
|
||||
return memberList[0].name;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// there really isn't anyone in this room...
|
||||
return "?";
|
||||
return "Empty room";
|
||||
}
|
||||
}
|
||||
else if (members.length === 1) {
|
||||
|
||||
@@ -328,50 +328,40 @@ describe("Room", function() {
|
||||
|
||||
it("should return true for a matching userId and membership",
|
||||
function() {
|
||||
room.currentState.getMembers.andCallFake(function() {
|
||||
return [
|
||||
{ userId: "@alice:bar", membership: "join" },
|
||||
{ userId: "@bob:bar", membership: "invite" }
|
||||
];
|
||||
});
|
||||
room.currentState.members = {
|
||||
"@alice:bar": { userId: "@alice:bar", membership: "join" },
|
||||
"@bob:bar": { userId: "@bob:bar", membership: "invite" }
|
||||
};
|
||||
expect(room.hasMembershipState("@bob:bar", "invite")).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false if match membership but no match userId",
|
||||
function() {
|
||||
room.currentState.getMembers.andCallFake(function() {
|
||||
return [
|
||||
{ userId: "@alice:bar", membership: "join" }
|
||||
];
|
||||
});
|
||||
room.currentState.members = {
|
||||
"@alice:bar": { userId: "@alice:bar", membership: "join" }
|
||||
};
|
||||
expect(room.hasMembershipState("@bob:bar", "join")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false if match userId but no match membership",
|
||||
function() {
|
||||
room.currentState.getMembers.andCallFake(function() {
|
||||
return [
|
||||
{ userId: "@alice:bar", membership: "join" }
|
||||
];
|
||||
});
|
||||
room.currentState.members = {
|
||||
"@alice:bar": { userId: "@alice:bar", membership: "join" }
|
||||
};
|
||||
expect(room.hasMembershipState("@alice:bar", "ban")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false if no match membership or userId",
|
||||
function() {
|
||||
room.currentState.getMembers.andCallFake(function() {
|
||||
return [
|
||||
{ userId: "@alice:bar", membership: "join" }
|
||||
];
|
||||
});
|
||||
room.currentState.members = {
|
||||
"@alice:bar": { userId: "@alice:bar", membership: "join" }
|
||||
};
|
||||
expect(room.hasMembershipState("@bob:bar", "invite")).toBe(false);
|
||||
});
|
||||
|
||||
it("should return false if no members exist",
|
||||
function() {
|
||||
room.currentState.getMembers.andCallFake(function() {
|
||||
return [];
|
||||
});
|
||||
room.currentState.members = {};
|
||||
expect(room.hasMembershipState("@foo:bar", "join")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user