@@ -52,6 +52,7 @@ import Distribution.Server.Features.Tags
5252import Distribution.Server.Features.Upload
5353import Distribution.Server.Features.UserDetails
5454import Distribution.Server.Features.Users
55+ import Distribution.Server.Features.Vouch
5556
5657import Distribution.Server.Util.Email
5758
@@ -437,6 +438,7 @@ initUserNotifyFeature :: ServerEnv
437438 -> ReportsFeature
438439 -> TagsFeature
439440 -> ReverseFeature
441+ -> VouchFeature
440442 -> IO UserNotifyFeature )
441443initUserNotifyFeature env@ ServerEnv { serverStateDir, serverTemplatesDir,
442444 serverTemplatesMode } = do
@@ -448,10 +450,10 @@ initUserNotifyFeature env@ServerEnv{ serverStateDir, serverTemplatesDir,
448450 [serverTemplatesDir, serverTemplatesDir </> " UserNotify" ]
449451 [ " user-notify-form.html" ]
450452
451- return $ \ users core uploadfeature adminlog userdetails reports tags revers -> do
453+ return $ \ users core uploadfeature adminlog userdetails reports tags revers vouch -> do
452454 let feature = userNotifyFeature env
453455 users core uploadfeature adminlog userdetails reports tags
454- revers notifyState templates
456+ revers vouch notifyState templates
455457 return feature
456458
457459data InRange = InRange | OutOfRange
@@ -582,6 +584,7 @@ userNotifyFeature :: ServerEnv
582584 -> ReportsFeature
583585 -> TagsFeature
584586 -> ReverseFeature
587+ -> VouchFeature
585588 -> StateComponent AcidState NotifyData
586589 -> Templates
587590 -> UserNotifyFeature
@@ -594,6 +597,7 @@ userNotifyFeature serverEnv@ServerEnv{serverCron}
594597 ReportsFeature {.. }
595598 TagsFeature {.. }
596599 ReverseFeature {queryReverseIndex}
600+ VouchFeature {drainQueuedNotifications}
597601 notifyState templates
598602 = UserNotifyFeature {.. }
599603
@@ -709,6 +713,8 @@ userNotifyFeature serverEnv@ServerEnv{serverCron}
709713 revIdx <- liftIO queryReverseIndex
710714 dependencyUpdateNotifications <- concatMapM (genDependencyUpdateList notifyPrefs idx revIdx . pkgInfoToPkgId) revisionsAndUploads
711715
716+ vouchNotifications <- fmap (, NotifyVouchingCompleted ) <$> drainQueuedNotifications
717+
712718 emails <-
713719 getNotificationEmails serverEnv userDetailsFeature users $
714720 concat
@@ -717,6 +723,7 @@ userNotifyFeature serverEnv@ServerEnv{serverCron}
717723 , docReportNotifications
718724 , tagProposalNotifications
719725 , dependencyUpdateNotifications
726+ , vouchNotifications
720727 ]
721728 mapM_ sendNotifyEmailAndDelay emails
722729
@@ -897,6 +904,7 @@ data Notification
897904 -- ^ Packages maintained by user that depend on updated dep
898905 , notifyTriggerBounds :: NotifyTriggerBounds
899906 }
907+ | NotifyVouchingCompleted
900908 deriving (Show )
901909
902910data NotifyMaintainerUpdateType = MaintainerAdded | MaintainerRemoved
@@ -1021,6 +1029,10 @@ getNotificationEmails
10211029 notifyWatchedPackages
10221030 , DependencyNotification notifyPackageId
10231031 )
1032+ NotifyVouchingCompleted ->
1033+ generalNotification
1034+ renderNotifyVouchingCompleted
1035+
10241036 where
10251037 generalNotification = (, GeneralNotification )
10261038
@@ -1086,6 +1098,13 @@ getNotificationEmails
10861098 ]
10871099 <> EmailContentList (map renderPkgLink revDeps)
10881100
1101+ renderNotifyVouchingCompleted =
1102+ EmailContentParagraph
1103+ " You have received all necessary endorsements. \
1104+ \You have been added the the 'uploaders' group. \
1105+ \You can now upload packages to Hackage. \
1106+ \Note that packages cannot be deleted, so be careful."
1107+
10891108 {- ---- Rendering helpers -----}
10901109
10911110 renderPackageName = emailContentStr . unPackageName
0 commit comments