Skip to content

Commit 364ffe9

Browse files
brandonchinn178ysangkok
authored andcommitted
Update threadDelay comment, use htmlPart/plainPart
1 parent 3d3f48a commit 364ffe9

13 files changed

+327
-263
lines changed

src/Distribution/Server/Features/UserNotify.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,8 @@ userNotifyFeature serverEnv@ServerEnv{serverCron}
858858
-- TODO: if we need any configuration of sendmail stuff, has to go here
859859
renderSendMail email
860860

861-
-- delay sending out emails, because ???
861+
-- delay sending out emails, to avoid spamming people if we accidentally
862+
-- send out too many emails
862863
threadDelay 250000
863864

864865
data Notification

src/Distribution/Server/Util/Email.hs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,9 @@ emailContentUrl uri = EmailContentLink (uriToText uri) uri
6868

6969
fromEmailContent :: EmailContent -> Alternatives
7070
fromEmailContent emailContent =
71-
[ Part
72-
{ partType = contentType <> "; charset=utf-8"
73-
, partEncoding = None
74-
, partDisposition = DefaultDisposition
75-
, partHeaders = []
76-
, partContent = PartContent $ TextL.encodeUtf8 $ TextL.fromStrict content
77-
}
78-
| (contentType, content) <- contents
71+
[ plainPart $ TextL.fromStrict $ toPlainContent emailContent
72+
, htmlPart $ TextL.fromStrict $ toHtmlContent emailContent
7973
]
80-
where
81-
contents =
82-
[ ("text/plain", toPlainContent emailContent)
83-
, ("text/html", toHtmlContent emailContent)
84-
]
8574

8675
-- | Convert an 'EmailContent' to plain text.
8776
--

tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDependencyUpdate-Always.golden

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,46 @@ Content-Type: multipart/alternative; boundary="YIYrWcf3to"
66

77
--YIYrWcf3to
88
Content-Type: text/plain; charset=utf-8
9-
10-
The dependency base-4.18.0.0 (https://hackage.haskell.org/package/base-4.18.0.0) has been uploaded or revised.
11-
12-
You have requested to be notified for each upload or revision of a dependency.
13-
14-
These are your packages that depend on base:
15-
16-
* mtl-2.3 (https://hackage.haskell.org/package/mtl-2.3)
17-
18-
You can adjust your notification preferences at
19-
https://hackage.haskell.org/user/user-watcher/notify (https://hackage.haskell.org/user/user-watcher/notify)
20-
9+
Content-Transfer-Encoding: quoted-printable
10+
11+
The dependency base-4=2E18=2E0=2E0 (https://hackage=2Ehaskell=2Eorg/package=
12+
/base-4=2E18=2E0=2E0) has been uploaded or revised=2E
13+
14+
You have requested to be notified for each upload or revision of a dependen=
15+
cy=2E
16+
17+
These are your packages that depend on base:
18+
19+
* mtl-2=2E3 (https://hackage=2Ehaskell=2Eorg/package/mtl-2=2E3)
20+
21+
You can adjust your notification preferences at
22+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify (https://hackage=
23+
=2Ehaskell=2Eorg/user/user-watcher/notify)
24+
2125

2226
--YIYrWcf3to
2327
Content-Type: text/html; charset=utf-8
24-
25-
26-
<p>
27-
The dependency <a href="https://hackage.haskell.org/package/base-4.18.0.0">base-4.18.0.0</a> has been uploaded or revised.
28-
</p>
29-
<p>
30-
You have requested to be notified for each upload or revision of a dependency.
31-
</p>
32-
<p>
33-
These are your packages that depend on base:
34-
</p>
35-
<ul>
36-
<li><a href="https://hackage.haskell.org/package/mtl-2.3">mtl-2.3</a></li>
37-
</ul>
38-
<p>
39-
You can adjust your notification preferences at
40-
<br /><a href="https://hackage.haskell.org/user/user-watcher/notify">https://hackage.haskell.org/user/user-watcher/notify</a>
28+
Content-Transfer-Encoding: quoted-printable
29+
30+
31+
<p>
32+
The dependency <a href=3D"https://hackage=2Ehaskell=2Eorg/package/base-4=2E=
33+
18=2E0=2E0">base-4=2E18=2E0=2E0</a> has been uploaded or revised=2E
34+
</p>
35+
<p>
36+
You have requested to be notified for each upload or revision of a dependen=
37+
cy=2E
38+
</p>
39+
<p>
40+
These are your packages that depend on base:
41+
</p>
42+
<ul>
43+
<li><a href=3D"https://hackage=2Ehaskell=2Eorg/package/mtl-2=2E3">mtl-2=
44+
=2E3</a></li>
45+
</ul>
46+
<p>
47+
You can adjust your notification preferences at
48+
<br /><a href=3D"https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify">=
49+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify</a>
4150
</p>
4251
--YIYrWcf3to--

tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDependencyUpdate-BoundsOutOfRange.golden

Lines changed: 38 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,46 @@ Content-Type: multipart/alternative; boundary="YIYrWcf3to"
66

77
--YIYrWcf3to
88
Content-Type: text/plain; charset=utf-8
9-
10-
The dependency base-4.18.0.0 (https://hackage.haskell.org/package/base-4.18.0.0) has been uploaded or revised.
11-
12-
You have requested to be notified when a dependency isn't accepted by any of your maintained packages.
13-
14-
These are your packages that require base but don't accept 4.18.0.0:
15-
16-
* mtl-2.3 (https://hackage.haskell.org/package/mtl-2.3)
17-
18-
You can adjust your notification preferences at
19-
https://hackage.haskell.org/user/user-watcher/notify (https://hackage.haskell.org/user/user-watcher/notify)
20-
9+
Content-Transfer-Encoding: quoted-printable
10+
11+
The dependency base-4=2E18=2E0=2E0 (https://hackage=2Ehaskell=2Eorg/package=
12+
/base-4=2E18=2E0=2E0) has been uploaded or revised=2E
13+
14+
You have requested to be notified when a dependency isn't accepted by any o=
15+
f your maintained packages=2E
16+
17+
These are your packages that require base but don't accept 4=2E18=2E0=2E0:
18+
19+
* mtl-2=2E3 (https://hackage=2Ehaskell=2Eorg/package/mtl-2=2E3)
20+
21+
You can adjust your notification preferences at
22+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify (https://hackage=
23+
=2Ehaskell=2Eorg/user/user-watcher/notify)
24+
2125

2226
--YIYrWcf3to
2327
Content-Type: text/html; charset=utf-8
24-
25-
26-
<p>
27-
The dependency <a href="https://hackage.haskell.org/package/base-4.18.0.0">base-4.18.0.0</a> has been uploaded or revised.
28-
</p>
29-
<p>
30-
You have requested to be notified when a dependency isn't accepted by any of your maintained packages.
31-
</p>
32-
<p>
33-
These are your packages that require base but don't accept 4.18.0.0:
34-
</p>
35-
<ul>
36-
<li><a href="https://hackage.haskell.org/package/mtl-2.3">mtl-2.3</a></li>
37-
</ul>
38-
<p>
39-
You can adjust your notification preferences at
40-
<br /><a href="https://hackage.haskell.org/user/user-watcher/notify">https://hackage.haskell.org/user/user-watcher/notify</a>
28+
Content-Transfer-Encoding: quoted-printable
29+
30+
31+
<p>
32+
The dependency <a href=3D"https://hackage=2Ehaskell=2Eorg/package/base-4=2E=
33+
18=2E0=2E0">base-4=2E18=2E0=2E0</a> has been uploaded or revised=2E
34+
</p>
35+
<p>
36+
You have requested to be notified when a dependency isn't accepted by any o=
37+
f your maintained packages=2E
38+
</p>
39+
<p>
40+
These are your packages that require base but don't accept 4=2E18=2E0=2E0:
41+
</p>
42+
<ul>
43+
<li><a href=3D"https://hackage=2Ehaskell=2Eorg/package/mtl-2=2E3">mtl-2=
44+
=2E3</a></li>
45+
</ul>
46+
<p>
47+
You can adjust your notification preferences at
48+
<br /><a href=3D"https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify">=
49+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify</a>
4150
</p>
4251
--YIYrWcf3to--

tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDependencyUpdate-NewIncompatibility.golden

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,48 @@ Content-Type: multipart/alternative; boundary="YIYrWcf3to"
66

77
--YIYrWcf3to
88
Content-Type: text/plain; charset=utf-8
9-
10-
The dependency base-4.18.0.0 (https://hackage.haskell.org/package/base-4.18.0.0) has been uploaded or revised.
11-
12-
You have requested to be notified when a dependency isn't accepted by any of your maintained packages.
13-
14-
The following packages require base but don't accept 4.18.0.0 (they do accept the second-highest version):
15-
16-
* mtl-2.3 (https://hackage.haskell.org/package/mtl-2.3)
17-
18-
You can adjust your notification preferences at
19-
https://hackage.haskell.org/user/user-watcher/notify (https://hackage.haskell.org/user/user-watcher/notify)
20-
9+
Content-Transfer-Encoding: quoted-printable
10+
11+
The dependency base-4=2E18=2E0=2E0 (https://hackage=2Ehaskell=2Eorg/package=
12+
/base-4=2E18=2E0=2E0) has been uploaded or revised=2E
13+
14+
You have requested to be notified when a dependency isn't accepted by any o=
15+
f your maintained packages=2E
16+
17+
The following packages require base but don't accept 4=2E18=2E0=2E0 (they d=
18+
o accept the second-highest version):
19+
20+
* mtl-2=2E3 (https://hackage=2Ehaskell=2Eorg/package/mtl-2=2E3)
21+
22+
You can adjust your notification preferences at
23+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify (https://hackage=
24+
=2Ehaskell=2Eorg/user/user-watcher/notify)
25+
2126

2227
--YIYrWcf3to
2328
Content-Type: text/html; charset=utf-8
24-
25-
26-
<p>
27-
The dependency <a href="https://hackage.haskell.org/package/base-4.18.0.0">base-4.18.0.0</a> has been uploaded or revised.
28-
</p>
29-
<p>
30-
You have requested to be notified when a dependency isn't accepted by any of your maintained packages.
31-
</p>
32-
<p>
33-
The following packages require base but don't accept 4.18.0.0 (they do accept the second-highest version):
34-
</p>
35-
<ul>
36-
<li><a href="https://hackage.haskell.org/package/mtl-2.3">mtl-2.3</a></li>
37-
</ul>
38-
<p>
39-
You can adjust your notification preferences at
40-
<br /><a href="https://hackage.haskell.org/user/user-watcher/notify">https://hackage.haskell.org/user/user-watcher/notify</a>
29+
Content-Transfer-Encoding: quoted-printable
30+
31+
32+
<p>
33+
The dependency <a href=3D"https://hackage=2Ehaskell=2Eorg/package/base-4=2E=
34+
18=2E0=2E0">base-4=2E18=2E0=2E0</a> has been uploaded or revised=2E
35+
</p>
36+
<p>
37+
You have requested to be notified when a dependency isn't accepted by any o=
38+
f your maintained packages=2E
39+
</p>
40+
<p>
41+
The following packages require base but don't accept 4=2E18=2E0=2E0 (they d=
42+
o accept the second-highest version):
43+
</p>
44+
<ul>
45+
<li><a href=3D"https://hackage=2Ehaskell=2Eorg/package/mtl-2=2E3">mtl-2=
46+
=2E3</a></li>
47+
</ul>
48+
<p>
49+
You can adjust your notification preferences at
50+
<br /><a href=3D"https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify">=
51+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify</a>
4152
</p>
4253
--YIYrWcf3to--

tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDocsBuild-failure.golden

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,30 @@ Content-Type: multipart/alternative; boundary="YIYrWcf3to"
66

77
--YIYrWcf3to
88
Content-Type: text/plain; charset=utf-8
9+
Content-Transfer-Encoding: quoted-printable
910

10-
Package doc build for base-4.18.0.0 (https://hackage.haskell.org/package/base-4.18.0.0):
11-
Build failed.
12-
13-
You can adjust your notification preferences at
14-
https://hackage.haskell.org/user/user-watcher/notify (https://hackage.haskell.org/user/user-watcher/notify)
15-
11+
Package doc build for base-4=2E18=2E0=2E0 (https://hackage=2Ehaskell=2Eorg/=
12+
package/base-4=2E18=2E0=2E0):
13+
Build failed=2E
14+
15+
You can adjust your notification preferences at
16+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify (https://hackage=
17+
=2Ehaskell=2Eorg/user/user-watcher/notify)
18+
1619

1720
--YIYrWcf3to
1821
Content-Type: text/html; charset=utf-8
22+
Content-Transfer-Encoding: quoted-printable
1923

20-
21-
<p>
22-
Package doc build for <a href="https://hackage.haskell.org/package/base-4.18.0.0">base-4.18.0.0</a>:
23-
<br />Build failed.
24-
</p>
25-
<p>
26-
You can adjust your notification preferences at
27-
<br /><a href="https://hackage.haskell.org/user/user-watcher/notify">https://hackage.haskell.org/user/user-watcher/notify</a>
24+
25+
<p>
26+
Package doc build for <a href=3D"https://hackage=2Ehaskell=2Eorg/package/ba=
27+
se-4=2E18=2E0=2E0">base-4=2E18=2E0=2E0</a>:
28+
<br />Build failed=2E
29+
</p>
30+
<p>
31+
You can adjust your notification preferences at
32+
<br /><a href=3D"https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify">=
33+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify</a>
2834
</p>
2935
--YIYrWcf3to--

tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDocsBuild-success.golden

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,30 @@ Content-Type: multipart/alternative; boundary="YIYrWcf3to"
66

77
--YIYrWcf3to
88
Content-Type: text/plain; charset=utf-8
9+
Content-Transfer-Encoding: quoted-printable
910

10-
Package doc build for base-4.18.0.0 (https://hackage.haskell.org/package/base-4.18.0.0):
11-
Build successful.
12-
13-
You can adjust your notification preferences at
14-
https://hackage.haskell.org/user/user-watcher/notify (https://hackage.haskell.org/user/user-watcher/notify)
15-
11+
Package doc build for base-4=2E18=2E0=2E0 (https://hackage=2Ehaskell=2Eorg/=
12+
package/base-4=2E18=2E0=2E0):
13+
Build successful=2E
14+
15+
You can adjust your notification preferences at
16+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify (https://hackage=
17+
=2Ehaskell=2Eorg/user/user-watcher/notify)
18+
1619

1720
--YIYrWcf3to
1821
Content-Type: text/html; charset=utf-8
22+
Content-Transfer-Encoding: quoted-printable
1923

20-
21-
<p>
22-
Package doc build for <a href="https://hackage.haskell.org/package/base-4.18.0.0">base-4.18.0.0</a>:
23-
<br />Build successful.
24-
</p>
25-
<p>
26-
You can adjust your notification preferences at
27-
<br /><a href="https://hackage.haskell.org/user/user-watcher/notify">https://hackage.haskell.org/user/user-watcher/notify</a>
24+
25+
<p>
26+
Package doc build for <a href=3D"https://hackage=2Ehaskell=2Eorg/package/ba=
27+
se-4=2E18=2E0=2E0">base-4=2E18=2E0=2E0</a>:
28+
<br />Build successful=2E
29+
</p>
30+
<p>
31+
You can adjust your notification preferences at
32+
<br /><a href=3D"https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify">=
33+
https://hackage=2Ehaskell=2Eorg/user/user-watcher/notify</a>
2834
</p>
2935
--YIYrWcf3to--

0 commit comments

Comments
 (0)