mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 03:47:43 +00:00
fix: emoji author parsing and adding message senders to storage (#957)
This commit is contained in:
@@ -2,6 +2,7 @@ package org.session.libsession.database
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import org.session.libsession.messaging.BlindedIdMapping
|
||||
import org.session.libsession.messaging.calls.CallMessageType
|
||||
import org.session.libsession.messaging.contacts.Contact
|
||||
import org.session.libsession.messaging.jobs.AttachmentUploadJob
|
||||
@@ -13,14 +14,13 @@ import org.session.libsession.messaging.messages.control.MessageRequestResponse
|
||||
import org.session.libsession.messaging.messages.visible.Attachment
|
||||
import org.session.libsession.messaging.messages.visible.Reaction
|
||||
import org.session.libsession.messaging.messages.visible.VisibleMessage
|
||||
import org.session.libsession.messaging.open_groups.GroupMember
|
||||
import org.session.libsession.messaging.open_groups.OpenGroup
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentId
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
|
||||
import org.session.libsession.messaging.sending_receiving.data_extraction.DataExtractionNotificationInfoMessage
|
||||
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
||||
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
||||
import org.session.libsession.messaging.BlindedIdMapping
|
||||
import org.session.libsession.messaging.open_groups.GroupMember
|
||||
import org.session.libsession.utilities.Address
|
||||
import org.session.libsession.utilities.GroupRecord
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
@@ -190,7 +190,7 @@ interface StorageProtocol {
|
||||
fun removeLastOutboxMessageId(server: String)
|
||||
fun getOrCreateBlindedIdMapping(blindedId: String, server: String, serverPublicKey: String, fromOutbox: Boolean = false): BlindedIdMapping
|
||||
|
||||
fun addReaction(reaction: Reaction)
|
||||
fun addReaction(reaction: Reaction, messageSender: String)
|
||||
fun removeReaction(emoji: String, messageTimestamp: Long, author: String)
|
||||
fun updateReactionIfNeeded(message: Message, sender: String, openGroupSentTimestamp: Long)
|
||||
fun deleteReactions(messageId: Long, mms: Boolean)
|
||||
|
@@ -71,7 +71,7 @@ class VisibleMessage : Message() {
|
||||
val reaction = Reaction.fromProto(reactionProto)
|
||||
result.reaction = reaction
|
||||
}
|
||||
return result
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -300,7 +300,7 @@ fun MessageReceiver.handleVisibleMessage(message: VisibleMessage,
|
||||
reaction.serverId = message.openGroupServerMessageID?.toString() ?: message.serverHash.orEmpty()
|
||||
reaction.dateSent = message.sentTimestamp ?: 0
|
||||
reaction.dateReceived = message.receivedTimestamp ?: 0
|
||||
storage.addReaction(reaction)
|
||||
storage.addReaction(reaction, messageSender)
|
||||
} else {
|
||||
storage.removeReaction(reaction.emoji!!, reaction.timestamp!!, reaction.publicKey!!)
|
||||
}
|
||||
@@ -347,17 +347,17 @@ fun MessageReceiver.handleOpenGroupReactions(
|
||||
val reactorIds = reaction.reactors.filter { it != blindedPublicKey && it != userPublicKey }
|
||||
val count = if (reaction.you) reaction.count - 1 else reaction.count
|
||||
// Add the first reaction (with the count)
|
||||
reactorIds.firstOrNull()?.let {
|
||||
reactorIds.firstOrNull()?.let { reactor ->
|
||||
storage.addReaction(Reaction(
|
||||
localId = messageId,
|
||||
isMms = !isSms,
|
||||
publicKey = it,
|
||||
publicKey = reactor,
|
||||
emoji = emoji,
|
||||
react = true,
|
||||
serverId = "$openGroupMessageServerID",
|
||||
count = count,
|
||||
index = reaction.index
|
||||
))
|
||||
), reactor)
|
||||
}
|
||||
|
||||
// Add all other reactions
|
||||
@@ -373,7 +373,7 @@ fun MessageReceiver.handleOpenGroupReactions(
|
||||
serverId = "$openGroupMessageServerID",
|
||||
count = 0, // Only want this on the first reaction
|
||||
index = reaction.index
|
||||
))
|
||||
), reactor)
|
||||
}
|
||||
|
||||
// Add the current user reaction (if applicable and not already included)
|
||||
@@ -387,7 +387,7 @@ fun MessageReceiver.handleOpenGroupReactions(
|
||||
serverId = "$openGroupMessageServerID",
|
||||
count = 1,
|
||||
index = reaction.index
|
||||
))
|
||||
), userPublicKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user