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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 form = EditFlagsForm(request.POST) | 448 form = EditFlagsForm(request.POST) |
449 if not form.is_valid(): | 449 if not form.is_valid(): |
450 return HttpResponseBadRequest('Invalid POST arguments', | 450 return HttpResponseBadRequest('Invalid POST arguments', |
451 content_type='text/plain') | 451 content_type='text/plain') |
452 if (form.cleaned_data['last_patchset'] != last_patchset.key().id()): | 452 if (form.cleaned_data['last_patchset'] != last_patchset.key().id()): |
453 return HttpResponseForbidden('Can only modify flags on last patchset', | 453 return HttpResponseForbidden('Can only modify flags on last patchset', |
454 content_type='text/plain') | 454 content_type='text/plain') |
455 | 455 |
456 if 'commit' in request.POST: | 456 if 'commit' in request.POST: |
457 request.issue.commit = form.cleaned_data['commit'] | 457 request.issue.commit = form.cleaned_data['commit'] |
458 if request.user.email() not in request.issue.reviewers: | 458 user_email = request.user.email().lower() |
| 459 if (user_email != request.issue.owner.email() and |
| 460 user_email not in request.issue.reviewers and |
| 461 user_email not in request.issue.collaborator_emails()): |
459 request.issue.reviewers.append(db.Email(request.user.email())) | 462 request.issue.reviewers.append(db.Email(request.user.email())) |
460 request.issue.put() | 463 request.issue.put() |
461 | 464 |
462 if 'builders' in request.POST: | 465 if 'builders' in request.POST: |
463 def txn(): | 466 def txn(): |
464 jobs_to_save = [] | 467 jobs_to_save = [] |
465 new_builders = filter(None, map(unicode.strip, | 468 new_builders = filter(None, map(unicode.strip, |
466 form.cleaned_data['builders'].split(','))) | 469 form.cleaned_data['builders'].split(','))) |
467 | 470 |
468 # Add any new builders. | 471 # Add any new builders. |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 q = models.TryJobResult.all().filter( | 849 q = models.TryJobResult.all().filter( |
847 'result =', models.TryJobResult.TRYPENDING).order('timestamp') | 850 'result =', models.TryJobResult.TRYPENDING).order('timestamp') |
848 if cursor: | 851 if cursor: |
849 q.with_cursor(cursor) | 852 q.with_cursor(cursor) |
850 | 853 |
851 jobs = q.fetch(limit) | 854 jobs = q.fetch(limit) |
852 total = len(jobs) | 855 total = len(jobs) |
853 jobs = [MakeJobDescription(job) for job in jobs if _is_job_valid(job)] | 856 jobs = [MakeJobDescription(job) for job in jobs if _is_job_valid(job)] |
854 logging.info('Found %d entries, returned %d' % (total, len(jobs))) | 857 logging.info('Found %d entries, returned %d' % (total, len(jobs))) |
855 return {'cursor': q.cursor(), 'jobs': jobs} | 858 return {'cursor': q.cursor(), 'jobs': jobs} |
OLD | NEW |