# HG changeset patch # User Marcin Kuzminski # Date 2017-03-27 13:32:27 # Node ID 3793854d62f892fb6aa164dd526e7ce3291e8d3b # Parent 3fd4ff528e11cda623d9f2f0ebe4bb89ef50896f pull-request: lock button when updating reviewers to forbid multi-submit. - fixed some small UI issues found. diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -886,20 +886,22 @@ class PullRequestModel(BaseModel): reviewer = PullRequestReviewers(_usr, pull_request, reasons) Session().add(reviewer) - self.notify_reviewers(pull_request, ids_to_add) - for uid in ids_to_remove: changed = True - reviewer = PullRequestReviewers.query()\ + reviewers = PullRequestReviewers.query()\ .filter(PullRequestReviewers.user_id == uid, PullRequestReviewers.pull_request == pull_request)\ - .scalar() - if reviewer: - Session().delete(reviewer) + .all() + # use .all() in case we accidentally added the same person twice + # this CAN happen due to the lack of DB checks + for obj in reviewers: + Session().delete(obj) + if changed: pull_request.updated_on = datetime.datetime.now() Session().add(pull_request) + self.notify_reviewers(pull_request, ids_to_add) return ids_to_add, ids_to_remove def get_url(self, pull_request): diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -1329,13 +1329,6 @@ table.integrations { .reviewer { float: left; } - - &.to-delete { - .user, - .reviewer { - text-decoration: line-through; - } - } } .reviewer_member_remove { diff --git a/rhodecode/public/js/src/rhodecode/pullrequests.js b/rhodecode/public/js/src/rhodecode/pullrequests.js --- a/rhodecode/public/js/src/rhodecode/pullrequests.js +++ b/rhodecode/public/js/src/rhodecode/pullrequests.js @@ -28,11 +28,12 @@ var removeReviewMember = function(review if(mark_delete === true){ if (reviewer){ - // mark as to-remove + // now delete the input + $('#reviewer_{0} input'.format(reviewer_id)).remove(); + // mark as to-delete var obj = $('#reviewer_{0}_name'.format(reviewer_id)); obj.addClass('to-delete'); - // now delete the input - $('#reviewer_{0} input'.format(reviewer_id)).remove(); + obj.css({"text-decoration":"line-through", "opacity": 0.5}); } } else{ diff --git a/rhodecode/templates/pullrequests/pullrequest_show.mako b/rhodecode/templates/pullrequests/pullrequest_show.mako --- a/rhodecode/templates/pullrequests/pullrequest_show.mako +++ b/rhodecode/templates/pullrequests/pullrequest_show.mako @@ -362,7 +362,7 @@
- ${_('Save Changes')} +
%endif @@ -766,6 +766,9 @@ }); $('#update_pull_request').on('click', function(e){ + $(this).attr('disabled', 'disabled'); + $(this).addClass('disabled'); + $(this).html(_gettext('saving...')); updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}"); });