Фикс парсинга reply в группах
This commit is contained in:
@@ -535,8 +535,12 @@ fun ChatDetailScreen(
|
||||
timestamp = chatMsg.timestamp.time,
|
||||
isOutgoing = chatMsg.isOutgoing,
|
||||
publicKey =
|
||||
if (chatMsg.isOutgoing) currentUserPublicKey
|
||||
else user.publicKey,
|
||||
chatMsg.senderPublicKey.ifEmpty {
|
||||
if (chatMsg.isOutgoing)
|
||||
currentUserPublicKey
|
||||
else user.publicKey
|
||||
},
|
||||
senderName = chatMsg.senderName,
|
||||
attachments = chatMsg.attachments
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1902,13 +1902,19 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
_replyMessages.value =
|
||||
messages.map { msg ->
|
||||
val resolvedPublicKey =
|
||||
msg.senderPublicKey.trim().ifEmpty {
|
||||
if (msg.isOutgoing) sender else opponent
|
||||
}
|
||||
ReplyMessage(
|
||||
messageId = msg.id,
|
||||
text = msg.text,
|
||||
timestamp = msg.timestamp.time,
|
||||
isOutgoing = msg.isOutgoing,
|
||||
// Если сообщение от меня - мой publicKey, иначе - собеседника
|
||||
publicKey = if (msg.isOutgoing) sender else opponent,
|
||||
// В группах senderPublicKey содержит автора сообщения, а opponent = ключ группы.
|
||||
// Для desktop parity в reply JSON нужен именно ключ автора.
|
||||
publicKey = resolvedPublicKey,
|
||||
senderName = msg.senderName,
|
||||
attachments =
|
||||
msg.attachments
|
||||
.filter { it.type != AttachmentType.MESSAGES }
|
||||
@@ -1924,12 +1930,17 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
_replyMessages.value =
|
||||
messages.map { msg ->
|
||||
val resolvedPublicKey =
|
||||
msg.senderPublicKey.trim().ifEmpty {
|
||||
if (msg.isOutgoing) sender else opponent
|
||||
}
|
||||
ReplyMessage(
|
||||
messageId = msg.id,
|
||||
text = msg.text,
|
||||
timestamp = msg.timestamp.time,
|
||||
isOutgoing = msg.isOutgoing,
|
||||
publicKey = if (msg.isOutgoing) sender else opponent,
|
||||
publicKey = resolvedPublicKey,
|
||||
senderName = msg.senderName,
|
||||
attachments =
|
||||
msg.attachments
|
||||
.filter { it.type != AttachmentType.MESSAGES }
|
||||
|
||||
Reference in New Issue
Block a user