Skip to content

Commit

Permalink
Move + rename genEmails => genDependencyUpdateList
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 authored and ysangkok committed Aug 19, 2023
1 parent 0f21fe9 commit 7a92fc1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Distribution/Server/Features/UserNotify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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 " ++
Expand Down

0 comments on commit 7a92fc1

Please sign in to comment.