Show More
@@ -1,5 +1,6 b'' | |||||
1 |
# |
|
1 | # Below code examples allows override the integrations templates, or email titles. | |
2 |
# |
|
2 | # Append selected parts at the end of the __init__.py file of rcextensions directory | |
|
3 | # to override the templates | |||
3 |
|
4 | |||
4 |
|
5 | |||
5 | # EMAIL Integration |
|
6 | # EMAIL Integration | |
@@ -185,3 +186,18 b' message:' | |||||
185 | ``` |
|
186 | ``` | |
186 |
|
187 | |||
187 | ''') |
|
188 | ''') | |
|
189 | ||||
|
190 | ||||
|
191 | # Example to modify emails default title | |||
|
192 | from rhodecode.model import notification | |||
|
193 | ||||
|
194 | notification.EMAIL_PR_UPDATE_SUBJECT_TEMPLATE = '{updating_user} updated pull request. !{pr_id}: "{pr_title}"' | |||
|
195 | notification.EMAIL_PR_REVIEW_SUBJECT_TEMPLATE = '{user} requested a pull request review. !{pr_id}: "{pr_title}"' | |||
|
196 | ||||
|
197 | notification.EMAIL_PR_COMMENT_SUBJECT_TEMPLATE = '{mention_prefix}{user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"' | |||
|
198 | notification.EMAIL_PR_COMMENT_STATUS_CHANGE_SUBJECT_TEMPLATE = '{mention_prefix}[status: {status}] {user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"' | |||
|
199 | 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}"' | |||
|
200 | ||||
|
201 | notification.EMAIL_COMMENT_SUBJECT_TEMPLATE = '{mention_prefix}{user} left a {comment_type} on commit `{commit_id}`' | |||
|
202 | notification.EMAIL_COMMENT_STATUS_CHANGE_SUBJECT_TEMPLATE = '{mention_prefix}[status: {status}] {user} left a {comment_type} on commit `{commit_id}`' | |||
|
203 | notification.EMAIL_COMMENT_FILE_SUBJECT_TEMPLATE = '{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in commit `{commit_id}`' |
@@ -295,6 +295,27 b' class NotificationModel(BaseModel):' | |||||
295 | } |
|
295 | } | |
296 |
|
296 | |||
297 |
|
297 | |||
|
298 | # Templates for Titles, that could be overwritten by rcextensions | |||
|
299 | # Title of email for pull-request update | |||
|
300 | EMAIL_PR_UPDATE_SUBJECT_TEMPLATE = '' | |||
|
301 | # Title of email for request for pull request review | |||
|
302 | EMAIL_PR_REVIEW_SUBJECT_TEMPLATE = '' | |||
|
303 | ||||
|
304 | # Title of email for general comment on pull request | |||
|
305 | EMAIL_PR_COMMENT_SUBJECT_TEMPLATE = '' | |||
|
306 | # Title of email for general comment which includes status change on pull request | |||
|
307 | EMAIL_PR_COMMENT_STATUS_CHANGE_SUBJECT_TEMPLATE = '' | |||
|
308 | # Title of email for inline comment on a file in pull request | |||
|
309 | EMAIL_PR_COMMENT_FILE_SUBJECT_TEMPLATE = '' | |||
|
310 | ||||
|
311 | # Title of email for general comment on commit | |||
|
312 | EMAIL_COMMENT_SUBJECT_TEMPLATE = '' | |||
|
313 | # Title of email for general comment which includes status change on commit | |||
|
314 | EMAIL_COMMENT_STATUS_CHANGE_SUBJECT_TEMPLATE = '' | |||
|
315 | # Title of email for inline comment on a file in commit | |||
|
316 | EMAIL_COMMENT_FILE_SUBJECT_TEMPLATE = '' | |||
|
317 | ||||
|
318 | ||||
298 | class EmailNotificationModel(BaseModel): |
|
319 | class EmailNotificationModel(BaseModel): | |
299 | TYPE_COMMIT_COMMENT = Notification.TYPE_CHANGESET_COMMENT |
|
320 | TYPE_COMMIT_COMMENT = Notification.TYPE_CHANGESET_COMMENT | |
300 | TYPE_REGISTRATION = Notification.TYPE_REGISTRATION |
|
321 | TYPE_REGISTRATION = Notification.TYPE_REGISTRATION |
@@ -17,19 +17,22 b' data = {' | |||||
17 | 'commit_id': h.show_id(commit), |
|
17 | 'commit_id': h.show_id(commit), | |
18 | 'mention_prefix': '[mention] ' if mention else '', |
|
18 | 'mention_prefix': '[mention] ' if mention else '', | |
19 | } |
|
19 | } | |
|
20 | ||||
|
21 | ||||
|
22 | if comment_file: | |||
|
23 | subject_template = email_comment_file_subject_template or \ | |||
|
24 | _('{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in commit `{commit_id}` in the `{repo_name}` repository').format(**data) | |||
|
25 | else: | |||
|
26 | if status_change: | |||
|
27 | subject_template = email_comment_status_change_subject_template or \ | |||
|
28 | _('{mention_prefix}[status: {status}] {user} left a {comment_type} on commit `{commit_id}` in the `{repo_name}` repository').format(**data) | |||
|
29 | else: | |||
|
30 | subject_template = email_comment_subject_template or \ | |||
|
31 | _('{mention_prefix}{user} left a {comment_type} on commit `{commit_id}` in the `{repo_name}` repository').format(**data) | |||
20 | %> |
|
32 | %> | |
21 |
|
33 | |||
22 |
|
34 | |||
23 | % if comment_file: |
|
35 | ${subject_template.format(**data) |n} | |
24 | ${_('{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in commit `{commit_id}`').format(**data)} ${_('in the `{repo_name}` repository').format(**data) |n} |
|
|||
25 | % else: |
|
|||
26 | % if status_change: |
|
|||
27 | ${_('{mention_prefix}[status: {status}] {user} left a {comment_type} on commit `{commit_id}`').format(**data) |n} ${_('in the `{repo_name}` repository').format(**data) |n} |
|
|||
28 | % else: |
|
|||
29 | ${_('{mention_prefix}{user} left a {comment_type} on commit `{commit_id}`').format(**data) |n} ${_('in the `{repo_name}` repository').format(**data) |n} |
|
|||
30 | % endif |
|
|||
31 | % endif |
|
|||
32 |
|
||||
33 | </%def> |
|
36 | </%def> | |
34 |
|
37 | |||
35 | ## PLAINTEXT VERSION OF BODY |
|
38 | ## PLAINTEXT VERSION OF BODY |
@@ -18,19 +18,21 b' data = {' | |||||
18 | 'pr_id': pull_request.pull_request_id, |
|
18 | 'pr_id': pull_request.pull_request_id, | |
19 | 'mention_prefix': '[mention] ' if mention else '', |
|
19 | 'mention_prefix': '[mention] ' if mention else '', | |
20 | } |
|
20 | } | |
|
21 | ||||
|
22 | if comment_file: | |||
|
23 | subject_template = email_pr_comment_file_subject_template or \ | |||
|
24 | _('{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in pull request !{pr_id}: "{pr_title}"').format(**data) | |||
|
25 | else: | |||
|
26 | if status_change: | |||
|
27 | subject_template = email_pr_comment_status_change_subject_template or \ | |||
|
28 | _('{mention_prefix}[status: {status}] {user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) | |||
|
29 | else: | |||
|
30 | subject_template = email_pr_comment_subject_template or \ | |||
|
31 | _('{mention_prefix}{user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) | |||
21 | %> |
|
32 | %> | |
22 |
|
33 | |||
23 |
|
34 | |||
24 | % if comment_file: |
|
35 | ${subject_template.format(**data) |n} | |
25 | ${_('{mention_prefix}{user} left a {comment_type} on file `{comment_file}` in pull request !{pr_id}: "{pr_title}"').format(**data) |n} |
|
|||
26 | % else: |
|
|||
27 | % if status_change: |
|
|||
28 | ${_('{mention_prefix}[status: {status}] {user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) |n} |
|
|||
29 | % else: |
|
|||
30 | ${_('{mention_prefix}{user} left a {comment_type} on pull request !{pr_id}: "{pr_title}"').format(**data) |n} |
|
|||
31 | % endif |
|
|||
32 | % endif |
|
|||
33 |
|
||||
34 | </%def> |
|
36 | </%def> | |
35 |
|
37 | |||
36 | ## PLAINTEXT VERSION OF BODY |
|
38 | ## PLAINTEXT VERSION OF BODY |
@@ -10,9 +10,11 b' data = {' | |||||
10 | 'pr_id': pull_request.pull_request_id, |
|
10 | 'pr_id': pull_request.pull_request_id, | |
11 | 'pr_title': pull_request.title, |
|
11 | 'pr_title': pull_request.title, | |
12 | } |
|
12 | } | |
|
13 | ||||
|
14 | subject_template = email_pr_review_subject_template or _('{user} requested a pull request review. !{pr_id}: "{pr_title}"') | |||
13 | %> |
|
15 | %> | |
14 |
|
16 | |||
15 | ${_('{user} requested a pull request review. !{pr_id}: "{pr_title}"').format(**data) |n} |
|
17 | ${subject_template.format(**data) |n} | |
16 | </%def> |
|
18 | </%def> | |
17 |
|
19 | |||
18 | ## PLAINTEXT VERSION OF BODY |
|
20 | ## PLAINTEXT VERSION OF BODY |
@@ -10,9 +10,11 b' data = {' | |||||
10 | 'pr_id': pull_request.pull_request_id, |
|
10 | 'pr_id': pull_request.pull_request_id, | |
11 | 'pr_title': pull_request.title, |
|
11 | 'pr_title': pull_request.title, | |
12 | } |
|
12 | } | |
|
13 | ||||
|
14 | subject_template = email_pr_update_subject_template or _('{updating_user} updated pull request. !{pr_id}: "{pr_title}"') | |||
13 | %> |
|
15 | %> | |
14 |
|
16 | |||
15 | ${_('{updating_user} updated pull request. !{pr_id}: "{pr_title}"').format(**data) |n} |
|
17 | ${subject_template.format(**data) |n} | |
16 | </%def> |
|
18 | </%def> | |
17 |
|
19 | |||
18 | ## PLAINTEXT VERSION OF BODY |
|
20 | ## PLAINTEXT VERSION OF BODY |
General Comments 0
You need to be logged in to leave comments.
Login now