mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-12 10:15:50 +00:00
Merge pull request #105 from PhillipLangMartinez/bugfix/replies-show-original-author
fix send name/address in replies
This commit is contained in:
commit
beb6598ccf
@ -52,33 +52,47 @@ export const replaceMessagesEdited = async ({
|
|||||||
msgQuery = `&txGroupId=${msg.txGroupId}`
|
msgQuery = `&txGroupId=${msg.txGroupId}`
|
||||||
}
|
}
|
||||||
if (parsedMessageObj.repliedTo) {
|
if (parsedMessageObj.repliedTo) {
|
||||||
|
const originalReply = await parentEpml.request("apiCall", {
|
||||||
|
type: "api",
|
||||||
|
url: `/chat/messages?reference=${parsedMessageObj.repliedTo}&reverse=true${msgQuery}`,
|
||||||
|
})
|
||||||
const response = await parentEpml.request("apiCall", {
|
const response = await parentEpml.request("apiCall", {
|
||||||
type: "api",
|
type: "api",
|
||||||
url: `/chat/messages?chatreference=${parsedMessageObj.repliedTo}&reverse=true${msgQuery}`,
|
url: `/chat/messages?chatreference=${parsedMessageObj.repliedTo}&reverse=true${msgQuery}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
originalReply &&
|
||||||
|
Array.isArray(originalReply) &&
|
||||||
|
originalReply.length !== 0 &&
|
||||||
response &&
|
response &&
|
||||||
Array.isArray(response) &&
|
Array.isArray(response) &&
|
||||||
response.length !== 0
|
response.length !== 0
|
||||||
) {
|
) {
|
||||||
|
const decodeOriginalReply = decodeMessageFunc(originalReply[0], isReceipient, _publicKey)
|
||||||
|
|
||||||
|
const decodeUpdatedReply = decodeMessageFunc(response[0], isReceipient, _publicKey)
|
||||||
|
const formattedRepliedToData = {
|
||||||
|
...decodeUpdatedReply,
|
||||||
|
senderName: decodeOriginalReply.senderName,
|
||||||
|
sender: decodeOriginalReply.sender,
|
||||||
|
}
|
||||||
msgItem = {
|
msgItem = {
|
||||||
...msg,
|
...msg,
|
||||||
repliedToData: decodeMessageFunc(response[0], isReceipient, _publicKey),
|
repliedToData: formattedRepliedToData,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const response2 = await parentEpml.request("apiCall", {
|
|
||||||
type: "api",
|
|
||||||
url: `/chat/messages?reference=${parsedMessageObj.repliedTo}&reverse=true${msgQuery}`,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
response2 &&
|
originalReply &&
|
||||||
Array.isArray(response2) &&
|
Array.isArray(originalReply) &&
|
||||||
response2.length !== 0
|
originalReply.length !== 0
|
||||||
) {
|
) {
|
||||||
|
|
||||||
msgItem = {
|
msgItem = {
|
||||||
...msg,
|
...msg,
|
||||||
repliedToData: decodeMessageFunc(response2[0], isReceipient, _publicKey),
|
repliedToData: decodeMessageFunc(originalReply[0], isReceipient, _publicKey),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user