# HG changeset patch # User Thomas De Schampheleire # Date 2018-02-06 22:00:01 # Node ID 2d6ec8b9b633d11f72ccf3063805d962ffcf7bf7 # Parent 67e561f832b23e3d26bbbee2b21a49016add63b2 email templates: reorder references to pullrequests The current references to PRs in email templates are: Pull request from branch to branch : by <user> as the first line can become very long and therefore hard to read, a first step is to introduce a newline before the destination branch: Pull request from <repo> branch <branch> to <repo> branch <branch>: <niceid> <title> by <user> But it would be nicer if the from/to part aligns more. Moreover, the most useful part is (hopefully) the PR title, the from/to is secondary and can sometimes even be inferred from the title and context the recipient is already aware of. Thus, this commit proposes the following format: Pull request <niceid> <title> by <user> from <repo> branch <branch> to <repo> branch <branch> This adds some divergence with the changeset references, which could be aligned later if desired. diff --git a/kallithea/templates/email_templates/pull_request.html b/kallithea/templates/email_templates/pull_request.html --- a/kallithea/templates/email_templates/pull_request.html +++ b/kallithea/templates/email_templates/pull_request.html @@ -9,23 +9,25 @@ <tr> <td> <div> - ${_('Pull request from')} + ${_('Pull request')} + <a style="${link_style}" + href="${pr_url}">${pr_nice_id} "${pr_title}"</a> + ${_('by')} + <span style="${data_style}">${pr_owner.full_name_and_username}</span>. + </div> + <div> + ${_('from')} <a style="${link_text_style}" href="${pr_source_repo}">${pr_source_repo}</a> ${_('branch')} <span style="${data_style}">${pr_source_branch}</span> + <br/> ${_('to')} <a style="${link_text_style}" href="${pr_target_repo}">${pr_target_repo}</a> ${_('branch')} <span style="${data_style}">${pr_target_branch}</span> </div> - <div> - <a style="${link_style}" - href="${pr_url}">${pr_nice_id} "${pr_title}"</a> - ${_('by')} - <span style="${data_style}">${pr_owner.full_name_and_username}</span>. - </div> </td> </tr> <tr><td height="10px" style="height:10px"></td></tr> diff --git a/kallithea/templates/email_templates/pull_request.txt b/kallithea/templates/email_templates/pull_request.txt --- a/kallithea/templates/email_templates/pull_request.txt +++ b/kallithea/templates/email_templates/pull_request.txt @@ -3,18 +3,19 @@ <%include file="header.txt" args="title=title,link=pr_url"/>\ </%block>\ -${_('Pull request from')|n,unicode} \ +${_('Pull request')|n,unicode} \ +${pr_nice_id|n,unicode} \ +"${pr_title|n,unicode}" \ +${_('by')|n,unicode} \ +${pr_owner.full_name_and_username|n,unicode} +${_('from')} \ ${pr_source_repo|n,unicode} \ ${_('branch')|n,unicode} \ -${pr_source_branch|n,unicode} \ +${pr_source_branch|n,unicode} ${_('to')|n,unicode} \ ${pr_target_repo|n,unicode} \ ${_('branch')|n,unicode} \ -${pr_target_branch|n,unicode}: -${pr_nice_id|n,unicode} \ -"${pr_title|n,unicode}" \ -${_('by')|n,unicode} \ -${pr_owner.full_name_and_username|n,unicode}. +${pr_target_branch|n,unicode} ${_('Description')|n,unicode}: diff --git a/kallithea/templates/email_templates/pull_request_comment.html b/kallithea/templates/email_templates/pull_request_comment.html --- a/kallithea/templates/email_templates/pull_request_comment.html +++ b/kallithea/templates/email_templates/pull_request_comment.html @@ -17,23 +17,25 @@ <tr> <td> <div> - ${_('Pull request from')} + ${_('Pull request')} + <a style="${link_style}" + href="${pr_url}">${pr_nice_id} "${pr_title}"</a> + ${_('by')} + <span style="${data_style}">${pr_owner.full_name_and_username}</span>. + </div> + <div> + ${_('from')} <a style="${link_text_style}" href="${pr_source_repo}">${pr_source_repo}</a> ${_('branch')} <span style="${data_style}">${pr_source_branch}</span> + <br/> ${_('to')} <a style="${link_text_style}" href="${pr_target_repo}">${pr_target_repo}</a> ${_('branch')} <span style="${data_style}">${pr_target_branch}</span>: </div> - <div> - <a style="${link_style}" - href="${pr_url}">${pr_nice_id} "${pr_title}"</a> - ${_('by')} - <span style="${data_style}">${pr_owner.full_name_and_username}</span>. - </div> </td> </tr> <tr> diff --git a/kallithea/templates/email_templates/pull_request_comment.txt b/kallithea/templates/email_templates/pull_request_comment.txt --- a/kallithea/templates/email_templates/pull_request_comment.txt +++ b/kallithea/templates/email_templates/pull_request_comment.txt @@ -5,17 +5,18 @@ <%include file="comment.txt" args="text=body,author=pr_comment_user,status=status_change,close=closing_pr"/>\ -${_('Pull request from')|n,unicode} \ +${_('Pull request')|n,unicode} \ +${pr_nice_id|n,unicode} \ +"${pr_title|n,unicode}" \ +${_('by')|n,unicode} \ +${pr_owner.full_name_and_username|n,unicode} +${_('from')} \ ${pr_source_repo|n,unicode} \ ${_('branch')|n,unicode} \ -${pr_source_branch|n,unicode} \ +${pr_source_branch|n,unicode} ${_('to')|n,unicode} \ ${pr_target_repo|n,unicode} \ ${_('branch')|n,unicode} \ -${pr_target_branch|n,unicode}: -${pr_nice_id|n,unicode} \ -"${pr_title|n,unicode}" \ -${_('by')|n,unicode} \ -${pr_owner.full_name_and_username|n,unicode}. +${pr_target_branch|n,unicode} <%include file="button.txt" args="url=pr_comment_url,title=_('View Comment')"/>\ diff --git a/kallithea/tests/models/test_dump_html_mails.ref.html b/kallithea/tests/models/test_dump_html_mails.ref.html --- a/kallithea/tests/models/test_dump_html_mails.ref.html +++ b/kallithea/tests/models/test_dump_html_mails.ref.html @@ -891,8 +891,9 @@ Subject: [Review] repo/name PR #7 "The T Added as Reviewer of Pull Request #7 "The Title" by Requesting User (root) -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk Description: @@ -956,23 +957,25 @@ View Pull Request: http://pr.org/7 <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span> </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr><td height="10px" style="height:10px"></td></tr> @@ -1079,8 +1082,9 @@ Subject: [Review] repo/name PR #7 "The T Mention on Pull Request #7 "The Title" by Requesting User (root) -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk Description: @@ -1144,23 +1148,25 @@ View Pull Request: http://pr.org/7 <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span> </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr><td height="10px" style="height:10px"></td></tr> @@ -1274,8 +1280,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -1362,23 +1369,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr> @@ -1438,8 +1447,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -1526,23 +1536,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr> @@ -1604,8 +1616,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -1708,23 +1721,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr> @@ -1786,8 +1801,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -1890,23 +1906,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr> @@ -1968,8 +1986,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -2071,23 +2090,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr> @@ -2149,8 +2170,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -2252,23 +2274,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr> @@ -2332,8 +2356,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -2439,23 +2464,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr> @@ -2519,8 +2546,9 @@ Me too! - and indented on second line -Pull request from https://dev.org/repo branch devbranch to http://mainline.com/repo branch trunk: -#7 "The Title" by u2 u3 (u2). +Pull request #7 "The Title" by u2 u3 (u2) +from https://dev.org/repo branch devbranch +to http://mainline.com/repo branch trunk View Comment: http://pr.org/comment @@ -2626,23 +2654,25 @@ View Comment: http://pr.org/comment <tr> <td> <div> - Pull request from + Pull request + <a style="color:#395fa0;text-decoration:none" + href="http://pr.org/7">#7 "The Title"</a> + by + <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. + </div> + <div> + from <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="https://dev.org/repo">https://dev.org/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">devbranch</span> + <br/> to <a style="color:#202020;text-decoration:none;border:#ddd 1px solid;background:#f9f9f9" href="http://mainline.com/repo">http://mainline.com/repo</a> branch <span style="border:#ddd 1px solid;background:#f9f9f9">trunk</span>: </div> - <div> - <a style="color:#395fa0;text-decoration:none" - href="http://pr.org/7">#7 "The Title"</a> - by - <span style="border:#ddd 1px solid;background:#f9f9f9">u2 u3 (u2)</span>. - </div> </td> </tr> <tr>