core: make ttl optional in TimedMessagesPreference (#1583)

* core: make ttl Maybe in TimedMessagesPreference

* omitNothingFields
This commit is contained in:
JRoberts
2022-12-15 22:11:08 +04:00
committed by GitHub
parent aa264690ab
commit 17cd3cdca4
3 changed files with 10 additions and 7 deletions
+3 -2
View File
@@ -305,8 +305,9 @@ ciTimedToTTL timed_ = timed_ >>= \CITimed {ttl} -> Just ttl
contactCITimedTTL :: Contact -> Maybe Int
contactCITimedTTL Contact {mergedPreferences = ContactUserPreferences {timedMessages = ContactUserPreference {enabled, userPreference}}}
| forUser enabled && forContact enabled = case userPreference of
CUPContact TimedMessagesPreference {ttl = t} -> Just t
CUPUser TimedMessagesPreference {ttl = t} -> Just t
CUPContact TimedMessagesPreference {ttl = Just t} -> Just t
CUPUser TimedMessagesPreference {ttl = Just t} -> Just t
_ -> Nothing
| otherwise = Nothing
groupCITimedTTL :: GroupInfo -> Maybe Int