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