Skip to content

Commit 9b42068

Browse files
authored
Merge pull request #5591 from learningequality/hotfixes
Hotfixes into unstable
2 parents 0c49081 + 821c2f0 commit 9b42068

13 files changed

Lines changed: 112 additions & 50 deletions

File tree

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditBooleanMapModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
},
9696
data() {
9797
return {
98-
updateDescendants: false,
98+
updateDescendants: true,
9999
error: '',
100100
/**
101101
* selectedValues is an object with the following structure:

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditLanguageModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
return {
9393
selectedLanguage: '',
9494
searchQuery: '',
95-
updateDescendants: false,
95+
updateDescendants: true,
9696
isMultipleNodeLanguages: false,
9797
changed: false,
9898
};

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/EditTitleDescriptionModal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
id: nodeId,
9999
title: title.trim(),
100100
description: description.trim(),
101+
checkComplete: true,
101102
});
102103
/* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */
103104
this.$store.dispatch('showSnackbarSimple', commonStrings.$tr('changesSaved'));

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/__tests__/EditBooleanMapModal.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,11 @@ describe('EditBooleanMapModal', () => {
275275
expect(wrapper.find('[data-test="update-descendants-checkbox"]').exists()).toBeFalsy();
276276
});
277277

278-
test('should call updateContentNode on success submit if the user does not check the update descendants checkbox', async () => {
278+
test('should call updateContentNode on success submit if the user uncheck the update descendants checkbox', async () => {
279279
nodes['node1'].kind = ContentKindsNames.TOPIC;
280280

281281
const wrapper = makeWrapper({ nodeIds: ['node1'], isDescendantsUpdatable: true });
282+
wrapper.find('[data-test="update-descendants-checkbox"]').element.click();
282283
await wrapper.vm.handleSave();
283284

284285
expect(contentNodeActions.updateContentNode).toHaveBeenCalledWith(expect.anything(), {
@@ -287,11 +288,10 @@ describe('EditBooleanMapModal', () => {
287288
});
288289
});
289290

290-
test('should call updateContentNodeDescendants on success submit if the user checks the descendants checkbox', async () => {
291+
test('should call updateContentNodeDescendants on success submit if the user does not uncheck the update descendants checkbox', async () => {
291292
nodes['node1'].kind = ContentKindsNames.TOPIC;
292293

293294
const wrapper = makeWrapper({ nodeIds: ['node1'], isDescendantsUpdatable: true });
294-
wrapper.find('[data-test="update-descendants-checkbox"]').element.click();
295295
await wrapper.vm.handleSave();
296296

297297
expect(contentNodeActions.updateContentNodeDescendants).toHaveBeenCalledWith(

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/__tests__/EditLanguageModal.spec.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ describe('EditLanguageModal', () => {
220220
});
221221

222222
describe('topic nodes present', () => {
223-
it('should display the checkbox to apply change to descendants if a topic is present', () => {
224-
[wrapper] = makeWrapper(['test-en-topic', 'test-en-res']);
223+
test('should display a selected checkbox to apply change to descendants if a topic is present', () => {
224+
const [wrapper] = makeWrapper(['test-en-topic', 'test-en-res']);
225225

226226
expect(
227227
wrapper.findComponent('[data-test="update-descendants-checkbox"]').exists(),
@@ -236,30 +236,33 @@ describe('EditLanguageModal', () => {
236236
).toBeFalsy();
237237
});
238238

239-
it('should call updateContentNode with the right language on success submit if the user does not check the checkbox', async () => {
240-
[wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
239+
test('should call updateContentNodeDescendants with the right language on success submit by default', async () => {
240+
const [wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
241241

242242
await chooseLanguage(wrapper, 'es');
243243
await wrapper.vm.handleSave();
244-
await wrapper.vm.$nextTick();
245244

246-
expect(mocks.updateContentNode).toHaveBeenCalledWith({
245+
expect(mocks.updateContentNodeDescendants).toHaveBeenCalledWith({
247246
id: 'test-en-topic',
248247
language: 'es',
249248
});
250249
});
251250

252-
it('should call updateContentNodeDescendants with the right language on success submit if the user checks the checkbox', async () => {
253-
[wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
251+
test('should call updateContentNode with the right language on success submit if the user unchecks check the checkbox', async () => {
252+
const [wrapper, mocks] = makeWrapper(['test-en-topic', 'test-en-res']);
254253

255254
await chooseLanguage(wrapper, 'es');
256-
wrapper.findComponent('[data-test="update-descendants-checkbox"]').vm.$emit('change', true);
255+
256+
// Uncheck the descendants checkbox
257+
const descendantsCheckbox = wrapper.findComponent(
258+
'[data-test="update-descendants-checkbox"]',
259+
);
260+
descendantsCheckbox.vm.$emit('change', false);
257261
await wrapper.vm.$nextTick();
258-
expect(wrapper.vm.updateDescendants).toBe(true);
262+
259263
await wrapper.vm.handleSave();
260-
await wrapper.vm.$nextTick();
261264

262-
expect(mocks.updateContentNodeDescendants).toHaveBeenCalledWith({
265+
expect(mocks.updateContentNode).toHaveBeenCalledWith({
263266
id: 'test-en-topic',
264267
language: 'es',
265268
});

contentcuration/contentcuration/frontend/channelEdit/components/QuickEditModal/__tests__/EditTitleDescriptionModal.spec.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ describe('EditTitleDescriptionModal', () => {
3333
},
3434
},
3535
}),
36-
propsData: {
37-
nodeId,
38-
},
36+
propsData: { nodeId },
3937
});
4038

4139
updateContentNode = jest.spyOn(wrapper.vm, 'updateContentNode').mockImplementation(() => {});
@@ -70,7 +68,8 @@ describe('EditTitleDescriptionModal', () => {
7068
expect(updateContentNode).toHaveBeenCalledWith({
7169
id: nodeId,
7270
title: newTitle,
73-
description: newDescription,
71+
description: newDescription ?? '',
72+
checkComplete: true,
7473
});
7574
});
7675

@@ -80,11 +79,11 @@ describe('EditTitleDescriptionModal', () => {
8079
descriptionInput.vm.$emit('input', '');
8180

8281
modal.vm.$emit('submit');
83-
8482
expect(updateContentNode).toHaveBeenCalledWith({
8583
id: nodeId,
8684
title: newTitle,
8785
description: '',
86+
checkComplete: true,
8887
});
8988
});
9089

contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
slider-color="primary"
7575
>
7676
<VTab
77-
class="px-2"
77+
href="#questions"
78+
class="pa-1"
7879
exact
7980
@change="tab = 'questions'"
8081
>
@@ -86,7 +87,8 @@
8687
/>
8788
</VTab>
8889
<VTab
89-
class="px-2"
90+
href="#details"
91+
class="pa-1"
9092
exact
9193
@change="tab = 'details'"
9294
>

contentcuration/contentcuration/frontend/channelEdit/components/edit/DetailsTabView.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@
499499
} from 'shared/constants';
500500
import { constantsTranslationMixin, metadataTranslationMixin } from 'shared/mixins';
501501
import { crossComponentTranslator } from 'shared/i18n';
502+
import { LanguagesNames } from 'shared/leUtils/Languages';
502503
503504
function getValueFromResults(results) {
504505
if (results.length === 0) {
@@ -715,7 +716,17 @@
715716
},
716717
},
717718
role: generateGetterSetter('role_visibility'),
718-
language: generateGetterSetter('language'),
719+
language: {
720+
get() {
721+
const value = this.getValueFromNodes('language');
722+
return value === nonUniqueValue ? LanguagesNames.MUL : value;
723+
},
724+
set(value) {
725+
if (!(value === LanguagesNames.MUL && this.language === LanguagesNames.MUL)) {
726+
this.update({ language: value });
727+
}
728+
},
729+
},
719730
accessibility: generateNestedNodesGetterSetter('accessibility_labels'),
720731
contentLevel: generateNestedNodesGetterSetterObject('grade_levels'),
721732
resourcesNeeded: generateNestedNodesGetterSetterObject('learner_needs'),

contentcuration/contentcuration/frontend/channelEdit/views/ImportFromChannels/SearchResultsList.vue

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33
<div>
44
<!-- Filters -->
55
<SearchFilterBar />
6-
<VLayout row>
7-
<VFlex shrink>
8-
<SearchFilters :searchResults="nodes" />
9-
</VFlex>
10-
11-
<!-- Main area with cards -->
12-
<VFlex class="pl-4">
6+
<KGrid>
7+
<KGridItem
8+
:layout4="{ span: 4 }"
9+
:layout8="{ span: 3 }"
10+
:layout12="{ span: 5 }"
11+
>
12+
<SearchFilters
13+
style="width: 100%"
14+
:searchResults="nodes"
15+
/>
16+
</KGridItem>
17+
<KGridItem
18+
:layout4="{ span: 4 }"
19+
:layout8="{ span: 5 }"
20+
:layout12="{ span: 7 }"
21+
>
1322
<VContainer v-if="loadFailed">
1423
<p class="text-xs-center">
1524
<Icon icon="error" />
@@ -105,8 +114,8 @@
105114
</div>
106115
</div>
107116
</VContainer>
108-
</VFlex>
109-
</VLayout>
117+
</KGridItem>
118+
</KGrid>
110119
</div>
111120

112121
</template>

contentcuration/contentcuration/frontend/channelEdit/views/trash/TrashModal.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,24 @@
281281
'moveContentNodes',
282282
'loadContentNodes',
283283
'loadAncestors',
284+
'removeContentNodes',
284285
]),
285286
loadNodes() {
286287
this.loading = true;
288+
this.more = null;
289+
this.moreLoading = false;
287290
if (!this.trashId) {
288291
this.loading = false;
289292
return;
290293
}
291-
this.loadChildren({ parent: this.trashId, ordering: '-modified' }).then(
292-
childrenResponse => {
293-
this.loading = false;
294-
this.more = childrenResponse.more || null;
295-
},
296-
);
294+
this.removeContentNodes({ parentId: this.trashId }).then(() => {
295+
this.loadChildren({ parent: this.trashId, ordering: '-modified' }).then(
296+
childrenResponse => {
297+
this.loading = false;
298+
this.more = childrenResponse.more || null;
299+
},
300+
);
301+
});
297302
},
298303
moveNodes(target) {
299304
return this.moveContentNodes({

0 commit comments

Comments
 (0)