Merge "PolyGerrit: Correctly detect the ACL for SetReadyForReview endpoint" into stable-2.15
This commit is contained in:
commit
b43cd22cc4
@ -98,7 +98,7 @@
|
||||
},
|
||||
_canStartReview: {
|
||||
type: Boolean,
|
||||
computed: '_computeCanStartReview(_loggedIn, _change, _account)',
|
||||
computed: '_computeCanStartReview(_change)',
|
||||
},
|
||||
_comments: Object,
|
||||
/** @type {?} */
|
||||
@ -1109,9 +1109,9 @@
|
||||
]);
|
||||
},
|
||||
|
||||
_computeCanStartReview(loggedIn, change, account) {
|
||||
return !!(loggedIn && change.work_in_progress &&
|
||||
change.owner._account_id === account._account_id);
|
||||
_computeCanStartReview(change) {
|
||||
return !!(change.actions && change.actions.ready &&
|
||||
change.actions.ready.enabled);
|
||||
},
|
||||
|
||||
_computeReplyDisabled() { return false; },
|
||||
|
@ -1087,18 +1087,24 @@ limitations under the License.
|
||||
});
|
||||
|
||||
test('canStartReview computation', () => {
|
||||
const account1 = {_account_id: 1};
|
||||
const account2 = {_account_id: 2};
|
||||
const change = {
|
||||
owner: {_account_id: 1},
|
||||
const change1 = {};
|
||||
const change2 = {
|
||||
actions: {
|
||||
ready: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
assert.isFalse(element._computeCanStartReview(true, change, account1));
|
||||
change.work_in_progress = false;
|
||||
assert.isFalse(element._computeCanStartReview(true, change, account1));
|
||||
change.work_in_progress = true;
|
||||
assert.isTrue(element._computeCanStartReview(true, change, account1));
|
||||
assert.isFalse(element._computeCanStartReview(false, change, account1));
|
||||
assert.isFalse(element._computeCanStartReview(true, change, account2));
|
||||
const change3 = {
|
||||
actions: {
|
||||
ready: {
|
||||
label: 'Ready for Review',
|
||||
},
|
||||
},
|
||||
};
|
||||
assert.isFalse(element._computeCanStartReview(change1));
|
||||
assert.isTrue(element._computeCanStartReview(change2));
|
||||
assert.isFalse(element._computeCanStartReview(change3));
|
||||
});
|
||||
|
||||
test('header class computation', () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user