Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/correct-notification-timeout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set notificationTimeOut to 28 days, make it legible
8 changes: 7 additions & 1 deletion services/galley/src/Galley/Cassandra/TeamNotifications.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import Data.List1 (List1)
import Data.Range (Range, fromRange)
import Data.Sequence (Seq, ViewL (..), ViewR (..), (<|), (><))
import Data.Sequence qualified as Seq
import Data.Time (nominalDay, nominalDiffTimeToSeconds)
import Data.UUID.V1 qualified as UUID
import Galley.Cassandra.Store
import Galley.Data.TeamNotifications
Expand Down Expand Up @@ -84,8 +85,13 @@ add tid nid (Blob . JSON.encode -> payload) =
\(?, ?, ?) \
\USING TTL ?"

-- |
--
-- >>> import Data.Time
-- >>> formatTime defaultTimeLocale "%d days, %H hours, %M minutes, %S seconds" (secondsToNominalDiffTime (fromIntegral notificationTTLSeconds))
-- "28 days, 0 hours, 0 minutes, 0 seconds"
notificationTTLSeconds :: Int32
notificationTTLSeconds = 24192200
notificationTTLSeconds = round $ nominalDiffTimeToSeconds $ 28 * nominalDay

fetch :: TeamId -> Maybe NotificationId -> Range 1 10000 Int32 -> Client ResultPage
fetch tid since (fromRange -> size) = do
Expand Down