Fixed dismissing issue when update contact's profile. Fixes #1761

This commit is contained in:
staked-smart-ace 2021-01-28 02:03:50 +04:00 committed by Iuri Matias
parent 228e746421
commit 31a9d1a6f1
2 changed files with 7 additions and 5 deletions

View File

@ -1,3 +1,4 @@
import NimQml, chronicles, os, strformat
import json, sequtils, sugar
import libstatus/contacts as status_contacts
import libstatus/accounts as status_accounts
@ -40,7 +41,7 @@ proc blockContact*(self: ContactModel, id: string): string =
proc unblockContact*(self: ContactModel, id: string): string =
var contact = self.getContactByID(id)
contact.systemTags.delete(contact.systemTags.find(":contact/blocked"))
discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries,contact.alias, contact.identicon, contact.systemTags, contact.localNickname)
discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries,contact.alias, contact.identicon, contact.identityImage.thumbnail, contact.systemTags, contact.localNickname)
self.events.emit("contactUnblocked", Args())
proc getAllContacts*(): seq[Profile] =
@ -81,7 +82,7 @@ proc addContact*(self: ContactModel, id: string, localNickname: string): string
""
else:
localNickname
result = status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.systemTags, nickname)
result = status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.identityImage.thumbnail, contact.systemTags, nickname)
self.events.emit("contactAdded", Args())
discard requestContactUpdate(contact.id)
if updating:
@ -106,7 +107,7 @@ proc addContact*(self: ContactModel, id: string): string =
proc removeContact*(self: ContactModel, id: string) =
let contact = self.getContactByID(id)
contact.systemTags.delete(contact.systemTags.find(":contact/added"))
discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.systemTags, contact.localNickname)
discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.identityImage.thumbnail, contact.systemTags, contact.localNickname)
self.events.emit("contactRemoved", Args())
proc isAdded*(self: ContactModel, id: string): bool =

View File

@ -1,4 +1,4 @@
import json
import json, strmisc
import core, utils, types, settings
from ../profile/profile import Profile
@ -26,7 +26,7 @@ proc getContacts*(): JsonNode =
return %* []
return response["result"]
proc saveContact*(id: string, ensVerified: bool, ensName: string, ensVerifiedAt: int, ensVerificationRetries: int, alias: string, identicon: string, systemTags: seq[string], localNickname: string): string =
proc saveContact*(id: string, ensVerified: bool, ensName: string, ensVerifiedAt: int, ensVerificationRetries: int, alias: string, identicon: string, thumbnail: string, systemTags: seq[string], localNickname: string): string =
let payload = %* [{
"id": id,
"name": ensName,
@ -35,6 +35,7 @@ proc saveContact*(id: string, ensVerified: bool, ensName: string, ensVerifiedAt:
"ensVerificationRetries": ensVerificationRetries,
"alias": alias,
"identicon": identicon,
"images": {"thumbnail": {"Payload": thumbnail.partition(",")[2]}},
"systemTags": systemTags,
"localNickname": localNickname
}]