Merge Notification ExpiryDate
This commit is contained in:
parent
a8262a4162
commit
600d06f75b
@ -25,6 +25,7 @@ job-cron-interval: "_env:CRON_INTERVAL:60"
|
|||||||
job-stale-threshold: 300
|
job-stale-threshold: 300
|
||||||
notification-rate-limit: 3600
|
notification-rate-limit: 3600
|
||||||
notification-collate-delay: 300
|
notification-collate-delay: 300
|
||||||
|
notification-expiration: 259201
|
||||||
|
|
||||||
log-settings:
|
log-settings:
|
||||||
log-detailed: "_env:DETAILED_LOGGING:false"
|
log-detailed: "_env:DETAILED_LOGGING:false"
|
||||||
|
|||||||
@ -74,9 +74,10 @@ determineCrontab = execWriterT $ do
|
|||||||
tell $ HashMap.singleton
|
tell $ HashMap.singleton
|
||||||
(JobCtlQueue $ JobQueueNotification NotificationSheetInactive{..})
|
(JobCtlQueue $ JobQueueNotification NotificationSheetInactive{..})
|
||||||
Cron
|
Cron
|
||||||
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ sheetActiveTo
|
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ sheetActiveTo
|
||||||
, cronRepeat = CronRepeatOnChange
|
, cronRepeat = CronRepeatOnChange
|
||||||
, cronRateLimit = appNotificationRateLimit
|
, cronRateLimit = appNotificationRateLimit
|
||||||
|
, cronNotAfter = Left appNotificationExpiration
|
||||||
}
|
}
|
||||||
|
|
||||||
sheetSubmissions <- lift $ collateSubmissions <$>
|
sheetSubmissions <- lift $ collateSubmissions <$>
|
||||||
@ -89,6 +90,7 @@ determineCrontab = execWriterT $ do
|
|||||||
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ $ addUTCTime appNotificationCollateDelay time
|
{ cronInitial = CronTimestamp $ utcToLocalTimeTZ appTZ $ addUTCTime appNotificationCollateDelay time
|
||||||
, cronRepeat = CronRepeatNever
|
, cronRepeat = CronRepeatNever
|
||||||
, cronRateLimit = appNotificationRateLimit
|
, cronRateLimit = appNotificationRateLimit
|
||||||
|
, cronNotAfter = Left appNotificationExpiration
|
||||||
}
|
}
|
||||||
| otherwise -> mempty
|
| otherwise -> mempty
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import Text.Hamlet
|
|||||||
import qualified Data.CaseInsensitive as CI
|
import qualified Data.CaseInsensitive as CI
|
||||||
|
|
||||||
dispatchNotificationCorrectionsAssigned :: UserId -> SheetId -> UserId -> Handler ()
|
dispatchNotificationCorrectionsAssigned :: UserId -> SheetId -> UserId -> Handler ()
|
||||||
dispatchNotificationCorrectionsAssigned nUser nSheet jRecipient = userMailT jRecipient $ do
|
dispatchNotificationCorrectionsAssigned nUser nSheet jRecipient = do
|
||||||
(Course{..}, Sheet{..}, nbrSubs) <- liftHandlerT . runDB $ do
|
(Course{..}, Sheet{..}, nbrSubs) <- liftHandlerT . runDB $ do
|
||||||
sheet <- getJust nSheet
|
sheet <- getJust nSheet
|
||||||
course <- belongsToJust sheetCourse sheet
|
course <- belongsToJust sheetCourse sheet
|
||||||
@ -27,14 +27,15 @@ dispatchNotificationCorrectionsAssigned nUser nSheet jRecipient = userMailT jRe
|
|||||||
, SubmissionRatingTime ==. Nothing
|
, SubmissionRatingTime ==. Nothing
|
||||||
]
|
]
|
||||||
return (course, sheet, nbrSubs)
|
return (course, sheet, nbrSubs)
|
||||||
setSubjectI $ MsgMailSubjectSheetActive courseShorthand sheetName
|
when (nbrSubs > 0) . userMailT jRecipient $ do
|
||||||
|
setSubjectI $ MsgMailSubjectSheetActive courseShorthand sheetName
|
||||||
|
|
||||||
MsgRenderer mr <- getMailMsgRenderer
|
MsgRenderer mr <- getMailMsgRenderer
|
||||||
let termDesc = mr . ShortTermIdentifier $ unTermKey courseTerm
|
let termDesc = mr . ShortTermIdentifier $ unTermKey courseTerm
|
||||||
tid = courseTerm
|
tid = courseTerm
|
||||||
ssh = courseSchool
|
ssh = courseSchool
|
||||||
csh = courseShorthand
|
csh = courseShorthand
|
||||||
shn = sheetName
|
shn = sheetName
|
||||||
|
|
||||||
addAlternatives $ do
|
addAlternatives $ do
|
||||||
providePreferredAlternative ($(ihamletFile "templates/mail/correctionsAssigned.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
providePreferredAlternative ($(ihamletFile "templates/mail/correctionsAssigned.hamlet") :: HtmlUrlI18n UniWorXMessage (Route UniWorX))
|
||||||
|
|||||||
@ -90,6 +90,7 @@ data AppSettings = AppSettings
|
|||||||
, appJobStaleThreshold :: NominalDiffTime
|
, appJobStaleThreshold :: NominalDiffTime
|
||||||
, appNotificationRateLimit :: NominalDiffTime
|
, appNotificationRateLimit :: NominalDiffTime
|
||||||
, appNotificationCollateDelay :: NominalDiffTime
|
, appNotificationCollateDelay :: NominalDiffTime
|
||||||
|
, appNotificationExpiration :: NominalDiffTime
|
||||||
|
|
||||||
, appInitialLogSettings :: LogSettings
|
, appInitialLogSettings :: LogSettings
|
||||||
|
|
||||||
@ -295,6 +296,7 @@ instance FromJSON AppSettings where
|
|||||||
appJobStaleThreshold <- o .: "job-stale-threshold"
|
appJobStaleThreshold <- o .: "job-stale-threshold"
|
||||||
appNotificationRateLimit <- o .: "notification-rate-limit"
|
appNotificationRateLimit <- o .: "notification-rate-limit"
|
||||||
appNotificationCollateDelay <- o .: "notification-collate-delay"
|
appNotificationCollateDelay <- o .: "notification-collate-delay"
|
||||||
|
appNotificationExpiration <- o .: "notification-expiration"
|
||||||
|
|
||||||
appReloadTemplates <- o .:? "reload-templates" .!= defaultDev
|
appReloadTemplates <- o .:? "reload-templates" .!= defaultDev
|
||||||
appMutableStatic <- o .:? "mutable-static" .!= defaultDev
|
appMutableStatic <- o .:? "mutable-static" .!= defaultDev
|
||||||
|
|||||||
Reference in New Issue
Block a user