support comment without owner or parent id
This commit is contained in:
parent
ee456f7c11
commit
5d4c6bf200
1 changed files with 3 additions and 5 deletions
|
@ -250,17 +250,15 @@ instance FormI.FromHttpApiData MUserId where
|
|||
if Text.null txt
|
||||
then return (MUserId Nothing)
|
||||
else case UUID.fromText txt of
|
||||
Nothing -> Left $ "Parent ID is not an UUID (" <> txt <> ")"
|
||||
Just uuid -> return (MUserId (Just (UserId (toS uuid))))
|
||||
Nothing -> pure (MUserId Nothing)
|
||||
Just uuid -> pure (MUserId (Just (UserId (toS uuid))))
|
||||
|
||||
instance FormI.FromHttpApiData ParentId where
|
||||
parseUrlPiece s = do
|
||||
txt <- FormI.parseUrlPiece s
|
||||
if Text.null txt
|
||||
then return (ParentId Nothing)
|
||||
else case UUID.fromText txt of
|
||||
Nothing -> Left $ "Parent ID is not an UUID (" <> txt <> ")"
|
||||
Just uuid -> return (ParentId (Just uuid))
|
||||
else return (ParentId (UUID.fromText txt))
|
||||
instance FormI.FromHttpApiData Slug where parseUrlPiece = fmap Slug . FormI.parseUrlPiece
|
||||
instance FormI.FromHttpApiData Content where parseUrlPiece = fmap Content . FormI.parseUrlPiece
|
||||
|
||||
|
|
Loading…
Reference in a new issue