.import "../chat/utils.js" as ChatJS
function getLastRoomEventText(roomId) {
var eventsModel = Backend.models.roomEvents.get(roomId)
for (var i = 0; i < eventsModel.count; i++) {
var ev = eventsModel.get(i)
if (ev.type !== "RoomMemberEvent") {
var found = true
break
}
}
if (! found) { return "" }
var name = Backend.getUserDisplayName(ev.dict.sender, false).result()
var undecryptable = ev.type === "OlmEvent" || ev.type === "MegolmEvent"
if (undecryptable || ev.type.startsWith("RoomMessage")) {
var color = ev.dict.sender === roomList.forUserId ?
"darkblue" : "purple"
return "" +
name +
": " +
(undecryptable ?
"Undecryptable" :
ev.dict.body)
} else {
return "" +
name +
" " +
ChatJS.getEventText(ev.type, ev.dict) +
""
}
}