Page MenuHomePhorge

matrix-helpers.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

matrix-helpers.js

function roomAvatarPlaceholderName(room)
{
return room.name || room.heroNames[0] || room.roomId;
}
function roomNameOrHeroes(room, l10n)
{
if (room.name) {
return l10n.get(
'room-list-view-room-item-title-name',
{
name: room.name,
}
);
} else if (room.heroNames.length) {
return l10n.get(
'room-list-view-room-item-title-heroes',
{
hero: room.heroNames[0],
secondHero: room.heroNames[1],
otherNum: room.heroNames.length - 1,
}
);
} else {
return l10n.get(
'room-list-view-room-item-title-id',
{
roomId: room.roomId,
}
);
}
}
function userNameWithId(user, l10n)
{
if (user.name) {
return l10n.get('user-name-with-id', { name: user.name, userId: user.userId });
} else {
return user.userId;
}
}
/**
* Check whether the event is read by a user.
*
* @param event The event to check.
* @param userId The id of the user to check.
* @return Whether @c event is read by the user whose id is @c userId.
*/
function isEventReadBy(event, userId)
{
const readers = event.readers();
for (let i = 0; i < readers.count; ++i) {
const reader = readers.at(i);
if (reader.userId === userId) {
return true;
}
}
return false;
}

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 2, 4:22 AM (15 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
478215
Default Alt Text
matrix-helpers.js (1 KB)

Event Timeline