| OLD | NEW |
| 1 # Copyright 2008 Google Inc. | 1 # Copyright 2008 Google Inc. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 3401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3412 tbd, comments = _get_draft_comments(request, issue) | 3412 tbd, comments = _get_draft_comments(request, issue) |
| 3413 else: | 3413 else: |
| 3414 tbd = [] | 3414 tbd = [] |
| 3415 comments = [] | 3415 comments = [] |
| 3416 issue.update_comment_count(len(comments)) | 3416 issue.update_comment_count(len(comments)) |
| 3417 tbd.append(issue) | 3417 tbd.append(issue) |
| 3418 | 3418 |
| 3419 if comments: | 3419 if comments: |
| 3420 logging.warn('Publishing %d comments', len(comments)) | 3420 logging.warn('Publishing %d comments', len(comments)) |
| 3421 # Email only the triggerer and the CL owner if it was a CQ dry run request. | 3421 # Email only the triggerer and the CL owner if it was a CQ dry run request. |
| 3422 # More details are in crbug.com/476883 | 3422 # More details are in http://crbug.com/476883. |
| 3423 email_to = None | 3423 email_to = None |
| 3424 # Mark CQ dry run messages as autogenerated. |
| 3425 # More details: http://crbug.com/596249. |
| 3426 auto_generated = False |
| 3424 if (request.user.email().lower() in (CQ_COMMIT_BOT_EMAIL, CQ_SERVICE_ACCOUNT) | 3427 if (request.user.email().lower() in (CQ_COMMIT_BOT_EMAIL, CQ_SERVICE_ACCOUNT) |
| 3425 and 'dry run' in form.cleaned_data['message'].lower()): | 3428 and 'dry run' in form.cleaned_data['message'].lower()): |
| 3426 email_to = [issue.owner.email()] | 3429 email_to = [issue.owner.email()] |
| 3430 auto_generated = True |
| 3427 if (issue.cq_dry_run_last_triggered_by and | 3431 if (issue.cq_dry_run_last_triggered_by and |
| 3428 issue.cq_dry_run_last_triggered_by != issue.owner.email()): | 3432 issue.cq_dry_run_last_triggered_by != issue.owner.email()): |
| 3429 email_to.append(issue.cq_dry_run_last_triggered_by) | 3433 email_to.append(issue.cq_dry_run_last_triggered_by) |
| 3430 msg = make_message(request, issue, | 3434 msg = make_message(request, issue, |
| 3431 form.cleaned_data['message'], | 3435 form.cleaned_data['message'], |
| 3432 comments, | 3436 comments, |
| 3433 form.cleaned_data['send_mail'], | 3437 form.cleaned_data['send_mail'], |
| 3434 draft=draft_message, | 3438 draft=draft_message, |
| 3435 email_to=email_to, | 3439 email_to=email_to, |
| 3436 in_reply_to=form.cleaned_data.get('in_reply_to')) | 3440 in_reply_to=form.cleaned_data.get('in_reply_to'), |
| 3441 auto_generated=auto_generated) |
| 3437 tbd.append(msg) | 3442 tbd.append(msg) |
| 3438 | 3443 |
| 3439 for obj in tbd: | 3444 for obj in tbd: |
| 3440 obj.put() | 3445 obj.put() |
| 3441 | 3446 |
| 3442 if form.cleaned_data['commit'] and not issue.cq_dry_run and not issue.closed: | 3447 if form.cleaned_data['commit'] and not issue.cq_dry_run and not issue.closed: |
| 3443 notify_approvers_of_new_patchsets(request, issue) | 3448 notify_approvers_of_new_patchsets(request, issue) |
| 3444 | 3449 |
| 3445 notify_xmpp.notify_issue(request, issue, 'Comments published') | 3450 notify_xmpp.notify_issue(request, issue, 'Comments published') |
| 3446 | 3451 |
| (...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5567 return HttpResponseNotFound() | 5572 return HttpResponseNotFound() |
| 5568 tops = [] | 5573 tops = [] |
| 5569 shame = [] | 5574 shame = [] |
| 5570 for i in data: | 5575 for i in data: |
| 5571 if i.score == models.AccountStatsBase.NULL_SCORE: | 5576 if i.score == models.AccountStatsBase.NULL_SCORE: |
| 5572 shame.append(i) | 5577 shame.append(i) |
| 5573 else: | 5578 else: |
| 5574 tops.append(i) | 5579 tops.append(i) |
| 5575 return respond( | 5580 return respond( |
| 5576 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) | 5581 request, 'leaderboard.html', {'tops': tops, 'shame': shame, 'when': when}) |
| OLD | NEW |