Default to prior approval values when (re-)reviewing
When leaving a message on a review, default the approval values to those previously left by the user if they exist. This way if the user leaves a follow-up comment or reply, they are less likely to accidentally clear their vote. Change-Id: Iab9203e35aef9756057a62fed161fe818dd1d680
This commit is contained in:
parent
aac0e232cc
commit
ce7e391fcc
|
@ -132,13 +132,20 @@ class ReviewDialog(urwid.WidgetWrap, mywid.LineBoxTitlePropertyMixin):
|
|||
values[label.category] = []
|
||||
values[label.category].append(label.value)
|
||||
draft_approvals = {}
|
||||
for approval in change.draft_approvals:
|
||||
draft_approvals[approval.category] = approval
|
||||
prior_approvals = {}
|
||||
for approval in change.approvals:
|
||||
if approval.reviewer.username == self.app.config.username:
|
||||
if approval.draft:
|
||||
draft_approvals[approval.category] = approval
|
||||
else:
|
||||
prior_approvals[approval.category] = approval
|
||||
for category in categories:
|
||||
rows.append(urwid.Text(category))
|
||||
group = []
|
||||
self.button_groups[category] = group
|
||||
current = draft_approvals.get(category)
|
||||
if current is None:
|
||||
current = prior_approvals.get(category)
|
||||
if current is None:
|
||||
current = 0
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue