summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhruv Srivastava <dhruvsri@google.com>2022-09-29 09:32:54 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-09-29 09:32:54 +0000
commitadf3bc524145018364732ff3359dcc4f872638bf (patch)
tree5b8db582826d2bd0a90d36c80af593128752be7e
parent4a628ac463027d1d475b7395edac7edf24de7990 (diff)
parente7f592bce1af560f8bd1945bb41c4f91b56d55d7 (diff)
Merge "Always take reviewers from new change"
-rw-r--r--polygerrit-ui/app/models/bulk-actions/bulk-actions-model.ts17
-rw-r--r--polygerrit-ui/app/models/bulk-actions/bulk-actions-model_test.ts56
2 files changed, 1 insertions, 72 deletions
diff --git a/polygerrit-ui/app/models/bulk-actions/bulk-actions-model.ts b/polygerrit-ui/app/models/bulk-actions/bulk-actions-model.ts
index b58fc3fe25..1d3802a58c 100644
--- a/polygerrit-ui/app/models/bulk-actions/bulk-actions-model.ts
+++ b/polygerrit-ui/app/models/bulk-actions/bulk-actions-model.ts
@@ -259,11 +259,7 @@ export class BulkActionsModel
if (selectableChangeNums !== currentState.selectableChangeNums) return;
const allDetailedChanges: Map<NumericChangeId, ChangeInfo> = new Map();
for (const detailedChange of changeDetails ?? []) {
- const basicChange = basicChanges.get(detailedChange._number)!;
- allDetailedChanges.set(
- detailedChange._number,
- this.mergeOldAndDetailedChangeInfos(basicChange, detailedChange)
- );
+ allDetailedChanges.set(detailedChange._number, detailedChange);
}
this.setState({
...currentState,
@@ -272,17 +268,6 @@ export class BulkActionsModel
});
}
- private mergeOldAndDetailedChangeInfos(
- originalChange: ChangeInfo,
- newData: ChangeInfo
- ) {
- return {
- ...originalChange,
- ...newData,
- reviewers: originalChange.reviewers,
- };
- }
-
private getNewReviewersToChange(
change: ChangeInfo,
state: ReviewerState,
diff --git a/polygerrit-ui/app/models/bulk-actions/bulk-actions-model_test.ts b/polygerrit-ui/app/models/bulk-actions/bulk-actions-model_test.ts
index 7bc37d65cd..2192246bf4 100644
--- a/polygerrit-ui/app/models/bulk-actions/bulk-actions-model_test.ts
+++ b/polygerrit-ui/app/models/bulk-actions/bulk-actions-model_test.ts
@@ -14,10 +14,8 @@ import {
NumericChangeId,
ChangeStatus,
HttpMethod,
- SubmitRequirementStatus,
AccountInfo,
ReviewerState,
- AccountId,
GroupInfo,
Hashtag,
} from '../../api/rest-api';
@@ -491,60 +489,6 @@ suite('bulk actions model test', () => {
);
});
- test('sync retains keys from original change including reviewers', async () => {
- const c1: ChangeInfo = {
- ...createChange(),
- _number: 1 as NumericChangeId,
- submit_requirements: [
- {
- name: 'a',
- status: SubmitRequirementStatus.FORCED,
- submittability_expression_result: {
- expression: 'b',
- },
- },
- ],
- reviewers: {
- REVIEWER: [{_account_id: 1 as AccountId, display_name: 'MyName'}],
- },
- };
-
- stubRestApi('getDetailedChangesWithActions').callsFake(() => {
- const change: ChangeInfo = {
- ...createChange(),
- _number: 1 as NumericChangeId,
- actions: {abandon: {}},
- // detailed data will be missing names
- reviewers: {REVIEWER: [createAccountWithIdNameAndEmail()]},
- };
- assert.isNotOk(change.submit_requirements);
- return Promise.resolve([change]);
- });
-
- bulkActionsModel.sync([c1]);
-
- await waitUntilObserved(
- bulkActionsModel.loadingState$,
- s => s === LoadingState.LOADED
- );
-
- const changeAfterSync = bulkActionsModel
- .getState()
- .allChanges.get(1 as NumericChangeId);
- assert.deepEqual(changeAfterSync!.submit_requirements, [
- {
- name: 'a',
- status: SubmitRequirementStatus.FORCED,
- submittability_expression_result: {
- expression: 'b',
- },
- },
- ]);
- assert.deepEqual(changeAfterSync!.actions, {abandon: {}});
- // original reviewers are kept, which includes more details than loaded ones
- assert.deepEqual(changeAfterSync!.reviewers, c1.reviewers);
- });
-
test('sync ignores outdated fetch responses', async () => {
const c1 = createChange();
c1._number = 1 as NumericChangeId;