##// END OF EJS Templates
pull-request: lock button when updating reviewers to forbid multi-submit....
marcink -
r1578:3793854d default
parent child Browse files
Show More
@@ -886,20 +886,22 b' class PullRequestModel(BaseModel):'
886 reviewer = PullRequestReviewers(_usr, pull_request, reasons)
886 reviewer = PullRequestReviewers(_usr, pull_request, reasons)
887 Session().add(reviewer)
887 Session().add(reviewer)
888
888
889 self.notify_reviewers(pull_request, ids_to_add)
890
891 for uid in ids_to_remove:
889 for uid in ids_to_remove:
892 changed = True
890 changed = True
893 reviewer = PullRequestReviewers.query()\
891 reviewers = PullRequestReviewers.query()\
894 .filter(PullRequestReviewers.user_id == uid,
892 .filter(PullRequestReviewers.user_id == uid,
895 PullRequestReviewers.pull_request == pull_request)\
893 PullRequestReviewers.pull_request == pull_request)\
896 .scalar()
894 .all()
897 if reviewer:
895 # use .all() in case we accidentally added the same person twice
898 Session().delete(reviewer)
896 # this CAN happen due to the lack of DB checks
897 for obj in reviewers:
898 Session().delete(obj)
899
899 if changed:
900 if changed:
900 pull_request.updated_on = datetime.datetime.now()
901 pull_request.updated_on = datetime.datetime.now()
901 Session().add(pull_request)
902 Session().add(pull_request)
902
903
904 self.notify_reviewers(pull_request, ids_to_add)
903 return ids_to_add, ids_to_remove
905 return ids_to_add, ids_to_remove
904
906
905 def get_url(self, pull_request):
907 def get_url(self, pull_request):
@@ -1329,13 +1329,6 b' table.integrations {'
1329 .reviewer {
1329 .reviewer {
1330 float: left;
1330 float: left;
1331 }
1331 }
1332
1333 &.to-delete {
1334 .user,
1335 .reviewer {
1336 text-decoration: line-through;
1337 }
1338 }
1339 }
1332 }
1340
1333
1341 .reviewer_member_remove {
1334 .reviewer_member_remove {
@@ -28,11 +28,12 b' var removeReviewMember = function(review'
28
28
29 if(mark_delete === true){
29 if(mark_delete === true){
30 if (reviewer){
30 if (reviewer){
31 // mark as to-remove
31 // now delete the input
32 $('#reviewer_{0} input'.format(reviewer_id)).remove();
33 // mark as to-delete
32 var obj = $('#reviewer_{0}_name'.format(reviewer_id));
34 var obj = $('#reviewer_{0}_name'.format(reviewer_id));
33 obj.addClass('to-delete');
35 obj.addClass('to-delete');
34 // now delete the input
36 obj.css({"text-decoration":"line-through", "opacity": 0.5});
35 $('#reviewer_{0} input'.format(reviewer_id)).remove();
36 }
37 }
37 }
38 }
38 else{
39 else{
@@ -362,7 +362,7 b''
362 <div id="reviewers_container"></div>
362 <div id="reviewers_container"></div>
363 </div>
363 </div>
364 <div>
364 <div>
365 <span id="update_pull_request" class="btn btn-small">${_('Save Changes')}</span>
365 <button id="update_pull_request" class="btn btn-small">${_('Save Changes')}</button>
366 </div>
366 </div>
367 %endif
367 %endif
368 </div>
368 </div>
@@ -766,6 +766,9 b''
766 });
766 });
767
767
768 $('#update_pull_request').on('click', function(e){
768 $('#update_pull_request').on('click', function(e){
769 $(this).attr('disabled', 'disabled');
770 $(this).addClass('disabled');
771 $(this).html(_gettext('saving...'));
769 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
772 updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}");
770 });
773 });
771
774
General Comments 0
You need to be logged in to leave comments. Login now