# Below code examples allows override the integrations templates, or email titles. # Append selected parts at the end of the __init__.py file of rcextensions directory # to override the templates # EMAIL Integration from rhodecode.integrations import email email.REPO_PUSH_TEMPLATE_HTML = email.Template(''' ${subject}
${'RhodeCode'}
% if data['push']['commits']: % for commit in data['push']['commits']: ${commit['short_id']} by ${commit['author']} at ${commit['date']}
${commit['message_html']}

% endfor % else: No commit data % endif

${'This is a notification from RhodeCode. %(instance_url)s' % {'instance_url': instance_url}}

''') # JIRA Integration (EE ONLY) # available variables: # url, short_id ,author # branch, commit_message # commit (dict data for commit) from rc_integrations import jira_tracker # used for references issues without transition, e.g `This ticket references PROJ-123` jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n ${url}\n ## MODIFICATION add custom COMMIT message to the comment ${commit['message']} ''') # used when there's a transition, e.g referenced issues status goes from # open to resolved this is used in correlation with something like `closes PROJ-123` jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n '{url}\n ## MODIFICATION add custom COMMIT message to the comment ${commit['message']} ''') jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template(''' ${action} by ${author} (status: ${status}). \n pull-request: ${url} ''') # REDMINE (EE ONLY) # available variables: # url, short_id ,author # branch, commit_message # commit (dict data for commit) from rc_integrations import redmine_tracker # used for references issues without transition, e.g `This ticket references #123` redmine_tracker.COMMENT_TEMPLATE_COMMIT = redmine_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n commit: ${url}\n ## MODIFICATION add custom COMMIT message to the comment message: ``` ${commit['message']} ``` ''') # used when there's a transition, e.g referenced issues status goes from # open to resolved this is used in correlation with something like `closes #123` redmine_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = redmine_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n commit: ${url}\n ## MODIFICATION add custom COMMIT message to the comment message: ``` ${commit['message']} ``` ''') redmine_tracker.COMMENT_TEMPLATE_PULL_REQUEST = redmine_tracker.Template(''' ${action} by ${author} (status: ${status}). \n' ${url}\n ## MODIFICATION add custom COMMIT message to the comment message: ``` ${commit['message']} ``` ''') # Example to modify emails default title from rhodecode.model import notification notification.EMAIL_PR_UPDATE_SUBJECT_TEMPLATE = '{updating_user} updated pull request. !{pr_id}: "{pr_title}"' notification.EMAIL_PR_REVIEW_SUBJECT_TEMPLATE = '{user} requested a pull request review. !{pr_id}: "{pr_title}"' notification.EMAIL_PR_COMMENT_SUBJECT_TEMPLATE = '{mention_prefix}{user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"' notification.EMAIL_PR_COMMENT_STATUS_CHANGE_SUBJECT_TEMPLATE = '{mention_prefix}[status: {status}] {user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"' notification.EMAIL_PR_COMMENT_FILE_SUBJECT_TEMPLATE = '{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in pull request !{pr_id}: "{pr_title}"' notification.EMAIL_COMMENT_SUBJECT_TEMPLATE = '{mention_prefix}{user} left a {comment_type} on commit `{commit_id}`' notification.EMAIL_COMMENT_STATUS_CHANGE_SUBJECT_TEMPLATE = '{mention_prefix}[status: {status}] {user} left a {comment_type} on commit `{commit_id}`' notification.EMAIL_COMMENT_FILE_SUBJECT_TEMPLATE = '{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in commit `{commit_id}`'