Skip to content

Commit

Permalink
Merge pull request #287 from ianmcorvidae/trim-prefs-errors
Browse files Browse the repository at this point in the history
Trim the :error key in preferences when other keys are present
  • Loading branch information
ianmcorvidae authored Sep 4, 2024
2 parents d6eea2f + 3d57c9e commit 5775999
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/terrain/routes/schemas/bootstrap.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@

(defschema UserPreferencesResponse
(doc-only (conditional :error BootstrapServiceError
:else Any)
;; :else user-prefs-schema/UserPreferencesResponse) ;; wasn't working for some reason
:else user-prefs-schema/UserPreferencesResponse)
user-prefs-schema/UserPreferencesResponseDocs))

(defschema UserSessionResponse
Expand All @@ -49,5 +48,4 @@
:session UserSessionResponse
:apps_info AppsBootstrapResponse
:data_info DataInfoResponse
:preferences (conditional :error BootstrapServiceError
:else Any)}) ;; I don't know why but UserPreferencesResponse isn't working
:preferences UserPreferencesResponse})
5 changes: 4 additions & 1 deletion src/terrain/services/bootstrap.clj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
(defn- get-user-prefs
[username]
(trap-bootstrap-request
#(prefs/user-prefs username)))
#(let [prefs (prefs/user-prefs username)]
(if (and (:error prefs) (:default_output_folder prefs)) ;; if we've got both, there's an error stored in preferences. remove it so schema validation works right
(dissoc prefs :error)
prefs))))

(defn bootstrap
"This service obtains information about and initializes the workspace for the authenticated user.
Expand Down

0 comments on commit 5775999

Please sign in to comment.