fix: consecutive discord messages should be grouped like status messages
- fill the senderId just like other messages - add some checks in Utils since the "publicKey" (ID) coming Discord isn't in the format we'd normally expect Closes #6678
This commit is contained in:
parent
6175beb40a
commit
f122607ada
|
@ -134,6 +134,7 @@ proc initItem*(
|
||||||
|
|
||||||
if ContentType.DiscordMessage == contentType:
|
if ContentType.DiscordMessage == contentType:
|
||||||
result.messageText = discordMessage.content
|
result.messageText = discordMessage.content
|
||||||
|
result.senderId = discordMessage.author.id
|
||||||
result.senderDisplayName = discordMessage.author.name
|
result.senderDisplayName = discordMessage.author.name
|
||||||
result.senderIcon = discordMessage.author.localUrl
|
result.senderIcon = discordMessage.author.localUrl
|
||||||
result.timestamp = parseInt(discordMessage.timestamp)*1000
|
result.timestamp = parseInt(discordMessage.timestamp)*1000
|
||||||
|
|
|
@ -90,7 +90,7 @@ Loader {
|
||||||
property double prevMsgTimestamp: prevMessageAsJsonObj ? prevMessageAsJsonObj.timestamp : 0
|
property double prevMsgTimestamp: prevMessageAsJsonObj ? prevMessageAsJsonObj.timestamp : 0
|
||||||
property double nextMsgTimestamp: nextMessageAsJsonObj ? nextMessageAsJsonObj.timestamp : 0
|
property double nextMsgTimestamp: nextMessageAsJsonObj ? nextMessageAsJsonObj.timestamp : 0
|
||||||
|
|
||||||
property bool shouldRepeatHeader: ((messageTimestamp - prevMsgTimestamp) / 60 / 1000) > Constants.repeatHeaderInterval || isDiscordMessage
|
property bool shouldRepeatHeader: ((messageTimestamp - prevMsgTimestamp) / 60 / 1000) > Constants.repeatHeaderInterval
|
||||||
|
|
||||||
property bool hasMention: false
|
property bool hasMention: false
|
||||||
|
|
||||||
|
|
|
@ -562,13 +562,13 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEnsVerified(publicKey, getVerificationRequest=true) {
|
function isEnsVerified(publicKey, getVerificationRequest=true) {
|
||||||
if (!publicKey)
|
if (publicKey === "" || !isChatKey(publicKey) )
|
||||||
return false
|
return
|
||||||
return getContactDetailsAsJson(publicKey, getVerificationRequest).ensVerified
|
return getContactDetailsAsJson(publicKey, getVerificationRequest).ensVerified
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEmojiHashAsJson(publicKey) {
|
function getEmojiHashAsJson(publicKey) {
|
||||||
if (publicKey === "") {
|
if (publicKey === "" || !isChatKey(publicKey)) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
let jsonObj = globalUtilsInst.getEmojiHashAsJson(publicKey)
|
let jsonObj = globalUtilsInst.getEmojiHashAsJson(publicKey)
|
||||||
|
@ -576,7 +576,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getColorHashAsJson(publicKey, force=false, getVerificationRequest=true) {
|
function getColorHashAsJson(publicKey, force=false, getVerificationRequest=true) {
|
||||||
if (publicKey === "")
|
if (publicKey === "" || !isChatKey(publicKey) )
|
||||||
return
|
return
|
||||||
if (!force && isEnsVerified(publicKey, getVerificationRequest))
|
if (!force && isEnsVerified(publicKey, getVerificationRequest))
|
||||||
return
|
return
|
||||||
|
@ -585,7 +585,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorIdForPubkey(publicKey) {
|
function colorIdForPubkey(publicKey) {
|
||||||
if (publicKey === "") {
|
if (publicKey === "" || !isChatKey(publicKey)) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return globalUtilsInst.getColorId(publicKey)
|
return globalUtilsInst.getColorId(publicKey)
|
||||||
|
@ -608,6 +608,8 @@ QtObject {
|
||||||
if (publicKey === "") {
|
if (publicKey === "") {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
if (!isChatKey(publicKey))
|
||||||
|
return publicKey
|
||||||
return globalUtilsInst.getCompressedPk(publicKey)
|
return globalUtilsInst.getCompressedPk(publicKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue