fix profile name key assignment
This commit is contained in:
parent
73ef443da5
commit
95beeae131
|
@ -9,33 +9,34 @@ type Profile* = ref object
|
|||
systemTags*: seq[string]
|
||||
|
||||
proc toProfileModel*(account: Account): Profile =
|
||||
result = Profile(
|
||||
id: "",
|
||||
username: account.name,
|
||||
identicon: account.photoPath,
|
||||
alias: account.name,
|
||||
ensName: "",
|
||||
ensVerified: false,
|
||||
ensVerifiedAt: 0,
|
||||
ensVerificationRetries: 0,
|
||||
systemTags: @[]
|
||||
)
|
||||
result = Profile(
|
||||
id: "",
|
||||
username: account.name,
|
||||
identicon: account.photoPath,
|
||||
alias: account.name,
|
||||
ensName: "",
|
||||
ensVerified: false,
|
||||
ensVerifiedAt: 0,
|
||||
ensVerificationRetries: 0,
|
||||
systemTags: @[]
|
||||
)
|
||||
|
||||
proc toProfileModel*(profile: JsonNode): Profile =
|
||||
var systemTags: seq[string] = @[]
|
||||
if profile["systemTags"].kind != JNull:
|
||||
systemTags = profile["systemTags"].to(seq[string])
|
||||
var systemTags: seq[string] = @[]
|
||||
if profile["systemTags"].kind != JNull:
|
||||
systemTags = profile["systemTags"].to(seq[string])
|
||||
|
||||
result = Profile(
|
||||
id: profile["id"].str,
|
||||
username: profile["alias"].str,
|
||||
identicon: profile["identicon"].str,
|
||||
address: profile["id"].str,
|
||||
alias: profile["alias"].str,
|
||||
# ensName: profile["name"].str, // doesn't seems to exist
|
||||
ensName: "",
|
||||
ensVerified: profile["ensVerified"].getBool,
|
||||
ensVerifiedAt: profile["ensVerifiedAt"].getInt,
|
||||
ensVerificationRetries: profile["ensVerificationRetries"].getInt,
|
||||
systemTags: systemTags
|
||||
)
|
||||
result = Profile(
|
||||
id: profile["id"].str,
|
||||
username: profile["alias"].str,
|
||||
identicon: profile["identicon"].str,
|
||||
address: profile["id"].str,
|
||||
alias: profile["alias"].str,
|
||||
ensName: "",
|
||||
ensVerified: profile["ensVerified"].getBool,
|
||||
ensVerifiedAt: profile["ensVerifiedAt"].getInt,
|
||||
ensVerificationRetries: profile["ensVerificationRetries"].getInt,
|
||||
systemTags: systemTags
|
||||
)
|
||||
if profile.hasKey("name"):
|
||||
result.ensName = profile["name"].str
|
||||
|
|
Loading…
Reference in New Issue