##// END OF EJS Templates
pull-requests: forbid doing any changes on closed pull-requests....
marcink -
r2383:6726b773 default
parent child Browse files
Show More
@@ -199,18 +199,17 b' class TestPullrequestsView(object):'
199 199 def test_edit_title_description_closed(self, pr_util, csrf_token):
200 200 pull_request = pr_util.create_pull_request()
201 201 pull_request_id = pull_request.pull_request_id
202 repo_name = pull_request.target_repo.repo_name
202 203 pr_util.close()
203 204
204 205 response = self.app.post(
205 206 route_path('pullrequest_update',
206 repo_name=pull_request.target_repo.repo_name,
207 pull_request_id=pull_request_id),
207 repo_name=repo_name, pull_request_id=pull_request_id),
208 208 params={
209 209 'edit_pull_request': 'true',
210 210 'title': 'New title',
211 211 'description': 'New description',
212 'csrf_token': csrf_token})
213
212 'csrf_token': csrf_token}, status=200)
214 213 assert_session_flash(
215 214 response, u'Cannot update closed pull requests.',
216 215 category='error')
@@ -887,8 +887,16 b' class RepoPullRequestsView(RepoAppView, '
887 887 def pull_request_update(self):
888 888 pull_request = PullRequest.get_or_404(
889 889 self.request.matchdict['pull_request_id'])
890 _ = self.request.translate
890 891
891 892 self.load_default_context()
893
894 if pull_request.is_closed():
895 log.debug('update: forbidden because pull request is closed')
896 msg = _(u'Cannot update closed pull requests.')
897 h.flash(msg, category='error')
898 return True
899
892 900 # only owner or admin can update it
893 901 allowed_to_update = PullRequestModel().check_user_update(
894 902 pull_request, self._rhodecode_user)
@@ -941,6 +941,9 b' class PullRequestModel(BaseModel):'
941 941 :param reviewer_data: list of tuples
942 942 [(user, ['reason1', 'reason2'], mandatory_flag)]
943 943 """
944 pull_request = self.__get_pull_request(pull_request)
945 if pull_request.is_closed():
946 raise ValueError('This pull request is closed')
944 947
945 948 reviewers = {}
946 949 for user_id, reasons, mandatory in reviewer_data:
@@ -950,7 +953,6 b' class PullRequestModel(BaseModel):'
950 953 'reasons': reasons, 'mandatory': mandatory}
951 954
952 955 reviewers_ids = set(reviewers.keys())
953 pull_request = self.__get_pull_request(pull_request)
954 956 current_reviewers = PullRequestReviewers.query()\
955 957 .filter(PullRequestReviewers.pull_request ==
956 958 pull_request).all()
General Comments 0
You need to be logged in to leave comments. Login now