Skip to content

Commit fb09c8b

Browse files
brandonchinn178ysangkok
authored andcommitted
Simplify describeDependencyUpdate
1 parent e652a60 commit fb09c8b

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

src/Distribution/Server/Features/UserNotify.hs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -847,27 +847,28 @@ userNotifyFeature ServerEnv{serverBaseURI, serverCron}
847847
case mPrefs of
848848
Nothing -> []
849849
Just NotifyPref{notifyDependencyTriggerBounds} ->
850-
[ "The dependency " <> display dep <> " has been updated."
851-
] ++
852-
case notifyDependencyTriggerBounds of
853-
Always ->
854-
[ "You have requested to be notified for each upload/revision of a dependency. \
855-
\These are your packages that depend on " <> display dep <> ":"
856-
]
857-
outOfRangeOption ->
858-
[ "You have requested to be notified when a dependency isn't accepted by any of \
859-
\your maintained packages."
860-
] ++
861-
case outOfRangeOption of
862-
NewIncompatibility ->
863-
[ "The following packages did accept the second highest version of "
864-
<> display (packageName dep) <> "."
865-
]
866-
_ ->
867-
[]
868-
++
869-
[ "These are your packages that require " <> display (packageName dep) <> " but don't accept " <> display (packageVersion dep) <> ":"
870-
]
850+
let depName = display (packageName dep)
851+
depVersion = display (packageVersion dep)
852+
in
853+
[ "The dependency " <> display dep <> " has been uploaded or revised."
854+
, case notifyDependencyTriggerBounds of
855+
Always ->
856+
"You have requested to be notified for each upload or revision \
857+
\of a dependency."
858+
_ ->
859+
"You have requested to be notified when a dependency isn't \
860+
\accepted by any of your maintained packages."
861+
, case notifyDependencyTriggerBounds of
862+
Always ->
863+
"These are your packages that depend on " <> depName <> ":"
864+
BoundsOutOfRange ->
865+
"These are your packages that require " <> depName
866+
<> " but don't accept " <> depVersion <> ":"
867+
NewIncompatibility ->
868+
"The following packages require " <> depName
869+
<> " but don't accept " <> depVersion
870+
<> " (they do accept the second-highest version):"
871+
]
871872
++ map display revDeps
872873

873874
sendNotifyEmailAndDelay :: Users.Users -> (UserId, (T.Text, [String])) -> IO ()

0 commit comments

Comments
 (0)