diff --git a/src/app/global/utils.nim b/src/app/global/utils.nim index f52c24fe0a3..7a2dc79cb6b 100644 --- a/src/app/global/utils.nim +++ b/src/app/global/utils.nim @@ -1,7 +1,6 @@ import NimQml, strutils, uri, stew/shims/strformat, strutils, stint, httpclient import stew/byteutils import ./utils/qrcodegen -import ./utils/time_utils # Services as instances shouldn't be used in this class, just some general/global procs import ../../app_service/common/conversion @@ -143,9 +142,6 @@ QtObject: return value[2..^1] return value - proc addTimestampToURL*(self: Utils, url: string): string {.slot.} = - return time_utils.addTimestampToURL(url) - proc isValidURL*(self: Utils, url: string): bool {.slot.} = var client = newHttpClient() defer: client.close() diff --git a/src/app/global/utils/time_utils.nim b/src/app/global/utils/time_utils.nim deleted file mode 100644 index 692ca2b18b1..00000000000 --- a/src/app/global/utils/time_utils.nim +++ /dev/null @@ -1,12 +0,0 @@ -import times - -proc addTimestampToURL*(url: string): string = - if url.len == 0: - return "" - - let timestamp = epochTime() - - if '?' in url: - return url & "×tamp=" & $timestamp - else: - return url & "?timestamp=" & $timestamp \ No newline at end of file diff --git a/src/app/modules/main/chat_section/chat_content/messages/module.nim b/src/app/modules/main/chat_section/chat_content/messages/module.nim index 1dc27b93915..8890fcf6d5f 100644 --- a/src/app/modules/main/chat_section/chat_content/messages/module.nim +++ b/src/app/modules/main/chat_section/chat_content/messages/module.nim @@ -16,7 +16,6 @@ import ../../../../../../app_service/service/mailservers/service as mailservers_ import ../../../../../../app_service/service/shared_urls/service as shared_urls_service import ../../../../../../app_service/service/contacts/dto/contact_details import ../../../../../../app_service/common/types -import ../../../../../global/utils as utils import ../../../../../global/global_singleton export io_interface @@ -434,12 +433,11 @@ method getNumberOfPinnedMessages*(self: Module): int = method updateContactDetails*(self: Module, contactId: string) = let updatedContact = self.controller.getContactDetails(contactId) - let updatedSenderIcon = singletonInstance.utils().addTimestampToURL(updatedContact.icon) for item in self.view.model().modelContactUpdateIterator(contactId): if item.senderId == contactId: item.senderDisplayName = updatedContact.defaultDisplayName item.senderOptionalName = updatedContact.optionalName - item.senderIcon = updatedSenderIcon + item.senderIcon = updatedContact.icon item.senderColorHash = updatedContact.colorHash item.senderIsAdded = updatedContact.dto.added item.senderTrustStatus = updatedContact.dto.trustStatus @@ -448,7 +446,7 @@ method updateContactDetails*(self: Module, contactId: string) = if item.quotedMessageAuthorDetails.dto.id == contactId: item.quotedMessageAuthorDetails = updatedContact item.quotedMessageAuthorDisplayName = updatedContact.defaultDisplayName - item.quotedMessageAuthorAvatar = updatedSenderIcon + item.quotedMessageAuthorAvatar = updatedContact.icon if item.messageContainsMentions and item.mentionedUsersPks.anyIt(it == contactId): let communityChats = self.controller.getCommunityDetails().chats diff --git a/src/app/modules/main/chat_section/model.nim b/src/app/modules/main/chat_section/model.nim index cb34f623762..4ae342e09c0 100644 --- a/src/app/modules/main/chat_section/model.nim +++ b/src/app/modules/main/chat_section/model.nim @@ -466,9 +466,7 @@ QtObject: return self.items[index].name = name - var updatedIcon = singletonInstance.utils().addTimestampToURL(icon) - - self.items[index].icon = updatedIcon + self.items[index].icon = icon self.items[index].trustStatus = trustStatus let modelIndex = self.createIndex(index, 0, nil) defer: modelIndex.delete diff --git a/src/app/modules/shared_models/user_model.nim b/src/app/modules/shared_models/user_model.nim index 57b6b715ada..1181f53511b 100644 --- a/src/app/modules/shared_models/user_model.nim +++ b/src/app/modules/shared_models/user_model.nim @@ -332,10 +332,6 @@ QtObject: roles.add(ModelRole.IsUntrustworthy.int) roles.add(ModelRole.IsVerified.int) - # The image is actually a URL that doesn't change. We need to force refresh it just in case - roles.add(ModelRole.ThumbnailImage.int) - roles.add(ModelRole.LargeImage.int) - if roles.len == 0: return diff --git a/test/nim/utils_test.nim b/test/nim/utils_test.nim deleted file mode 100644 index 3b4ce65d615..00000000000 --- a/test/nim/utils_test.nim +++ /dev/null @@ -1,28 +0,0 @@ -import unittest, strutils - -import app/global/utils/time_utils - -suite "adding timestamp to url": - test "adding timestamp to an image url with query containing ?": - let url = "https://Localhost:35651/contactImages?imageName=thumbnail?publicKey=0x04d76f84ec" - let result = time_utils.addTimestampToURL(url) - - check(result.startsWith(url & "×tamp=")) - - test "adding timestamp to an image url with query containing &": - let url = "https://Localhost:35651/contactImages&imageName=thumbnail&publicKey=0x04d76f84e8dc" - let result = time_utils.addTimestampToURL(url) - - check(result.startsWith(url & "?timestamp=")) - - test "image contains a mix of & and ? queries, & is added": - let url = "https://Localhost:35651/contactImages?imageName=thumbnail&publicKey=0x04d76f84e8dc" - let result = time_utils.addTimestampToURL(url) - - check(result.startsWith(url & "×tamp=")) - - test "adding timestamp to an empty image url": - let result = time_utils.addTimestampToURL("") - - let expectedResult = "" - check(result == expectedResult) \ No newline at end of file diff --git a/ui/imports/shared/popups/CommonContactDialog.qml b/ui/imports/shared/popups/CommonContactDialog.qml index dde0ce823bb..fe263bdf9b0 100644 --- a/ui/imports/shared/popups/CommonContactDialog.qml +++ b/ui/imports/shared/popups/CommonContactDialog.qml @@ -49,7 +49,7 @@ StatusDialog { name: root.mainDisplayName colorHash: contactDetails.colorHash colorId: contactDetails.colorId - image: Utils.addTimestampToURL(contactDetails.largeImage) + image: contactDetails.largeImage interactive: false imageWidth: 60 imageHeight: 60 diff --git a/ui/imports/shared/views/ProfileDialogView.qml b/ui/imports/shared/views/ProfileDialogView.qml index 7ab17f92208..4f6939f9dea 100644 --- a/ui/imports/shared/views/ProfileDialogView.qml +++ b/ui/imports/shared/views/ProfileDialogView.qml @@ -217,7 +217,7 @@ Pane { Layout.alignment: Qt.AlignTop objectName: "ProfileDialog_userImage" name: d.mainDisplayName - image: Utils.addTimestampToURL(contactDetails.largeImage) + image: contactDetails.largeImage colorId: contactDetails.colorId colorHash: contactDetails.colorHash diff --git a/ui/imports/utils/Utils.qml b/ui/imports/utils/Utils.qml index e6daa6d68df..cd97132a721 100644 --- a/ui/imports/utils/Utils.qml +++ b/ui/imports/utils/Utils.qml @@ -949,8 +949,4 @@ QtObject { return "" } - - function addTimestampToURL(url) { - return globalUtilsInst.addTimestampToURL(url) - } } diff --git a/vendor/status-go b/vendor/status-go index bb7b1f246dc..27ad41ba8f5 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit bb7b1f246dc6db3cd3ca460009048b49c8f14d0f +Subproject commit 27ad41ba8f500012e9e74b58e925d2de02b0b883