objective categorical abstract machine language personal data server
65
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix getPreferences response format

futurGH cf37d475 cfb36a03

+8 -6
+4 -2
pegasus/lib/api/proxy/appBskyActorGetPreferences.ml
··· 1 + type response = {preferences: Yojson.Safe.t} [@@deriving yojson {strict= false}] 2 + 1 3 let handler = 2 4 Xrpc.handler ~auth:Authorization (fun {db; auth; _} -> 3 5 let did = Auth.get_authed_did_exn auth in 4 - let%lwt prefs = 6 + let%lwt preferences = 5 7 match%lwt Data_store.get_actor_by_identifier did db with 6 8 | Some actor -> 7 9 Lwt.return actor.preferences 8 10 | None -> 9 11 Errors.internal_error () 10 12 in 11 - Dream.json @@ Yojson.Safe.to_string prefs ) 13 + {preferences} |> response_to_yojson |> Yojson.Safe.to_string |> Dream.json )
+3 -3
pegasus/lib/api/proxy/appBskyActorPutPreferences.ml
··· 4 4 let%lwt body = Dream.body req in 5 5 let prefs = 6 6 match Yojson.Safe.from_string body with 7 - | `Assoc [("preferences", prefs)] -> 7 + | `Assoc [("preferences", `List prefs)] -> 8 8 prefs 9 9 | _ -> 10 - Errors.invalid_request "Invalid request body" 10 + Errors.invalid_request "invalid request body" 11 11 in 12 - let%lwt () = Data_store.put_preferences ~did ~prefs db in 12 + let%lwt () = Data_store.put_preferences ~did ~prefs:(`List prefs) db in 13 13 Dream.empty `OK )
+1 -1
pegasus/lib/data_store.ml
··· 188 188 Util.use_pool conn 189 189 @@ Queries.create_actor ~did ~handle ~email ~password_hash ~signing_key 190 190 ~created_at:now 191 - ~preferences:(Yojson.Safe.from_string "{}") 191 + ~preferences:(Yojson.Safe.from_string "[]") 192 192 193 193 let get_actor_by_identifier id conn = 194 194 Util.use_pool conn @@ Queries.get_actor_by_identifier ~id