sidebar: expose status indicator for general comments which changed review status.

This commit is contained in:
Marcin Kuzminski 2020-09-27 19:33:46 +02:00
parent b39807deeb
commit 8c6f923e3f
5 changed files with 22 additions and 4 deletions

View file

@ -145,7 +145,7 @@ class PullRequestCommentEvent(PullRequestEvent):
status = None
if self.comment.status_change:
status = self.comment.status_change[0].status
status = self.comment.review_status
data.update({
'comment': {
@ -184,7 +184,7 @@ class PullRequestCommentEditEvent(PullRequestEvent):
status = None
if self.comment.status_change:
status = self.comment.status_change[0].status
status = self.comment.review_status
data.update({
'comment': {

View file

@ -3881,6 +3881,16 @@ class ChangesetComment(Base, BaseModel):
return self.get_index_from_version(
self.pull_request_version_id, versions)
@property
def review_status(self):
if self.status_change:
return self.status_change[0].status
@property
def review_status_lbl(self):
if self.status_change:
return self.status_change[0].status_lbl
def __repr__(self):
if self.comment_id:
return '<DB:Comment #%s>' % self.comment_id

View file

@ -89,6 +89,7 @@
if is_pr:
version_info = (' made in older version (v{})'.format(comment_ver_index) if is_from_old_ver == 'true' else ' made in this version')
%>
<script type="text/javascript">
// closure function helper
var sidebarComment${comment_obj.comment_id} = function() {
@ -101,6 +102,7 @@
is_todo: ${h.json.dumps(comment_obj.is_todo)},
created_on: "${h.format_date(comment_obj.created_on)}",
datetime: "${comment_obj.created_on}${h.get_timezone(comment_obj.created_on, time_is_local=True)}",
review_status: "${(comment_obj.review_status or '')}"
})
}
</script>

View file

@ -76,9 +76,9 @@
status_change_title = 'Status of review for commit {}'.format(h.short_id(comment.commit_id))
%>
<i class="icon-circle review-status-${comment.status_change[0].status}"></i>
<i class="icon-circle review-status-${comment.review_status}"></i>
<div class="changeset-status-lbl tooltip" title="${status_change_title}">
${comment.status_change[0].status_lbl}
${comment.review_status_lbl}
</div>
% else:
<div>

View file

@ -196,6 +196,9 @@ if (show_disabled) {
<br/>
File: <code><%- file_name -%></code>
<% } else { %>
<% if (review_status) { %>
<i class="icon-circle review-status-<%= review_status %>"></i>
<% } %>
<strong>General</strong> TODO
<% if (version_info) { %>
<%= version_info %>
@ -210,6 +213,9 @@ if (show_disabled) {
<br/>
File: <code><%- file_name -%></code>
<% } else { %>
<% if (review_status) { %>
<i class="icon-circle review-status-<%= review_status %>"></i>
<% } %>
<strong>General</strong> comment
<% if (version_info) { %>
<%= version_info %>