Better name for the newestMessage of a chat
This commit is contained in:
@@ -38,7 +38,7 @@ class Chatroom : NotesGatherer {
|
||||
var subject = MutableStateFlow<String?>(null)
|
||||
var subjectCreatedAt: Long? = null
|
||||
var ownerSentMessage: Boolean = false
|
||||
var lastMessage: Note? = null
|
||||
var newestMessage: Note? = null
|
||||
|
||||
override fun removeNote(note: Note) {
|
||||
removeMessageSync(note)
|
||||
@@ -57,8 +57,8 @@ class Chatroom : NotesGatherer {
|
||||
}
|
||||
|
||||
val createdAt = msg.createdAt() ?: 0
|
||||
if (createdAt > (lastMessage?.createdAt() ?: 0)) {
|
||||
lastMessage = msg
|
||||
if (createdAt > (newestMessage?.createdAt() ?: 0)) {
|
||||
newestMessage = msg
|
||||
}
|
||||
|
||||
val newSubject = msg.event?.subject()
|
||||
@@ -78,8 +78,8 @@ class Chatroom : NotesGatherer {
|
||||
messages = messages - msg
|
||||
msg.removeGatherer(this)
|
||||
|
||||
if (msg == lastMessage) {
|
||||
lastMessage = messages.maxByOrNull { it.createdAt() ?: 0 }
|
||||
if (msg == newestMessage) {
|
||||
newestMessage = messages.maxByOrNull { it.createdAt() ?: 0 }
|
||||
}
|
||||
|
||||
if (msg.event?.subject() == subject.value) {
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ class ChatroomListKnownFeedFilter(
|
||||
if ((chatroom.senderIntersects(followingKeySet) || chatList.hasSentMessagesTo(key)) &&
|
||||
!account.isAllHidden(key.users)
|
||||
) {
|
||||
chatroom.lastMessage
|
||||
chatroom.newestMessage
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class ChatroomListNewFeedFilter(
|
||||
val privateMessages =
|
||||
chatList.rooms.mapNotNull { key, chatroom ->
|
||||
if (!chatroom.senderIntersects(followingKeySet) && !chatList.hasSentMessagesTo(key) && !account.isAllHidden(key.users)) {
|
||||
chatroom.lastMessage
|
||||
chatroom.newestMessage
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user