Show More
@@ -56,6 +56,8 b' class PullRequestEvent(RepoEvent):' | |||
|
56 | 56 | self.pullrequest, request=self.request), |
|
57 | 57 | 'permalink_url': PullRequestModel().get_url( |
|
58 | 58 | self.pullrequest, request=self.request, permalink=True), |
|
59 | 'shadow_url': PullRequestModel().get_shadow_clone_url( | |
|
60 | self.pullrequest, request=self.request), | |
|
59 | 61 | 'status': self.pullrequest.calculated_review_status(), |
|
60 | 62 | 'commits': commits, |
|
61 | 63 | } |
@@ -132,6 +132,7 b' CI_URL_VARS = [' | |||
|
132 | 132 | # pr events vars |
|
133 | 133 | 'pull_request_id', |
|
134 | 134 | 'pull_request_url', |
|
135 | 'pull_request_shadow_url', | |
|
135 | 136 | |
|
136 | 137 | # user who triggers the call |
|
137 | 138 | 'username', |
@@ -56,6 +56,7 b' WEBHOOK_URL_VARS = [' | |||
|
56 | 56 | # pr events vars |
|
57 | 57 | 'pull_request_id', |
|
58 | 58 | 'pull_request_url', |
|
59 | 'pull_request_shadow_url', | |
|
59 | 60 | |
|
60 | 61 | # user who triggers the call |
|
61 | 62 | 'username', |
@@ -156,7 +157,8 b' class WebhookHandler(object):' | |||
|
156 | 157 | 'register webhook call(%s) to url %s', event, url) |
|
157 | 158 | url = string.Template(url).safe_substitute( |
|
158 | 159 | pull_request_id=data['pullrequest']['pull_request_id'], |
|
159 |
pull_request_url=data['pullrequest']['url'] |
|
|
160 | pull_request_url=data['pullrequest']['url'], | |
|
161 | pull_request_shadow_url=data['pullrequest']['shadow_url'],) | |
|
160 | 162 | return [(url, self.secret_token, self.headers, data)] |
|
161 | 163 | |
|
162 | 164 | def __call__(self, event, data): |
@@ -365,6 +367,7 b' def post_to_webhook(url_calls, settings)' | |||
|
365 | 367 | rhodecode.__version__) |
|
366 | 368 | } # updated below with custom ones, allows override |
|
367 | 369 | |
|
370 | auth = get_auth(settings) | |
|
368 | 371 | for url, token, headers, data in url_calls: |
|
369 | 372 | req_session = requests.Session() |
|
370 | 373 | req_session.mount( # retry max N times |
@@ -375,7 +378,6 b' def post_to_webhook(url_calls, settings)' | |||
|
375 | 378 | |
|
376 | 379 | headers = headers or {} |
|
377 | 380 | call_headers.update(headers) |
|
378 | auth = get_auth(settings) | |
|
379 | 381 | |
|
380 | 382 | log.debug('calling Webhook with method: %s, and auth:%s', |
|
381 | 383 | call_method, auth) |
@@ -1063,7 +1063,7 b' class PullRequestModel(BaseModel):' | |||
|
1063 | 1063 | repo_name=safe_str(pull_request.target_repo.repo_name), |
|
1064 | 1064 | pull_request_id=pull_request.pull_request_id,) |
|
1065 | 1065 | |
|
1066 | def get_shadow_clone_url(self, pull_request): | |
|
1066 | def get_shadow_clone_url(self, pull_request, request=None): | |
|
1067 | 1067 | """ |
|
1068 | 1068 | Returns qualified url pointing to the shadow repository. If this pull |
|
1069 | 1069 | request is closed there is no shadow repository and ``None`` will be |
@@ -1072,7 +1072,7 b' class PullRequestModel(BaseModel):' | |||
|
1072 | 1072 | if pull_request.is_closed(): |
|
1073 | 1073 | return None |
|
1074 | 1074 | else: |
|
1075 | pr_url = urllib.unquote(self.get_url(pull_request)) | |
|
1075 | pr_url = urllib.unquote(self.get_url(pull_request, request=request)) | |
|
1076 | 1076 | return safe_unicode('{pr_url}/repository'.format(pr_url=pr_url)) |
|
1077 | 1077 | |
|
1078 | 1078 | def notify_reviewers(self, pull_request, reviewers_ids): |
General Comments 0
You need to be logged in to leave comments.
Login now