fix: fix self profile image not showing in the message and fix name
Fixes #4807
This commit is contained in:
parent
4f65286ead
commit
16aac6fd4a
|
@ -2,6 +2,7 @@ import chronicles
|
|||
import controller_interface
|
||||
import io_interface
|
||||
|
||||
import ../../../../../../app/global/global_singleton
|
||||
import ../../../../../../app_service/service/contacts/service as contact_service
|
||||
import ../../../../../../app_service/service/community/service as community_service
|
||||
import ../../../../../../app_service/service/chat/service as chat_service
|
||||
|
@ -116,6 +117,9 @@ method init*(self: Controller) =
|
|||
var args = ContactArgs(e)
|
||||
self.delegate.updateContactDetails(args.contactId)
|
||||
|
||||
self.events.on(SIGNAL_LOGGEDIN_USER_IMAGE_CHANGED) do(e: Args):
|
||||
self.delegate.updateContactDetails(singletonInstance.userProfile.getPubKey())
|
||||
|
||||
self.events.on(SIGNAL_MESSAGE_DELETION) do(e: Args):
|
||||
let args = MessageDeletedArgs(e)
|
||||
if(self.chatId != args.chatId):
|
||||
|
|
|
@ -177,6 +177,20 @@ QtObject:
|
|||
return status_accounts.generateIdenticon(publicKey).result.getStr
|
||||
|
||||
proc getContactById*(self: Service, id: string): ContactsDto =
|
||||
if(id == singletonInstance.userProfile.getPubKey()):
|
||||
# If we try to get the contact details of ourselves, just return our own info
|
||||
return ContactsDto(
|
||||
id: singletonInstance.userProfile.getPubKey(),
|
||||
name: singletonInstance.userProfile.getName(),
|
||||
identicon: singletonInstance.userProfile.getIdenticon(),
|
||||
alias: singletonInstance.userProfile.getUsername(),
|
||||
ensVerified: singletonInstance.userProfile.getEnsName().len > 0,
|
||||
image: Images(
|
||||
thumbnail: singletonInstance.userProfile.getThumbnailImage(),
|
||||
large: singletonInstance.userProfile.getLargeImage()
|
||||
)
|
||||
)
|
||||
|
||||
## Returns contact details based on passed id (public key)
|
||||
## If we don't have stored contact localy or in the db then we create it based on public key.
|
||||
if(self.contacts.hasKey(id)):
|
||||
|
|
|
@ -21,8 +21,8 @@ Item {
|
|||
|
||||
StyledTextEdit {
|
||||
id: chatName
|
||||
text: displayName
|
||||
color: text.startsWith("@") || amISender || localName !== "" ? Style.current.blue : Style.current.secondaryText
|
||||
text: root.amISender ? qsTr("You") : displayName
|
||||
color: text.startsWith("@") || root.amISender || localName !== "" ? Style.current.blue : Style.current.secondaryText
|
||||
font.weight: Font.Medium
|
||||
font.pixelSize: Style.current.secondaryTextFontSize
|
||||
font.underline: root.isHovered
|
||||
|
|
|
@ -31,7 +31,7 @@ Item {
|
|||
property string sticker
|
||||
property int stickerPack
|
||||
property bool isMessageActive: false
|
||||
property bool isCurrentUser: false
|
||||
property bool amISender: false
|
||||
property bool isHovered: false
|
||||
property bool isInPinnedPopup: false
|
||||
property bool showMoreButton: {
|
||||
|
@ -107,7 +107,7 @@ Item {
|
|||
showMoreButton: root.showMoreButton
|
||||
isInPinnedPopup: root.isInPinnedPopup
|
||||
fromAuthor: senderId
|
||||
editBtnActive: isText && !editModeOn && root.isCurrentUser
|
||||
editBtnActive: isText && !editModeOn && root.amISender
|
||||
activityCenterMsg: activityCenterMessage
|
||||
placeholderMsg: placeholderMessage
|
||||
onClickMessage: {
|
||||
|
@ -269,7 +269,7 @@ Item {
|
|||
anchors.left: chatImage.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.current.padding
|
||||
isCurrentUser: root.isCurrentUser
|
||||
isCurrentUser: root.amISender
|
||||
longReply: active && textFieldImplicitWidth > width
|
||||
container: root.container
|
||||
chatHorizontalPadding: chatHorizontalPadding
|
||||
|
@ -329,7 +329,7 @@ Item {
|
|||
messageContextMenu: root.messageContextMenu
|
||||
displayName: senderDisplayName
|
||||
localName: senderLocalName
|
||||
amISender: amISender
|
||||
amISender: root.amISender
|
||||
onClickMessage: {
|
||||
root.clickMessage(true, false, false, null, false, false, false, false, "")
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ Item {
|
|||
container: root.container
|
||||
messageStore: root.messageStore
|
||||
store: root.store
|
||||
isCurrentUser: isCurrentUser
|
||||
isCurrentUser: root.amISender
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ Item {
|
|||
anchors.top: chatTime.visible ? chatTime.top : messageContent.bottom
|
||||
anchors.topMargin: chatTime.visible ? 0 : -4
|
||||
anchors.bottom: chatTime.visible ? chatTime.bottom : undefined
|
||||
isCurrentUser: isCurrentUser
|
||||
isCurrentUser: root.amISender
|
||||
isExpired: isExpired
|
||||
timeout: timeout
|
||||
onClicked: {
|
||||
|
@ -707,7 +707,7 @@ Item {
|
|||
setHovered(messageId, hovered)
|
||||
}
|
||||
isMessageActive: isMessageActive
|
||||
isCurrentUser: isCurrentUser
|
||||
isCurrentUser: root.amISender
|
||||
onAddEmojiClicked: {
|
||||
root.addEmoji(false, false, false, null, true, false);
|
||||
// Set parent, X & Y positions for the messageContextMenu
|
||||
|
|
|
@ -359,7 +359,7 @@ Column {
|
|||
sticker: root.sticker
|
||||
stickerPack: root.stickerPack
|
||||
isMessageActive: root.isMessageActive
|
||||
isCurrentUser: root.amISender
|
||||
amISender: root.amISender
|
||||
isHovered: root.isHovered
|
||||
editModeOn: root.editModeOn
|
||||
linkUrls: root.linkUrls
|
||||
|
|
Loading…
Reference in New Issue