# HG changeset patch # User Thomas De Schampheleire # Date 2018-02-06 21:28:13 # Node ID 51906236eed3fcfbb6c06f997f4632f0c291b8ef # Parent 3a3d9c8432edd715c4cf8d295723b043f25e1267 HTML email templates: restrict amount of visible hyperlinks Users report that some HTML email templates are confusing due to the large number of hyperlinks in them. They typically click the first thing they see that looks clickable without actually reading what they are clicking on, expecting that it all points to the same thing. In pullrequest invitations, the pullrequest and changeset URLs should be clickable, but the source and target repository should not: this is not what you typically want to see when taking action on this mail. Similarly in comment emails, the corresponding repository should not be clickable. Unfortunately, even if we remove the hyperlink tags on these repository URLs, most mail clients will still recognize the text as being URLs and make them clickable anyway. Worse, they will do so in a different styling than the other links. Therefore, do add tags in the HTML, but make use of styling like that of data_style, i.e. regular text color, grey background with dark grey border. The links _will_ thus be clickable but it will not be as inviting as before, thus removing confusion. diff --git a/kallithea/model/notification.py b/kallithea/model/notification.py --- a/kallithea/model/notification.py +++ b/kallithea/model/notification.py @@ -341,6 +341,7 @@ class EmailNotificationModel(object): "data_style": "border:%(color_border)s 1px solid;background:%(color_background_grey)s" % _kwargs, "emph_style": "font-weight:600;color:%(color_emph)s" % _kwargs, "link_style": "color:%(color_link)s;text-decoration:none" % _kwargs, + "link_text_style": "color:%(color_text)s;text-decoration:none;border:%(color_border)s 1px solid;background:%(color_background_grey)s" % _kwargs, }) log.debug('rendering tmpl %s with kwargs %s', base, _kwargs) diff --git a/kallithea/templates/email_templates/changeset_comment.html b/kallithea/templates/email_templates/changeset_comment.html --- a/kallithea/templates/email_templates/changeset_comment.html +++ b/kallithea/templates/email_templates/changeset_comment.html @@ -18,7 +18,7 @@
${_('Changeset on')} - ${cs_target_repo} ${_('branch')} ${branch}: 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 @@ -10,12 +10,12 @@
${_('Pull request from')} - ${pr_source_repo} ${_('at')} ${pr_source_branch} ${_('to')} - ${pr_target_repo} ${_('at')} ${pr_target_branch} 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 @@ -18,12 +18,12 @@
${_('Pull request from')} - ${pr_source_repo} ${_('branch')} ${pr_source_branch} ${_('to')} - ${pr_target_repo} ${_('branch')} ${pr_target_branch}: 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 @@ -111,7 +111,7 @@ View Comment: http://comment.org
Changeset on - http://example.com/repo_target branch brunch: @@ -270,7 +270,7 @@ View Comment: http://comment.org
Changeset on - http://example.com/repo_target branch brunch: @@ -447,7 +447,7 @@ View Comment: http://comment.org
Changeset on - http://example.com/repo_target branch brunch: @@ -624,7 +624,7 @@ View Comment: http://comment.org
Changeset on - http://example.com/repo_target branch brunch: @@ -957,12 +957,12 @@ View Pull Request: http://pr.org/7
Pull request from - https://dev.org/repo at devbranch to - http://mainline.com/repo at trunk @@ -1146,12 +1146,12 @@ View Pull Request: http://pr.org/7
Pull request from - https://dev.org/repo at devbranch to - http://mainline.com/repo at trunk @@ -1365,12 +1365,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: @@ -1530,12 +1530,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: @@ -1713,12 +1713,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: @@ -1896,12 +1896,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: @@ -2078,12 +2078,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: @@ -2260,12 +2260,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: @@ -2448,12 +2448,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: @@ -2636,12 +2636,12 @@ View Comment: http://pr.org/comment
Pull request from - https://dev.org/repo branch devbranch to - http://mainline.com/repo branch trunk: