Fix vote row for review requester. (#3060)
This commit is contained in:
Родитель
345953a679
Коммит
161df4d39e
|
@ -36,9 +36,6 @@ class PermissionsAPI(basehandlers.APIHandler):
|
|||
approvers = approval_defs.get_approvers(field_id)
|
||||
user_data = {
|
||||
'can_create_feature': permissions.can_create_feature(user),
|
||||
# TODO(jrobbins): delete unused can_approve in an upcoming release.
|
||||
'can_approve': permissions.can_approve_feature(
|
||||
user, None, approvers),
|
||||
'approvable_gate_types': sorted(
|
||||
approval_defs.fields_approvable_by(user)),
|
||||
'can_comment': permissions.can_comment(user),
|
||||
|
|
|
@ -47,7 +47,6 @@ class PermissionsAPITest(testing_config.CustomTestCase):
|
|||
'user': {
|
||||
'can_create_feature': False,
|
||||
'approvable_gate_types': [],
|
||||
'can_approve': False,
|
||||
'can_comment': False,
|
||||
'can_edit_all': False,
|
||||
'is_admin': False,
|
||||
|
@ -65,7 +64,6 @@ class PermissionsAPITest(testing_config.CustomTestCase):
|
|||
'user': {
|
||||
'can_create_feature': True,
|
||||
'approvable_gate_types': [],
|
||||
'can_approve': False,
|
||||
'can_comment': True,
|
||||
'can_edit_all': False,
|
||||
'is_admin': False,
|
||||
|
|
|
@ -465,12 +465,12 @@ export class ChromedashGateColumn extends LitElement {
|
|||
`;
|
||||
}
|
||||
|
||||
renderVoteRow(vote) {
|
||||
renderVoteRow(vote, canVote) {
|
||||
const shortVoter = vote.set_by.split('@')[0] + '@';
|
||||
let saveButton = nothing;
|
||||
let voteCell = this.renderVoteReadOnly(vote);
|
||||
|
||||
if (vote.set_by == this.user?.email) {
|
||||
if (canVote && vote.set_by == this.user?.email) {
|
||||
// If the current reviewer was the one who requested the review,
|
||||
// select "No response" in the menu because there is no
|
||||
// "Review requested" menu item now.
|
||||
|
@ -505,7 +505,7 @@ export class ChromedashGateColumn extends LitElement {
|
|||
this.user.approvable_gate_types.includes(this.gate.gate_type));
|
||||
const myVoteExists = this.votes.some((v) => v.set_by == this.user?.email);
|
||||
const addVoteRow = (canVote && !myVoteExists) ?
|
||||
this.renderVoteRow({set_by: this.user?.email, state: 7}) :
|
||||
this.renderVoteRow({set_by: this.user?.email, state: 7}, canVote) :
|
||||
nothing;
|
||||
|
||||
if (!canVote && this.votes.length === 0) {
|
||||
|
@ -517,7 +517,7 @@ export class ChromedashGateColumn extends LitElement {
|
|||
return html`
|
||||
<table>
|
||||
<tr><th>Reviewer</th><th>Review status</th></tr>
|
||||
${this.votes.map((v) => this.renderVoteRow(v))}
|
||||
${this.votes.map((v) => this.renderVoteRow(v, canVote))}
|
||||
${addVoteRow}
|
||||
</table>
|
||||
`;
|
||||
|
|
Загрузка…
Ссылка в новой задаче