Optimize profile fetching and caching
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
import options
|
||||
import jsony
|
||||
import user, ../types/[graphuser, graphlistmembers]
|
||||
from ../../types import User, Result, Query, QueryKind
|
||||
|
||||
proc parseGraphUser*(json: string): User =
|
||||
let raw = json.fromJson(GraphUser)
|
||||
|
||||
if raw.data.user.result.reason.get("") == "Suspended":
|
||||
return User(suspended: true)
|
||||
|
||||
result = toUser raw.data.user.result.legacy
|
||||
result.id = raw.data.user.result.restId
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import options
|
||||
import user
|
||||
|
||||
type
|
||||
@@ -10,3 +11,4 @@ type
|
||||
UserResult = object
|
||||
legacy*: RawUser
|
||||
restId*: string
|
||||
reason*: Option[string]
|
||||
|
||||
Reference in New Issue
Block a user