comments-history: fixed fetching of history for comments

This commit is contained in:
RhodeCode Admin 2021-07-21 10:00:57 +02:00
parent 952b2b0cdc
commit 1b36875be6
4 changed files with 6 additions and 4 deletions

View file

@ -173,7 +173,7 @@ def includeme(config):
config.add_route(
name='repo_commit_comment_history_view',
pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/{comment_history_id}/history_view', repo_route=True)
pattern='/{repo_name:.*?[^/]}/changeset/{commit_id}/comment/{comment_id}/history_view/{comment_history_id}', repo_route=True)
config.add_view(
RepoCommitsView,
attr='repo_commit_comment_history_view',

View file

@ -539,9 +539,10 @@ class RepoCommitsView(RepoAppView):
@CSRFRequired()
def repo_commit_comment_history_view(self):
c = self.load_default_context()
comment_id = self.request.matchdict['comment_id']
comment_history_id = self.request.matchdict['comment_history_id']
comment = ChangesetComment.get_or_404(comment_history_id)
comment = ChangesetComment.get_or_404(comment_id)
comment_owner = (comment.author.user_id == self._rhodecode_db_user.user_id)
if comment.draft and not comment_owner:
# if we see draft comments history, we only allow this for owner

View file

@ -289,7 +289,7 @@ function registerRCRoutes() {
pyroutes.register('repo_commit_comment_create', '/%(repo_name)s/changeset/%(commit_id)s/comment/create', ['repo_name', 'commit_id']);
pyroutes.register('repo_commit_comment_delete', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/delete', ['repo_name', 'commit_id', 'comment_id']);
pyroutes.register('repo_commit_comment_edit', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/edit', ['repo_name', 'commit_id', 'comment_id']);
pyroutes.register('repo_commit_comment_history_view', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_history_id)s/history_view', ['repo_name', 'commit_id', 'comment_history_id']);
pyroutes.register('repo_commit_comment_history_view', '/%(repo_name)s/changeset/%(commit_id)s/comment/%(comment_id)s/history_view/%(comment_history_id)s', ['repo_name', 'commit_id', 'comment_id', 'comment_history_id']);
pyroutes.register('repo_commit_comment_preview', '/%(repo_name)s/changeset/%(commit_id)s/comment/preview', ['repo_name', 'commit_id']);
pyroutes.register('repo_commit_data', '/%(repo_name)s/changeset-data/%(commit_id)s', ['repo_name', 'commit_id']);
pyroutes.register('repo_commit_download', '/%(repo_name)s/changeset-download/%(commit_id)s', ['repo_name', 'commit_id']);

View file

@ -572,7 +572,8 @@ var CommentsController = function() {
'repo_commit_comment_history_view',
{
'repo_name': templateContext.repo_name,
'commit_id': comment_id,
'commit_id': null, // We don't need to check the commit data here...
'comment_id': comment_id,
'comment_history_id': comment_history_id,
}
);