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]
|
systemTags*: seq[string]
|
||||||
|
|
||||||
proc toProfileModel*(account: Account): Profile =
|
proc toProfileModel*(account: Account): Profile =
|
||||||
result = Profile(
|
result = Profile(
|
||||||
id: "",
|
id: "",
|
||||||
username: account.name,
|
username: account.name,
|
||||||
identicon: account.photoPath,
|
identicon: account.photoPath,
|
||||||
alias: account.name,
|
alias: account.name,
|
||||||
ensName: "",
|
ensName: "",
|
||||||
ensVerified: false,
|
ensVerified: false,
|
||||||
ensVerifiedAt: 0,
|
ensVerifiedAt: 0,
|
||||||
ensVerificationRetries: 0,
|
ensVerificationRetries: 0,
|
||||||
systemTags: @[]
|
systemTags: @[]
|
||||||
)
|
)
|
||||||
|
|
||||||
proc toProfileModel*(profile: JsonNode): Profile =
|
proc toProfileModel*(profile: JsonNode): Profile =
|
||||||
var systemTags: seq[string] = @[]
|
var systemTags: seq[string] = @[]
|
||||||
if profile["systemTags"].kind != JNull:
|
if profile["systemTags"].kind != JNull:
|
||||||
systemTags = profile["systemTags"].to(seq[string])
|
systemTags = profile["systemTags"].to(seq[string])
|
||||||
|
|
||||||
result = Profile(
|
result = Profile(
|
||||||
id: profile["id"].str,
|
id: profile["id"].str,
|
||||||
username: profile["alias"].str,
|
username: profile["alias"].str,
|
||||||
identicon: profile["identicon"].str,
|
identicon: profile["identicon"].str,
|
||||||
address: profile["id"].str,
|
address: profile["id"].str,
|
||||||
alias: profile["alias"].str,
|
alias: profile["alias"].str,
|
||||||
# ensName: profile["name"].str, // doesn't seems to exist
|
ensName: "",
|
||||||
ensName: "",
|
ensVerified: profile["ensVerified"].getBool,
|
||||||
ensVerified: profile["ensVerified"].getBool,
|
ensVerifiedAt: profile["ensVerifiedAt"].getInt,
|
||||||
ensVerifiedAt: profile["ensVerifiedAt"].getInt,
|
ensVerificationRetries: profile["ensVerificationRetries"].getInt,
|
||||||
ensVerificationRetries: profile["ensVerificationRetries"].getInt,
|
systemTags: systemTags
|
||||||
systemTags: systemTags
|
)
|
||||||
)
|
if profile.hasKey("name"):
|
||||||
|
result.ensName = profile["name"].str
|
||||||
|
|
Loading…
Reference in New Issue