diff --git a/rhodecode/apps/repository/tests/test_repo_commit_comments.py b/rhodecode/apps/repository/tests/test_repo_commit_comments.py --- a/rhodecode/apps/repository/tests/test_repo_commit_comments.py +++ b/rhodecode/apps/repository/tests/test_repo_commit_comments.py @@ -97,9 +97,10 @@ class TestRepoCommitCommentsView(TestCon comment_id = ChangesetComment.query().first().comment_id assert notification.type_ == Notification.TYPE_CHANGESET_COMMENT - sbj = 'left {0} on commit `{1}` in the {2} repository'.format( - comment_type, h.show_id(commit), backend.repo_name) - assert sbj in notification.subject + author = notification.created_by_user.username_and_name + sbj = '{0} left a {1} on commit `{2}` in the {3} repository'.format( + author, comment_type, h.show_id(commit), backend.repo_name) + assert sbj == notification.subject lnk = (u'/{0}/changeset/{1}#comment-{2}'.format( backend.repo_name, commit_id, comment_id)) @@ -150,12 +151,12 @@ class TestRepoCommitCommentsView(TestCon assert notification.type_ == Notification.TYPE_CHANGESET_COMMENT assert comment.revision == commit_id - sbj = 'left {comment_type} on commit `{commit}` ' \ - '(file: `{f_path}`) in the {repo} repository'.format( - commit=h.show_id(commit), - f_path=f_path, line=line, repo=backend.repo_name, - comment_type=comment_type) - assert sbj in notification.subject + + author = notification.created_by_user.username_and_name + sbj = '{0} left a {1} on file `{2}` in commit `{3}` in the {4} repository'.format( + author, comment_type, f_path, h.show_id(commit), backend.repo_name) + + assert sbj == notification.subject lnk = (u'/{0}/changeset/{1}#comment-{2}'.format( backend.repo_name, commit_id, comment.comment_id)) @@ -222,10 +223,10 @@ class TestRepoCommitCommentsView(TestCon comment_id = ChangesetComment.query().first().comment_id assert notification.type_ == Notification.TYPE_CHANGESET_COMMENT - sbj = 'left note on commit `{0}` (status: Approved) ' \ - 'in the {1} repository'.format( - h.show_id(commit), backend.repo_name) - assert sbj in notification.subject + author = notification.created_by_user.username_and_name + sbj = '[status: Approved] {0} left a note on commit `{1}` in the {2} repository'.format( + author, h.show_id(commit), backend.repo_name) + assert sbj == notification.subject lnk = (u'/{0}/changeset/{1}#comment-{2}'.format( backend.repo_name, commit_id, comment_id)) @@ -283,7 +284,7 @@ class TestRepoCommitCommentsView(TestCon commit_id = '0' * 16 # fake this for tests response = self.app.post( route_path('repo_commit_comment_preview', - repo_name=backend.repo_name, commit_id=commit_id,), + repo_name=backend.repo_name, commit_id=commit_id,), params=params, extra_environ=xhr_header) diff --git a/rhodecode/templates/email_templates/commit_comment.mako b/rhodecode/templates/email_templates/commit_comment.mako --- a/rhodecode/templates/email_templates/commit_comment.mako +++ b/rhodecode/templates/email_templates/commit_comment.mako @@ -18,12 +18,12 @@ data = { ${_('[mention]') if mention else ''} \ % if comment_file: - ${_('%(user)s left %(comment_type)s on commit `%(commit_id)s` (file: `%(comment_file)s`)') % data} ${_('in the %(repo_name)s repository') % data |n} + ${_('{user} left a {comment_type} on file `{comment_file}` in commit `{commit_id}`').format(**data)} ${_('in the {repo_name} repository').format(**data) |n} % else: % if status_change: - ${_('%(user)s left %(comment_type)s on commit `%(commit_id)s` (status: %(status)s)') % data |n} ${_('in the %(repo_name)s repository') % data |n} + ${_('[status: {status}] {user} left a {comment_type} on commit `{commit_id}`').format(**data) |n} ${_('in the {repo_name} repository').format(**data) |n} % else: - ${_('%(user)s left %(comment_type)s on commit `%(commit_id)s`') % data |n} ${_('in the %(repo_name)s repository') % data |n} + ${_('{user} left a {comment_type} on commit `{commit_id}`').format(**data) |n} ${_('in the {repo_name} repository').format(**data) |n} % endif % endif @@ -49,7 +49,7 @@ data = { * ${_('Commit')}: ${h.show_id(commit)} %if comment_file: -* ${_('File: %(comment_file)s on line %(comment_line)s') % data} +* ${_('File: {comment_file} on line {comment_line}').format(**data)} %endif --- @@ -79,9 +79,9 @@ data = { % if comment_file: -

${_('%(user)s commented on commit `%(commit_id)s` (file:`%(comment_file)s`)') % data} ${_('in the %(repo)s repository') % data |n}

+

${_('{user} left a {comment_type} on file `{comment_file}` in commit `{commit_id}`').format(**data)} ${_('in the {repo} repository').format(**data) |n}

% else: -

${_('%(user)s commented on commit `%(commit_id)s`') % data |n} ${_('in the %(repo)s repository') % data |n}

+

${_('{user} left a {comment_type} on commit `{commit_id}`').format(**data) |n} ${_('in the {repo} repository').format(**data) |n}

% endif @@ -89,16 +89,19 @@ data = { ${_('Description')}${h.urlify_commit_message(commit.message, repo_name)} % if status_change: - ${_('Status')} - ${_('The commit status was changed to')}: ${base.status_text(status_change, tag_type=status_change_type)} + + ${_('Status')} + + ${_('The commit status was changed to')}: ${base.status_text(status_change, tag_type=status_change_type)} + % endif % if comment_type == 'todo': - ${(_('TODO comment on line: %(comment_line)s') if comment_file else _('TODO comment')) % data} + ${(_('TODO comment on line: {comment_line}') if comment_file else _('TODO comment')).format(**data)} % else: - ${(_('Note comment on line: %(comment_line)s') if comment_file else _('Note comment')) % data} + ${(_('Note comment on line: {comment_line}') if comment_file else _('Note comment')).format(**data)} % endif ${h.render(comment_body, renderer=renderer_type, mentions=True)} diff --git a/rhodecode/templates/email_templates/pull_request_comment.mako b/rhodecode/templates/email_templates/pull_request_comment.mako --- a/rhodecode/templates/email_templates/pull_request_comment.mako +++ b/rhodecode/templates/email_templates/pull_request_comment.mako @@ -16,15 +16,15 @@ data = { } %> -${_('[mention]') if mention else ''} \ +${(_('[mention]') if mention else '')} \ % if comment_file: - ${_('%(user)s left %(comment_type)s on pull request #%(pr_id)s "%(pr_title)s" (file: `%(comment_file)s`)') % data |n} + ${_('{user} left a {comment_type} on file `{comment_file}` in pull request #{pr_id} "{pr_title}"').format(**data) |n} % else: % if status_change: - ${_('%(user)s left %(comment_type)s on pull request #%(pr_id)s "%(pr_title)s" (status: %(status)s)') % data |n} + ${_('[status: {status}] {user} left a {comment_type} on pull request #{pr_id} "{pr_title}"').format(**data) |n} % else: - ${_('%(user)s left %(comment_type)s on pull request #%(pr_id)s "%(pr_title)s"') % data |n} + ${_('{user} left a {comment_type} on pull request #{pr_id} "{pr_title}"').format(**data) |n} % endif % endif @@ -49,18 +49,18 @@ data = { * ${_('Source repository')}: ${pr_source_repo_url} %if comment_file: -* ${_('File: %(comment_file)s on line %(comment_line)s') % {'comment_file': comment_file, 'comment_line': comment_line}} +* ${_('File: {comment_file} on line {comment_line}').format(comment_file=comment_file, comment_line=comment_line)} %endif --- %if status_change and not closing_pr: - ${_('%(user)s submitted pull request #%(pr_id)s status: *%(status)s*') % data} + ${_('{user} submitted pull request #{pr_id} status: *{status}*').format(**data)} %elif status_change and closing_pr: - ${_('%(user)s submitted pull request #%(pr_id)s status: *%(status)s and closed*') % data} + ${_('{user} submitted pull request #{pr_id} status: *{status} and closed*').format(**data)} %endif -${comment_body|n} +${comment_body |n} ${self.plaintext_footer()} @@ -81,9 +81,9 @@ data = { % if comment_file: -

${_('%(user)s commented on pull request #%(pr_id)s "%(pr_title)s" (file:`%(comment_file)s`)') % data |n}

+

${_('{user} left a {comment_type} on file `{comment_file}` in pull request #{pr_id} "{pr_title}"').format(**data) |n}

% else: -

${_('%(user)s commented on pull request #%(pr_id)s "%(pr_title)s"') % data |n}

+

${_('{user} left a {comment_type} on pull request #{pr_id} "{pr_title}"').format(**data) |n}

% endif @@ -104,9 +104,9 @@ data = { % if comment_type == 'todo': - ${(_('TODO comment on line: %(comment_line)s') if comment_file else _('TODO comment')) % data} + ${(_('TODO comment on line: {comment_line}') if comment_file else _('TODO comment')).format(**data)} % else: - ${(_('Note comment on line: %(comment_line)s') if comment_file else _('Note comment')) % data} + ${(_('Note comment on line: {comment_line}') if comment_file else _('Note comment')).format(**data)} % endif ${h.render(comment_body, renderer=renderer_type, mentions=True)}