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
|
if Text.null txt
|
||||||
then return (MUserId Nothing)
|
then return (MUserId Nothing)
|
||||||
else case UUID.fromText txt of
|
else case UUID.fromText txt of
|
||||||
Nothing -> Left $ "Parent ID is not an UUID (" <> txt <> ")"
|
Nothing -> pure (MUserId Nothing)
|
||||||
Just uuid -> return (MUserId (Just (UserId (toS uuid))))
|
Just uuid -> pure (MUserId (Just (UserId (toS uuid))))
|
||||||
|
|
||||||
instance FormI.FromHttpApiData ParentId where
|
instance FormI.FromHttpApiData ParentId where
|
||||||
parseUrlPiece s = do
|
parseUrlPiece s = do
|
||||||
txt <- FormI.parseUrlPiece s
|
txt <- FormI.parseUrlPiece s
|
||||||
if Text.null txt
|
if Text.null txt
|
||||||
then return (ParentId Nothing)
|
then return (ParentId Nothing)
|
||||||
else case UUID.fromText txt of
|
else return (ParentId (UUID.fromText txt))
|
||||||
Nothing -> Left $ "Parent ID is not an UUID (" <> txt <> ")"
|
|
||||||
Just uuid -> return (ParentId (Just uuid))
|
|
||||||
instance FormI.FromHttpApiData Slug where parseUrlPiece = fmap Slug . FormI.parseUrlPiece
|
instance FormI.FromHttpApiData Slug where parseUrlPiece = fmap Slug . FormI.parseUrlPiece
|
||||||
instance FormI.FromHttpApiData Content where parseUrlPiece = fmap Content . FormI.parseUrlPiece
|
instance FormI.FromHttpApiData Content where parseUrlPiece = fmap Content . FormI.parseUrlPiece
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue