This repository was archived by the owner on Feb 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 11{-# LANGUAGE DataKinds #-}
2+ {-# LANGUAGE MonadFailDesugaring #-}
23{-# LANGUAGE RankNTypes #-}
34{-# LANGUAGE DeriveGeneric #-}
45{-# LANGUAGE FlexibleContexts #-}
@@ -132,14 +133,15 @@ newtype FirebaseId = FirebaseId { unFirebaseId :: T.Text }
132133 deriving stock
133134 ( Generic )
134135
136+ -- XXX !!?!??!?!! pattern match failures are propagated to the client!!!
135137instance FromJSONObject User where
136138 parseJSONObject = \ obj ->
137139 User
138140 <$> obj .: " firebase_uid"
139141 <*> (
140142 (do
141143 True <- obj .: " anonymous"
142- (Nothing :: Maybe Username ) <- obj .: " username"
144+ (Nothing :: Maybe Username ) <- obj .:? " username"
143145 pure Nothing
144146 ) <|> (do
145147 False <- obj .: " anonymous"
@@ -1132,8 +1134,8 @@ migrateFrom :: DbVersion -> HS.Session ()
11321134migrateFrom = \ ver ->
11331135 if ver < maxBound
11341136 then
1135- let from = succ ver
1136- in forM_ [from .. maxBound ] migrateTo
1137+ let frm = succ ver
1138+ in forM_ [frm .. maxBound ] migrateTo
11371139 else pure ()
11381140 where
11391141 -- | Migrates from (ver -1) to ver
@@ -1228,6 +1230,8 @@ dbVersionFromText :: T.Text -> Maybe DbVersion
12281230dbVersionFromText t =
12291231 find (\ ver -> dbVersionToText ver == t) [minBound .. maxBound ]
12301232
1233+ -- XXX: this is not quite right, it'll never do the Version1 migration. Not a
1234+ -- problem currently since we dump everything at v2 anyway.
12311235migrate :: HS. Session ()
12321236migrate = do
12331237 readDbVersion >>= \ case
You can’t perform that action at this time.
0 commit comments