## -*- coding: utf-8 -*- <%inherit file="base.mako"/> <%namespace name="base" file="base.mako"/> ## EMAIL SUBJECT <%def name="subject()" filter="n,trim,whitespace_filter"> <% data = { 'user': '@'+h.person(user), 'repo_name': repo_name, 'status': status_change, 'comment_file': comment_file, 'comment_line': comment_line, 'comment_type': comment_type, 'comment_id': comment_id, 'pr_title': pull_request.title, 'pr_id': pull_request.pull_request_id, 'mention_prefix': '[mention] ' if mention else '', } if comment_file: subject_template = email_pr_comment_file_subject_template or \ _('{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in pull request !{pr_id}: "{pr_title}"').format(**data) else: if status_change: subject_template = email_pr_comment_status_change_subject_template or \ _('{mention_prefix}[status: {status}] {user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) else: subject_template = email_pr_comment_subject_template or \ _('{mention_prefix}{user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) %> ${subject_template.format(**data) |n} ## PLAINTEXT VERSION OF BODY <%def name="body_plaintext()" filter="n,trim"> <% data = { 'user': h.person(user), 'repo_name': repo_name, 'status': status_change, 'comment_file': comment_file, 'comment_line': comment_line, 'comment_type': comment_type, 'comment_id': comment_id, 'pr_title': pull_request.title, 'pr_id': pull_request.pull_request_id, 'source_ref_type': pull_request.source_ref_parts.type, 'source_ref_name': pull_request.source_ref_parts.name, 'target_ref_type': pull_request.target_ref_parts.type, 'target_ref_name': pull_request.target_ref_parts.name, 'source_repo': pull_request_source_repo.repo_name, 'target_repo': pull_request_target_repo.repo_name, 'source_repo_url': pull_request_source_repo_url, 'target_repo_url': pull_request_target_repo_url, } %> * ${_('Comment link')}: ${pr_comment_url} * ${_('Pull Request')}: !${pull_request.pull_request_id} * ${h.literal(_('Commit flow: {source_ref_type}:{source_ref_name} of {source_repo_url} into {target_ref_type}:{target_ref_name} of {target_repo_url}').format(**data))} %if status_change and not closing_pr: * ${_('{user} submitted pull request !{pr_id} status: *{status}*').format(**data)} %elif status_change and closing_pr: * ${_('{user} submitted pull request !{pr_id} status: *{status} and closed*').format(**data)} %endif %if comment_file: * ${_('File: {comment_file} on line {comment_line}').format(**data)} %endif % if comment_type == 'todo': ${('Inline' if comment_file else 'General')} ${_('`TODO` number')} ${comment_id}: % else: ${('Inline' if comment_file else 'General')} ${_('`Note` number')} ${comment_id}: % endif ${comment_body |n, trim} --- ${self.plaintext_footer()} <% data = { 'user': h.person(user), 'comment_file': comment_file, 'comment_line': comment_line, 'comment_type': comment_type, 'comment_id': comment_id, 'renderer_type': renderer_type or 'plain', 'pr_title': pull_request.title, 'pr_id': pull_request.pull_request_id, 'status': status_change, 'source_ref_type': pull_request.source_ref_parts.type, 'source_ref_name': pull_request.source_ref_parts.name, 'target_ref_type': pull_request.target_ref_parts.type, 'target_ref_name': pull_request.target_ref_parts.name, 'source_repo': pull_request_source_repo.repo_name, 'target_repo': pull_request_target_repo.repo_name, 'source_repo_url': h.link_to(pull_request_source_repo.repo_name, pull_request_source_repo_url), 'target_repo_url': h.link_to(pull_request_target_repo.repo_name, pull_request_target_repo_url), } %> ## header
${_('Pull request')} !${data['pr_id']}: ${data['pr_title']}
## main body ## spacing def % if status_change: % endif % if comment_file: % endif
${_('Review Status')}: % if closing_pr: ${_('Closed pull request with status')}: ${base.status_text(status_change, tag_type=status_change_type)} % else: ${_('Submitted review status')}: ${base.status_text(status_change, tag_type=status_change_type)} % endif
${_('Pull request')}: !${pull_request.pull_request_id}
${_('Commit Flow')}: ${'{}:{}'.format(data['source_ref_type'], pull_request.source_ref_parts.name)} ${_('of')} ${data['source_repo_url']} → ${'{}:{}'.format(data['target_ref_type'], pull_request.target_ref_parts.name)} ${_('of')} ${data['target_repo_url']}
${_('File')}: ${_('`{comment_file}` on line {comment_line}').format(**data)}
% if comment_type == 'todo': ${('Inline' if comment_file else 'General')} ${_('`TODO` number')} ${comment_id}: % else: ${('Inline' if comment_file else 'General')} ${_('`Note` number')} ${comment_id}: % endif
${h.render(comment_body, renderer=data['renderer_type'], mentions=True)}
${_('Reply')}