@@ -705,12 +705,7 @@ userNotifyFeature serverEnv@ServerEnv{serverCron}
705
705
dependencyUpdateNotifications <- concatMapM (genDependencyUpdateList idx revIdx . pkgInfoToPkgId) revisionsAndUploads
706
706
707
707
emails <-
708
- getNotificationEmails serverEnv userDetailsFeature queryGetUserNotifyPref users
709
- ( foldr1 (Map. unionWith (<>) )
710
- [
711
- ]
712
- , mempty
713
- ) $
708
+ getNotificationEmails serverEnv userDetailsFeature queryGetUserNotifyPref users $
714
709
concat
715
710
[ revisionUploadNotifications
716
711
, groupActionNotifications
@@ -910,34 +905,22 @@ getNotificationEmails
910
905
-> UserDetailsFeature
911
906
-> (UserId -> IO (Maybe NotifyPref ))
912
907
-> Users. Users
913
- -> (Map UserId EmailContent , Map (UserId , PackageId ) EmailContent )
914
908
-> [(UserId , Notification )]
915
909
-> IO [Mail ]
916
910
getNotificationEmails
917
911
ServerEnv {serverBaseURI}
918
912
UserDetailsFeature {queryUserDetails}
919
913
queryGetUserNotifyPref
920
914
allUsers
921
- (generalEmails, dependencyUpdateEmails)
922
915
notifications = do
923
916
let userIds = Set. fromList $ map fst notifications
924
- let userIds' = Set. fromList . Map. keys $ generalEmails <> Map. mapKeys fst dependencyUpdateEmails
925
- userIdToDetails <- Map. mapMaybe id <$> fromSetM queryUserDetails (userIds <> userIds')
917
+ userIdToDetails <- Map. mapMaybe id <$> fromSetM queryUserDetails userIds
926
918
userIdToNotifyPref <- Map. mapMaybe id <$> fromSetM queryGetUserNotifyPref userIds
927
919
928
920
pure $
929
921
let emails =
930
- groupNotifications . concat $
931
- [ Map. toList
932
- . fmap (, GeneralNotification )
933
- $ generalEmails
934
- , Map. toList
935
- . Map. mapKeys fst
936
- . Map. mapWithKey (\ (_, pkg) emailContent -> (emailContent, DependencyNotification pkg))
937
- $ dependencyUpdateEmails
938
- , flip mapMaybe notifications $ \ (uid, notif) ->
939
- fmap (uid,) $ renderNotification userIdToNotifyPref uid notif
940
- ]
922
+ groupNotifications . flip mapMaybe notifications $ \ (uid, notif) ->
923
+ fmap (uid,) $ renderNotification userIdToNotifyPref uid notif
941
924
in flip mapMaybe (Map. toList emails) $ \ ((uid, group), emailContent) ->
942
925
case uid `Map.lookup` userIdToDetails of
943
926
Nothing -> Nothing
0 commit comments