## -*- coding: utf-8 -*- ## usage: ## <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/> ## ${comment.comment_block(comment)} ## <%! from rhodecode.lib import html_filters %> <%namespace name="base" file="/base/base.mako"/> <%def name="comment_block(comment, inline=False, active_pattern_entries=None)"> <% pr_index_ver = comment.get_index_version(getattr(c, 'versions', [])) %> <% latest_ver = len(getattr(c, 'versions', [])) %> % if inline: <% outdated_at_ver = comment.outdated_at_version(getattr(c, 'at_version_num', None)) %> % else: <% outdated_at_ver = comment.older_than_version(getattr(c, 'at_version_num', None)) %> % endif
outdated ${'v{}'.format(pr_index_ver)} |
% elif pr_index_ver:${'v{}'.format(pr_index_ver)} |
% endif % else: % if pr_index_ver: % if comment.outdated: ${_('Outdated comment from pull request version v{0}, latest v{1}').format(pr_index_ver, latest_ver)} | % else:${'v{}'.format(pr_index_ver)}
| % endif % endif % endif ## show delete comment if it's not a PR (regular comments) or it's PR that is not closed ## only super-admin, repo admin OR comment owner can delete, also hide delete if currently viewed comment is outdated %if not outdated_at_ver and (not comment.pull_request or (comment.pull_request and not comment.pull_request.is_closed())): ## permissions to delete %if comment.immutable is False and (c.is_super_admin or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or comment.author.user_id == c.rhodecode_user.user_id): ${_('Edit')} | ${_('Delete')} %else: ${_('Edit')} | ${_('Delete')} %endif %else: ${_('Edit')} | ${_('Delete')} %endif % if outdated_at_ver: | | % else: | | % endif