Skip to content

Commit 3a0fad2

Browse files
brandonchinn178ysangkok
authored andcommitted
Remove migration workarounds
1 parent cab758e commit 3a0fad2

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

src/Distribution/Server/Features/UserNotify.hs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -705,12 +705,7 @@ userNotifyFeature serverEnv@ServerEnv{serverCron}
705705
dependencyUpdateNotifications <- concatMapM (genDependencyUpdateList idx revIdx . pkgInfoToPkgId) revisionsAndUploads
706706

707707
emails <-
708-
getNotificationEmails serverEnv userDetailsFeature queryGetUserNotifyPref users
709-
( foldr1 (Map.unionWith (<>))
710-
[
711-
]
712-
, mempty
713-
) $
708+
getNotificationEmails serverEnv userDetailsFeature queryGetUserNotifyPref users $
714709
concat
715710
[ revisionUploadNotifications
716711
, groupActionNotifications
@@ -910,34 +905,22 @@ getNotificationEmails
910905
-> UserDetailsFeature
911906
-> (UserId -> IO (Maybe NotifyPref))
912907
-> Users.Users
913-
-> (Map UserId EmailContent, Map (UserId, PackageId) EmailContent)
914908
-> [(UserId, Notification)]
915909
-> IO [Mail]
916910
getNotificationEmails
917911
ServerEnv{serverBaseURI}
918912
UserDetailsFeature{queryUserDetails}
919913
queryGetUserNotifyPref
920914
allUsers
921-
(generalEmails, dependencyUpdateEmails)
922915
notifications = do
923916
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
926918
userIdToNotifyPref <- Map.mapMaybe id <$> fromSetM queryGetUserNotifyPref userIds
927919

928920
pure $
929921
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
941924
in flip mapMaybe (Map.toList emails) $ \((uid, group), emailContent) ->
942925
case uid `Map.lookup` userIdToDetails of
943926
Nothing -> Nothing

0 commit comments

Comments
 (0)