Show More
@@ -1159,6 +1159,10 b' class RepoPullRequestsView(RepoAppView, ' | |||||
1159 | ) |
|
1159 | ) | |
1160 |
|
1160 | |||
1161 | Session().flush() |
|
1161 | Session().flush() | |
|
1162 | # this is somehow required to get access to some relationship | |||
|
1163 | # loaded on comment | |||
|
1164 | Session().refresh(comment) | |||
|
1165 | ||||
1162 | events.trigger( |
|
1166 | events.trigger( | |
1163 | events.PullRequestCommentEvent(pull_request, comment)) |
|
1167 | events.PullRequestCommentEvent(pull_request, comment)) | |
1164 |
|
1168 |
@@ -18,16 +18,14 b'' | |||||
18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
18 | # RhodeCode Enterprise Edition, including its added features, Support services, | |
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | """ |
|
|||
22 | Changeset status conttroller |
|
|||
23 | """ |
|
|||
24 |
|
21 | |||
25 | import itertools |
|
22 | import itertools | |
26 | import logging |
|
23 | import logging | |
27 | from collections import defaultdict |
|
24 | from collections import defaultdict | |
28 |
|
25 | |||
29 | from rhodecode.model import BaseModel |
|
26 | from rhodecode.model import BaseModel | |
30 | from rhodecode.model.db import ChangesetStatus, ChangesetComment, PullRequest |
|
27 | from rhodecode.model.db import ( | |
|
28 | ChangesetStatus, ChangesetComment, PullRequest, Session) | |||
31 | from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError |
|
29 | from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError | |
32 | from rhodecode.lib.markup_renderer import ( |
|
30 | from rhodecode.lib.markup_renderer import ( | |
33 | DEFAULT_COMMENTS_RENDERER, RstTemplateRenderer) |
|
31 | DEFAULT_COMMENTS_RENDERER, RstTemplateRenderer) | |
@@ -188,7 +186,7 b' class ChangesetStatusModel(BaseModel):' | |||||
188 | if cur_statuses: |
|
186 | if cur_statuses: | |
189 | for st in cur_statuses: |
|
187 | for st in cur_statuses: | |
190 | st.version += 1 |
|
188 | st.version += 1 | |
191 |
|
|
189 | Session().add(st) | |
192 |
|
190 | |||
193 | def _create_status(user, repo, status, comment, revision, pull_request): |
|
191 | def _create_status(user, repo, status, comment, revision, pull_request): | |
194 | new_status = ChangesetStatus() |
|
192 | new_status = ChangesetStatus() | |
@@ -215,7 +213,7 b' class ChangesetStatusModel(BaseModel):' | |||||
215 | new_status = _create_status( |
|
213 | new_status = _create_status( | |
216 | user=user, repo=repo, status=status, comment=comment, |
|
214 | user=user, repo=repo, status=status, comment=comment, | |
217 | revision=revision, pull_request=pull_request) |
|
215 | revision=revision, pull_request=pull_request) | |
218 |
|
|
216 | Session().add(new_status) | |
219 | return new_status |
|
217 | return new_status | |
220 | elif pull_request: |
|
218 | elif pull_request: | |
221 | # pull request can have more than one revision associated to it |
|
219 | # pull request can have more than one revision associated to it | |
@@ -227,7 +225,7 b' class ChangesetStatusModel(BaseModel):' | |||||
227 | user=user, repo=repo, status=status, comment=comment, |
|
225 | user=user, repo=repo, status=status, comment=comment, | |
228 | revision=rev, pull_request=pull_request) |
|
226 | revision=rev, pull_request=pull_request) | |
229 | new_statuses.append(new_status) |
|
227 | new_statuses.append(new_status) | |
230 |
|
|
228 | Session().add(new_status) | |
231 | return new_statuses |
|
229 | return new_statuses | |
232 |
|
230 | |||
233 | def reviewers_statuses(self, pull_request): |
|
231 | def reviewers_statuses(self, pull_request): |
@@ -432,7 +432,8 b' class CommentsModel(BaseModel):' | |||||
432 | pull_request_id=pull_request.pull_request_id, |
|
432 | pull_request_id=pull_request.pull_request_id, | |
433 | _anchor='comment-%s' % comment.comment_id) |
|
433 | _anchor='comment-%s' % comment.comment_id) | |
434 | else: |
|
434 | else: | |
435 |
return request.route_url( |
|
435 | return request.route_url( | |
|
436 | 'pullrequest_show', | |||
436 | repo_name=safe_str(pull_request.target_repo.repo_name), |
|
437 | repo_name=safe_str(pull_request.target_repo.repo_name), | |
437 | pull_request_id=pull_request.pull_request_id, |
|
438 | pull_request_id=pull_request.pull_request_id, | |
438 | _anchor='comment-%s' % comment.comment_id) |
|
439 | _anchor='comment-%s' % comment.comment_id) |
General Comments 0
You need to be logged in to leave comments.
Login now