aboutsummaryrefslogtreecommitdiffstats
path: root/app/IssueEvent.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-13 03:47:14 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-12-13 04:50:01 +0100
commit2bbd2f8b692dd952903a9f1527f2779a916118ab (patch)
tree0ab292e196327f719a2e953bdaac70cf3be9abb5 /app/IssueEvent.hs
parent4426863f07901f626a537f2f0bb717b1bd1b0f6d (diff)
chore: uncache large issue fields
Diffstat (limited to 'app/IssueEvent.hs')
-rw-r--r--app/IssueEvent.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/IssueEvent.hs b/app/IssueEvent.hs
index c82dba5..0c641ad 100644
--- a/app/IssueEvent.hs
+++ b/app/IssueEvent.hs
@@ -5,6 +5,7 @@ module IssueEvent
)
where
+import Control.Monad (join)
import Data.Binary (Binary (..))
import Data.Function ((&))
import Data.Text qualified as T
@@ -42,9 +43,9 @@ data IssueEvent
deriving (Show, Generic, Binary)
instance HasField "patch" IssueEvent (IO Patch) where
- getField (IssueCreated {..}) = diff "" issue.rawText
- getField (IssueChanged {..}) = diff oldIssue.rawText issue.rawText
- getField (IssueDeleted {..}) = diff issue.rawText ""
+ getField (IssueCreated {..}) = join $ (diff "" <$> issue.rawText)
+ getField (IssueChanged {..}) = join $ (diff <$> oldIssue.rawText <*> issue.rawText)
+ getField (IssueDeleted {..}) = join $ (flip diff "" <$> issue.rawText)
diff :: T.Text -> T.Text -> IO A.Patch
diff old new = withSystemTempDirectory "diff" $ \tmp -> do