diff --git a/rhodecode/api/views/pull_request_api.py b/rhodecode/api/views/pull_request_api.py --- a/rhodecode/api/views/pull_request_api.py +++ b/rhodecode/api/views/pull_request_api.py @@ -408,6 +408,8 @@ def comment_pull_request(request, apiuse line_no=None, status_change=(ChangesetStatus.get_status_lbl(status) if status and allowed_to_change_status else None), + status_change_type=(status + if status and allowed_to_change_status else None), closing_pr=False, renderer=renderer ) diff --git a/rhodecode/api/views/repo_api.py b/rhodecode/api/views/repo_api.py --- a/rhodecode/api/views/repo_api.py +++ b/rhodecode/api/views/repo_api.py @@ -1363,9 +1363,11 @@ def comment_commit( try: rc_config = SettingsModel().get_all_settings() renderer = rc_config.get('rhodecode_markup_renderer', 'rst') - + status_change_label = ChangesetStatus.get_status_lbl(status) comm = ChangesetCommentsModel().create( - message, repo, user, revision=commit_id, status_change=status, + message, repo, user, revision=commit_id, + status_change=status_change_label, + status_change_type=status, renderer=renderer) if status: # also do a status change diff --git a/rhodecode/controllers/changeset.py b/rhodecode/controllers/changeset.py --- a/rhodecode/controllers/changeset.py +++ b/rhodecode/controllers/changeset.py @@ -351,7 +351,8 @@ class ChangesetController(BaseRepoContro f_path=request.POST.get('f_path'), line_no=request.POST.get('line'), status_change=(ChangesetStatus.get_status_lbl(status) - if status else None) + if status else None), + status_change_type=status ) # get status if set ! if status: diff --git a/rhodecode/controllers/pullrequests.py b/rhodecode/controllers/pullrequests.py --- a/rhodecode/controllers/pullrequests.py +++ b/rhodecode/controllers/pullrequests.py @@ -762,6 +762,8 @@ class PullrequestsController(BaseRepoCon line_no=request.POST.get('line'), status_change=(ChangesetStatus.get_status_lbl(status) if status and allowed_to_change_status else None), + status_change_type=(status + if status and allowed_to_change_status else None), closing_pr=close_pr ) diff --git a/rhodecode/model/comment.py b/rhodecode/model/comment.py --- a/rhodecode/model/comment.py +++ b/rhodecode/model/comment.py @@ -82,7 +82,8 @@ class ChangesetCommentsModel(BaseModel): return global_renderer def create(self, text, repo, user, revision=None, pull_request=None, - f_path=None, line_no=None, status_change=None, closing_pr=False, + f_path=None, line_no=None, status_change=None, + status_change_type=None, closing_pr=False, send_email=True, renderer=None): """ Creates new comment for commit or pull request. @@ -96,7 +97,8 @@ class ChangesetCommentsModel(BaseModel): :param pull_request: :param f_path: :param line_no: - :param status_change: + :param status_change: Label for status change + :param status_change_type: type of status change :param closing_pr: :param send_email: """ @@ -144,6 +146,7 @@ class ChangesetCommentsModel(BaseModel): 'renderer_type': renderer, 'repo_name': repo.repo_name, 'status_change': status_change, + 'status_change_type': status_change_type, 'comment_body': text, 'comment_file': f_path, 'comment_line': line_no, diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -854,6 +854,7 @@ class PullRequestModel(BaseModel): f_path=None, line_no=None, status_change=ChangesetStatus.get_status_lbl(status), + status_change_type=status, closing_pr=True ) diff --git a/rhodecode/templates/email_templates/base.mako b/rhodecode/templates/email_templates/base.mako --- a/rhodecode/templates/email_templates/base.mako +++ b/rhodecode/templates/email_templates/base.mako @@ -1,5 +1,30 @@ ## -*- coding: utf-8 -*- +## helpers +<%def name="tag_button(text, tag_type=None)"> + <% + color_scheme = { + 'default': 'border:1px solid #979797;color:#666666;background-color:#f9f9f9', + 'approved': 'border:1px solid #0ac878;color:#0ac878;background-color:#f9f9f9', + 'rejected': 'border:1px solid #e85e4d;color:#e85e4d;background-color:#f9f9f9', + 'under_review': 'border:1px solid #ffc854;color:#ffc854;background-color:#f9f9f9', + } + %> +
${text}+%def> + +<%def name="status_text(text, tag_type=None)"> + <% + color_scheme = { + 'default': 'color:#666666', + 'approved': 'color:#0ac878', + 'rejected': 'color:#e85e4d', + 'under_review': 'color:#ffc854', + } + %> + ${text} +%def> + ## headers we additionally can set for email <%def name="headers()" filter="n,trim">%def> 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 @@ -1,6 +1,6 @@ ## -*- coding: utf-8 -*- <%inherit file="base.mako"/> - +<%namespace name="base" file="base.mako"/> <%def name="subject()" filter="n,trim"> <% @@ -82,7 +82,7 @@ data = {
${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s".') % { 'user': h.person(user), 'pr_title': pull_request.title, 'pr_id': pull_request.pull_request_id } } | |
${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s".') % data } | |
${_('Title')} | ${pull_request.title} |
${_('Source')} | ${pull_request.source_ref_parts.name}${h.literal(_('%(source_ref_type)s of %(source_repo_url)s') % {'source_ref_type': pull_request.source_ref_parts.type, 'source_repo_url': h.link_to(pull_request_source_repo.repo_name, pull_request_source_repo_url)})} |
${_('Target')} | ${pull_request.target_ref_parts.name}${h.literal(_('%(target_ref_type)s of %(target_repo_url)s') % {'target_ref_type': pull_request.target_ref_parts.type, 'target_repo_url': h.link_to(pull_request_target_repo.repo_name, pull_request_target_repo_url)})} |
${_('Source')} | ${base.tag_button(pull_request.source_ref_parts.name)} ${h.literal(_('%(source_ref_type)s of %(source_repo_url)s') % data)} |
${_('Target')} | ${base.tag_button(pull_request.target_ref_parts.name)} ${h.literal(_('%(target_ref_type)s of %(target_repo_url)s') % data)} |
${_('Description')} | ${pull_request.description} |
${ungettext('%(num)s Commit', '%(num)s Commits', len(pull_request_commits)) % {'num': len(pull_request_commits)}} |
|