You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
fix lint
This commit is contained in:
@@ -110,7 +110,7 @@ RoomState.prototype.getJoinedMemberCount = function() {
|
|||||||
*/
|
*/
|
||||||
RoomState.prototype.setJoinedMemberCount = function(count) {
|
RoomState.prototype.setJoinedMemberCount = function(count) {
|
||||||
this._joinedMemberCount = count;
|
this._joinedMemberCount = count;
|
||||||
}
|
};
|
||||||
/**
|
/**
|
||||||
* Returns the number of invited members in this room
|
* Returns the number of invited members in this room
|
||||||
* @return {integer} The number of members in this room whose membership is 'invite'
|
* @return {integer} The number of members in this room whose membership is 'invite'
|
||||||
@@ -130,7 +130,7 @@ RoomState.prototype.getInvitedMemberCount = function() {
|
|||||||
*/
|
*/
|
||||||
RoomState.prototype.setInvitedMemberCount = function(count) {
|
RoomState.prototype.setInvitedMemberCount = function(count) {
|
||||||
this._invitedMemberCount = count;
|
this._invitedMemberCount = count;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all RoomMembers in this room.
|
* Get all RoomMembers in this room.
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ Room.prototype.setSummary = function(summary) {
|
|||||||
if (heroes) {
|
if (heroes) {
|
||||||
this._summaryHeroes = heroes;
|
this._summaryHeroes = heroes;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to send encrypted messages to devices within this room.
|
* Whether to send encrypted messages to devices within this room.
|
||||||
@@ -1301,11 +1301,15 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) {
|
|||||||
// get members that are NOT ourselves and are actually in the room.
|
// get members that are NOT ourselves and are actually in the room.
|
||||||
let otherMembers = null;
|
let otherMembers = null;
|
||||||
if (room._summaryHeroes) {
|
if (room._summaryHeroes) {
|
||||||
// if we have a summary, the member state events should have been in the room state
|
// if we have a summary, the member state events
|
||||||
otherMembers = room._summaryHeroes.map((userId) => room.currentState.getMember(userId));
|
// should be in the room state
|
||||||
|
otherMembers = room._summaryHeroes.map((userId) => {
|
||||||
|
return room.currentState.getMember(userId);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
otherMembers = room.currentState.getMembers().filter((m) => {
|
otherMembers = room.currentState.getMembers().filter((m) => {
|
||||||
return m.userId !== userId && (m.membership === "invite" || m.membership === "join");
|
return m.userId !== userId &&
|
||||||
|
(m.membership === "invite" || m.membership === "join");
|
||||||
});
|
});
|
||||||
// make sure members have stable order
|
// make sure members have stable order
|
||||||
otherMembers.sort((a, b) => a.userId.localeCompare(b.userId));
|
otherMembers.sort((a, b) => a.userId.localeCompare(b.userId));
|
||||||
@@ -1344,17 +1348,16 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) {
|
|||||||
}
|
}
|
||||||
if(leftMembers.length) {
|
if(leftMembers.length) {
|
||||||
return `Empty room (was ${memberListToRoomName(leftMembers)})`;
|
return `Empty room (was ${memberListToRoomName(leftMembers)})`;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return "Empty room";
|
return "Empty room";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function memberListToRoomName(members, count = members.length) {
|
function memberListToRoomName(members, count = members.length) {
|
||||||
switch (members.length) {
|
switch (members.length) {
|
||||||
case 0: return null;
|
case 0: return null;
|
||||||
case 1: return members[0].name;
|
case 1: return members[0].name;
|
||||||
case 2: return members[0].name + " and " + members[1].name;
|
case 2: return members[0].name + " and " + members[1].name;
|
||||||
default: return members[0].name + " and " + (count - 1) + " others";
|
default: return members[0].name + " and " + (count - 1) + " others";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user