From 7a92fc1c9baafdc29c413c0340361c62f70f757d Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Thu, 17 Aug 2023 10:04:11 -0700 Subject: [PATCH] Move + rename genEmails => genDependencyUpdateList --- src/Distribution/Server/Features/UserNotify.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Distribution/Server/Features/UserNotify.hs b/src/Distribution/Server/Features/UserNotify.hs index 2bd8dba1..9daa94d3 100644 --- a/src/Distribution/Server/Features/UserNotify.hs +++ b/src/Distribution/Server/Features/UserNotify.hs @@ -698,12 +698,8 @@ userNotifyFeature ServerEnv{serverBaseURI, serverCron} idx <- queryGetPackageIndex revIdx <- liftIO queryReverseIndex - let - genEmails :: PackageIdentifier -> IO (Map.Map (UserId, PackageId) [PackageId]) - genEmails = - dependencyReleaseEmails (queryUserGroup . maintainersGroup) idx revIdx queryGetUserNotifyPref - dependencyEmailMap <- Map.unionsWith (++) <$> traverse (genEmails . pkgInfoToPkgId) revisionsAndUploads - dependencyEmails <- Map.mapKeys fst <$> Map.traverseWithKey describeDependencyUpdate dependencyEmailMap + dependencyUpdateNotifications <- Map.unionsWith (++) <$> traverse (genDependencyUpdateList idx revIdx . pkgInfoToPkgId) revisionsAndUploads + dependencyEmails <- Map.mapKeys fst <$> Map.traverseWithKey describeDependencyUpdate dependencyUpdateNotifications -- Concat the constituent email parts such that only one email is sent per user mapM_ (sendNotifyEmailAndDelay users) . Map.toList $ foldr1 (Map.unionWith (++)) $ [revisionUploadEmails, groupActionEmails, docReportEmails, tagProposalEmails] @@ -799,6 +795,9 @@ userNotifyFeature ServerEnv{serverBaseURI, serverCron} maintainers <- queryUserGroup $ maintainersGroup (fst pkgTags) return $ foldr addNotification mp (toList maintainers) + genDependencyUpdateList idx revIdx = + dependencyReleaseEmails (queryUserGroup . maintainersGroup) idx revIdx queryGetUserNotifyPref + describeRevision users earlier now pkg = if pkgNumRevisions pkg <= 1 then "Package upload, " ++ display (packageName pkg) ++ ", by " ++