Show More
@@ -548,7 +548,8 b' def comment_pull_request(' | |||
|
548 | 548 | closing_pr=False, |
|
549 | 549 | renderer=renderer, |
|
550 | 550 | comment_type=comment_type, |
|
551 | resolves_comment_id=resolves_comment_id | |
|
551 | resolves_comment_id=resolves_comment_id, | |
|
552 | auth_user=apiuser | |
|
552 | 553 | ) |
|
553 | 554 | |
|
554 | 555 | if allowed_to_change_status and status: |
@@ -1469,7 +1469,8 b' def comment_commit(' | |||
|
1469 | 1469 | status_change_type=status, |
|
1470 | 1470 | renderer=renderer, |
|
1471 | 1471 | comment_type=comment_type, |
|
1472 | resolves_comment_id=resolves_comment_id | |
|
1472 | resolves_comment_id=resolves_comment_id, | |
|
1473 | auth_user=apiuser | |
|
1473 | 1474 | ) |
|
1474 | 1475 | if status: |
|
1475 | 1476 | # also do a status change |
@@ -437,7 +437,8 b' class RepoCommitsView(RepoAppView):' | |||
|
437 | 437 | if status else None), |
|
438 | 438 | status_change_type=status, |
|
439 | 439 | comment_type=comment_type, |
|
440 | resolves_comment_id=resolves_comment_id | |
|
440 | resolves_comment_id=resolves_comment_id, | |
|
441 | auth_user=self._rhodecode_user | |
|
441 | 442 | ) |
|
442 | 443 | |
|
443 | 444 | # get status if set ! |
@@ -528,7 +529,7 b' class RepoCommitsView(RepoAppView):' | |||
|
528 | 529 | comment_repo_admin = is_repo_admin and is_repo_comment |
|
529 | 530 | |
|
530 | 531 | if super_admin or comment_owner or comment_repo_admin: |
|
531 |
CommentsModel().delete(comment=comment, user=self._rhodecode_ |
|
|
532 | CommentsModel().delete(comment=comment, auth_user=self._rhodecode_user) | |
|
532 | 533 | Session().commit() |
|
533 | 534 | return True |
|
534 | 535 | else: |
@@ -1285,7 +1285,7 b' class RepoPullRequestsView(RepoAppView, ' | |||
|
1285 | 1285 | |
|
1286 | 1286 | if super_admin or comment_owner or comment_repo_admin: |
|
1287 | 1287 | old_calculated_status = comment.pull_request.calculated_review_status() |
|
1288 | CommentsModel().delete(comment=comment, user=self._rhodecode_user) | |
|
1288 | CommentsModel().delete(comment=comment, auth_user=self._rhodecode_user) | |
|
1289 | 1289 | Session().commit() |
|
1290 | 1290 | calculated_status = comment.pull_request.calculated_review_status() |
|
1291 | 1291 | if old_calculated_status != calculated_status: |
@@ -159,18 +159,18 b' class CommentsModel(BaseModel):' | |||
|
159 | 159 | |
|
160 | 160 | return todos |
|
161 | 161 | |
|
162 | def _log_audit_action(self, action, action_data, user, comment): | |
|
162 | def _log_audit_action(self, action, action_data, auth_user, comment): | |
|
163 | 163 | audit_logger.store( |
|
164 | 164 | action=action, |
|
165 | 165 | action_data=action_data, |
|
166 | user=user, | |
|
166 | user=auth_user, | |
|
167 | 167 | repo=comment.repo) |
|
168 | 168 | |
|
169 | 169 | def create(self, text, repo, user, commit_id=None, pull_request=None, |
|
170 | 170 | f_path=None, line_no=None, status_change=None, |
|
171 | 171 | status_change_type=None, comment_type=None, |
|
172 | 172 | resolves_comment_id=None, closing_pr=False, send_email=True, |
|
173 | renderer=None): | |
|
173 | renderer=None, auth_user=None): | |
|
174 | 174 | """ |
|
175 | 175 | Creates new comment for commit or pull request. |
|
176 | 176 | IF status_change is not none this comment is associated with a |
@@ -190,6 +190,8 b' class CommentsModel(BaseModel):' | |||
|
190 | 190 | :param send_email: |
|
191 | 191 | :param renderer: pick renderer for this comment |
|
192 | 192 | """ |
|
193 | ||
|
194 | auth_user = auth_user or user | |
|
193 | 195 | if not text: |
|
194 | 196 | log.warning('Missing text for comment, skipping...') |
|
195 | 197 | return |
@@ -355,7 +357,7 b' class CommentsModel(BaseModel):' | |||
|
355 | 357 | |
|
356 | 358 | comment_data = comment.get_api_data() |
|
357 | 359 | self._log_audit_action( |
|
358 | action, {'data': comment_data}, user, comment) | |
|
360 | action, {'data': comment_data}, auth_user, comment) | |
|
359 | 361 | |
|
360 | 362 | msg_url = '' |
|
361 | 363 | channel = None |
@@ -388,7 +390,7 b' class CommentsModel(BaseModel):' | |||
|
388 | 390 | |
|
389 | 391 | return comment |
|
390 | 392 | |
|
391 | def delete(self, comment, user): | |
|
393 | def delete(self, comment, auth_user): | |
|
392 | 394 | """ |
|
393 | 395 | Deletes given comment |
|
394 | 396 | """ |
@@ -402,7 +404,7 b' class CommentsModel(BaseModel):' | |||
|
402 | 404 | action = 'repo.commit.comment.delete' |
|
403 | 405 | |
|
404 | 406 | self._log_audit_action( |
|
405 | action, {'old_data': old_data}, user, comment) | |
|
407 | action, {'old_data': old_data}, auth_user, comment) | |
|
406 | 408 | |
|
407 | 409 | return comment |
|
408 | 410 |
General Comments 0
You need to be logged in to leave comments.
Login now