From 58b74f5487107dbadbd02d598ff88771a7450b4e Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Mon, 23 Sep 2019 21:24:08 +0200 Subject: [PATCH] infra: render presentation description --- infra/handler/app/Test.hs | 1 + infra/handler/src/DeckGo/Handler.hs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/infra/handler/app/Test.hs b/infra/handler/app/Test.hs index 2bcb51f1c..51e26c10b 100644 --- a/infra/handler/app/Test.hs +++ b/infra/handler/app/Test.hs @@ -173,6 +173,7 @@ testPresDeploys = withQueueName $ withEnv $ \env -> withSQS env $ withS3 env $ d , presentationOwner = someUserId , presentationAttributes = HMS.empty , presentationBackground = Nothing + , presentationDescription = "" } let uname = Username "josph" diff --git a/infra/handler/src/DeckGo/Handler.hs b/infra/handler/src/DeckGo/Handler.hs index 443f303ee..2a2a4d956 100644 --- a/infra/handler/src/DeckGo/Handler.hs +++ b/infra/handler/src/DeckGo/Handler.hs @@ -311,6 +311,7 @@ data PresentationInfo = PresentationInfo , presentationBackground :: Maybe PresentationBackground , presentationAttributes :: HMS.HashMap T.Text T.Text , presentationSlides :: [Slide] + , presentationDescription :: T.Text } deriving (Show, Eq) data PresentationResult = PresentationResult @@ -327,7 +328,8 @@ instance FromJSONObject PresentationInfo where obj .: "owner_id" <*> obj .:? "background" <*> obj .:? "attributes" .!= HMS.empty <*> - obj .: "slides" + obj .: "slides" <*> + obj .: "description" instance FromJSONObject PresentationResult where parseJSONObject = undefined -- \obj -> @@ -1245,11 +1247,10 @@ withPresentationFiles uname psname presentationInfo act = do T.replace "{{DECKDECKGO_TITLE_SHORT}}" (T.take 12 $ unPresentationName pname) . T.replace "{{DECKDECKGO_AUTHOR}}" (unUsername uname) . T.replace "{{DECKDECKGO_USERNAME}}" (unUsername uname) . + T.replace "{{DECKDECKGO_DESCRIPTION}}" (presentationDescription presentationInfo) . T.replace "{{DECKDECKGO_USER_ID}}" (unFirebaseId . unUserId $ presentationOwner presentationInfo) . T.replace "{{DECKDECKGO_DECKNAME}}" (unPresShortname psname) . - -- TODO: description - T.replace "{{DECKDECKGO_DESCRIPTION}}" "(no description given)" . T.replace "{{DECKDECKGO_BASE_HREF}}" ("/" <> unPresentationPrefix (presentationPrefix uname psname))