Skip to content

Commit 29d30c9

Browse files
vdberghppigazzini
authored andcommitted
Remove hard coded newlines from the email template.
The email client will do the wrapping.
1 parent 45d0663 commit 29d30c9

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

server/fishtest/views.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,30 @@ def login(request):
146146

147147
def worker_email(worker_name, blocker_name, message, host_url, blocked):
148148
owner_name = worker_name.split("-")[0]
149-
wrapped_message = textwrap.fill(message, width=70)
150149
body = f"""\
151150
Dear {owner_name},
152151
153-
Thank you for contributing to the development of Stockfish. Unfortunately,
154-
it seems your Fishtest worker {worker_name} has some issue(s). More
155-
specifically the following has been reported:
152+
Thank you for contributing to the development of Stockfish. Unfortunately, it seems your Fishtest worker {worker_name} has some issue(s). More specifically the following has been reported:
156153
157-
{wrapped_message}
154+
{message}
158155
159-
You may possibly find more information about this in our event log at
160-
{host_url}/actions
156+
You may possibly find more information about this in our event log at {host_url}/actions
161157
162-
Feel free to reply to this email if you require any help, or else contact
163-
the #fishtest channel on the Stockfish Discord server:
164-
https://discord.com/invite/awnh2qZfTT
158+
Feel free to reply to this email if you require any help, or else contact the #fishtest channel on the Stockfish Discord server: https://discord.com/invite/awnh2qZfTT
165159
166160
Enjoy your day,
167161
168162
{blocker_name} (Fishtest approver)
169163
170164
"""
171-
172165
return body
173166

174167

168+
def normalize_lf(m):
169+
m = m.replace("\r\n", "\n").replace("\r", "\n")
170+
return m.rstrip()
171+
172+
175173
@view_config(route_name="workers", renderer="workers.mak", require_csrf=True)
176174
def workers(request):
177175
is_approver = request.has_permission("approve_run")
@@ -224,6 +222,7 @@ def workers(request):
224222
"error",
225223
)
226224
message = message[:max_chars]
225+
message = normalize_lf(message)
227226
was_blocked = request.workerdb.get_worker(worker_name)["blocked"]
228227
request.rundb.workerdb.update_worker(
229228
worker_name, blocked=blocked, message=message

0 commit comments

Comments
 (0)