This commit is contained in:
Christian Ulrich 2024-05-29 00:41:46 +02:00
parent f757078d80
commit 8ad6997c66
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 16 additions and 20 deletions

View File

@ -119,12 +119,10 @@ instance Show Card where
where where
truncateDesc :: Text -> Text truncateDesc :: Text -> Text
truncateDesc input = truncateDesc input =
let let (fstLine, _) = T.break (== '\n') input
(fstLine, _) = T.break (== '\n') input in if T.length fstLine > 30
in then T.take 30 fstLine <> "..."
if T.length fstLine > 30 else fstLine
then T.take 30 fstLine <> "..."
else fstLine
authHeaders :: Text -> Text -> Option Https authHeaders :: Text -> Text -> Option Https
authHeaders username password = authHeaders username password =
@ -176,20 +174,18 @@ createCard hostname username password boardId stackId title description date wee
let url = baseUrl hostname /: "boards" /: T.pack (show boardId) /: "stacks" /: T.pack (show stackId) /: "cards" let url = baseUrl hostname /: "boards" /: T.pack (show boardId) /: "stacks" /: T.pack (show stackId) /: "cards"
let (_, dayOfYear) = toOrdinalDate date.localDay let (_, dayOfYear) = toOrdinalDate date.localDay
let (year, month, day) = toGregorian date.localDay let (year, month, day) = toGregorian date.localDay
let let expandedTitle =
expandedTitle = T.replace "%YY" (T.pack $ show year)
T.replace "%YY" (T.pack $ show year) $ T.replace "%MM" (T.pack $ show month)
$ T.replace "%MM" (T.pack $ show month) $ T.replace "%DD" (T.pack $ show day) title
$ T.replace "%DD" (T.pack $ show day) title let body =
let object
body = [ "title" .= expandedTitle
object , "type" .= ("plain" :: Text)
[ "title" .= expandedTitle , "order" .= dayOfYear
, "type" .= ("plain" :: Text) , "description" .= description
, "order" .= dayOfYear , "duedate" .= localTimeToUTC timezone date
, "description" .= description ]
, "duedate" .= localTimeToUTC timezone date
]
runReq defaultHttpConfig $ do runReq defaultHttpConfig $ do
_ <- req POST url (ReqBodyJson body) ignoreResponse headers _ <- req POST url (ReqBodyJson body) ignoreResponse headers
when (weeklyRepeats > 0) $ do when (weeklyRepeats > 0) $ do