Skip to content

Commit 2df4aae

Browse files
committed
Merge remote-tracking branch 'upstream/unstable' into merge-into-search-recs
2 parents 812a390 + 45bf94e commit 2df4aae

47 files changed

Lines changed: 2189 additions & 903 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/notify_team_new_comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
env:
2828
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
2929
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
30-
uses: slackapi/slack-github-action@v1.26.0
30+
uses: slackapi/slack-github-action@v1.27.0
3131
with:
3232
payload: |
3333
{

contentcuration/contentcuration/frontend/channelEdit/components/Clipboard/Channel.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<Checkbox
1313
ref="checkbox"
1414
class="ma-0 pa-0"
15+
:class="{ selectedIndeterminate: !selected && indeterminate }"
1516
:inputValue="selected"
1617
:indeterminate="indeterminate"
1718
@input="goNextSelectionState"
@@ -140,4 +141,8 @@
140141
line-height: 1.3 !important;
141142
}
142143
144+
/deep/ .selectedIndeterminate svg {
145+
fill: gray !important;
146+
}
147+
143148
</style>

contentcuration/contentcuration/frontend/channelEdit/components/Clipboard/ContentNode.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<Checkbox
3333
ref="checkbox"
3434
class="mt-0 pt-0"
35+
:class="{ selectedIndeterminate: !selected && indeterminate }"
3536
:inputValue="selected"
3637
:indeterminate="indeterminate"
3738
@input="goNextSelectionState"
@@ -303,4 +304,8 @@
303304
line-height: 1.3 !important;
304305
}
305306
307+
/deep/ .selectedIndeterminate svg {
308+
fill: gray !important;
309+
}
310+
306311
</style>

contentcuration/contentcuration/frontend/channelEdit/components/ContentNodeEditListItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</template>
4646

4747
<template #actions-end>
48-
<VListTileAction class="action-icon px-1" @click.stop>
48+
<VListTileAction v-if="canEdit" class="action-icon px-1" @click.stop>
4949
<transition name="fade">
5050
<IconButton
5151
icon="rename"

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

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
12
<template>
23

34
<KModal
45
:title="title"
56
:submitText="$tr('saveAction')"
7+
:submitDisabled="!canSave"
68
:cancelText="$tr('cancelAction')"
79
data-test="edit-booleanMap-modal"
810
@submit="handleSave"
@@ -11,6 +13,9 @@
1113
<p v-if="resourcesSelectedText.length > 0" data-test="resources-selected-message">
1214
{{ resourcesSelectedText }}
1315
</p>
16+
<p v-if="hasMixedCategories" data-test="mixed-categories-message">
17+
{{ hasMixedCategoriesMessage }}
18+
</p>
1419
<template v-if="isDescendantsUpdatable && isTopicSelected">
1520
<KCheckbox
1621
:checked="updateDescendants"
@@ -26,9 +31,6 @@
2631
:inputHandler="(value) => { selectedValues = value }"
2732
></slot>
2833

29-
<span v-if="error" class="red--text">
30-
{{ error }}
31-
</span>
3234
</KModal>
3335

3436
</template>
@@ -45,6 +47,7 @@
4547
import { mapGetters, mapActions } from 'vuex';
4648
import { ContentKindsNames } from 'shared/leUtils/ContentKinds';
4749
import { getInvalidText } from 'shared/utils/validation';
50+
import commonStrings from 'shared/translator';
4851
4952
export default {
5053
name: 'EditBooleanMapModal',
@@ -91,16 +94,27 @@
9194
*/
9295
selectedValues: {},
9396
changed: false,
97+
hasMixedCategories: false,
9498
};
9599
},
96100
computed: {
97-
...mapGetters('contentNode', ['getContentNodes']),
101+
...mapGetters('contentNode', ['getContentNodes', 'getContentNode']),
98102
nodes() {
99103
return this.getContentNodes(this.nodeIds);
100104
},
101105
isTopicSelected() {
102106
return this.nodes.some(node => node.kind === ContentKindsNames.TOPIC);
103107
},
108+
canSave() {
109+
if (this.hasMixedCategories) {
110+
return Object.values(this.selectedValues).some(value => value.length > 0);
111+
}
112+
return !this.error;
113+
},
114+
hasMixedCategoriesMessage() {
115+
// eslint-disable-next-line kolibri/vue-no-undefined-string-uses
116+
return commonStrings.$tr('addAdditionalCatgoriesDescription');
117+
},
104118
},
105119
watch: {
106120
selectedValues(newValue, oldValue) {
@@ -121,6 +135,9 @@
121135
});
122136
123137
this.selectedValues = optionsNodes;
138+
this.hasMixedCategories = Object.values(this.selectedValues).some(
139+
value => value.length < this.nodes.length
140+
);
124141
// reset
125142
this.$nextTick(() => {
126143
this.changed = false;
@@ -147,19 +164,20 @@
147164
}
148165
},
149166
async handleSave() {
150-
this.validate();
151-
if (this.error) {
152-
return;
153-
}
154-
155167
await Promise.all(
156-
this.nodes.map(node => {
168+
this.nodes.map(async node => {
157169
const fieldValue = {};
158-
Object.entries(this.selectedValues).forEach(([key, value]) => {
159-
if (value.includes(node.id)) {
170+
const currentNode = this.getContentNode(node.id);
171+
// If we have mixed categories remain the old ones, and
172+
// just add new categories if there are any
173+
if (this.hasMixedCategories) {
174+
Object.assign(fieldValue, currentNode[this.field] || {});
175+
}
176+
Object.entries(this.selectedValues)
177+
.filter(([value]) => value.length === this.nodeIds.length)
178+
.forEach(([key]) => {
160179
fieldValue[key] = true;
161-
}
162-
});
180+
});
163181
if (this.updateDescendants && node.kind === ContentKindsNames.TOPIC) {
164182
return this.updateContentNodeDescendants({
165183
id: node.id,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
v-model="selectedLanguage"
4343
:buttonValue="language.id"
4444
:label="languageText(language)"
45+
:labelDir="null"
4546
/>
4647
<p
4748
v-if="!languageOptions.length"
@@ -178,7 +179,7 @@
178179
'You selected resources in different languages. The language you choose below will be applied to all selected resources.',
179180
updateDescendantsCheckbox:
180181
'Apply the chosen language to all resources, folders, and subfolders contained within the selected folders.',
181-
emptyLanguagesSearch: 'No languages matches the search',
182+
emptyLanguagesSearch: 'No language matches the search',
182183
},
183184
};
184185

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<div>
44
<KModal
5-
v-if="!isAboutLicensesModalOpen"
65
:title="$tr('editAttribution')"
76
:submitText="$tr('saveAction')"
87
:cancelText="$tr('cancelAction')"
@@ -170,7 +169,6 @@
170169
/* eslint-enable kolibri/vue-no-unused-properties */
171170
},
172171
computed: {
173-
...mapGetters(['isAboutLicensesModalOpen']),
174172
...mapGetters('contentNode', ['getContentNodes']),
175173
...mapFormGettersSetters(sourceKeys),
176174
nodes() {

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

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ let generalActions;
1616
const CheckboxValue = {
1717
UNCHECKED: 'UNCHECKED',
1818
CHECKED: 'CHECKED',
19-
INDETERMINATE: 'INDETERMINATE',
2019
};
2120

2221
const { translateMetadataString } = metadataTranslationMixin.methods;
@@ -31,11 +30,9 @@ const getOptionsValues = wrapper => {
3130
const categories = {};
3231
const checkboxes = wrapper.findAll('[data-test="option-checkbox"]');
3332
checkboxes.wrappers.forEach(checkbox => {
34-
const { label, checked, indeterminate } = checkbox.vm.$props || {};
33+
const { label, checked } = checkbox.vm.$props || {};
3534
let value;
36-
if (indeterminate) {
37-
value = CheckboxValue.INDETERMINATE;
38-
} else if (checked) {
35+
if (checked) {
3936
value = CheckboxValue.CHECKED;
4037
} else {
4138
value = CheckboxValue.UNCHECKED;
@@ -182,26 +179,6 @@ describe('EditBooleanMapModal', () => {
182179
expect(dailyLifeValue).toBe(CheckboxValue.CHECKED);
183180
expect(foundationsValue).toBe(CheckboxValue.CHECKED);
184181
});
185-
186-
test('checkbox option should be indeterminate if not all nodes have the same options set', () => {
187-
nodes['node1'].categories = {
188-
[Categories.DAILY_LIFE]: true,
189-
[Categories.FOUNDATIONS]: true,
190-
};
191-
nodes['node2'].categories = {
192-
[Categories.DAILY_LIFE]: true,
193-
};
194-
195-
const wrapper = makeWrapper({ nodeIds: ['node1', 'node2'] });
196-
197-
const optionsValues = getOptionsValues(wrapper);
198-
const {
199-
[Categories.DAILY_LIFE]: dailyLifeValue,
200-
[Categories.FOUNDATIONS]: foundationsValue,
201-
} = optionsValues;
202-
expect(dailyLifeValue).toBe(CheckboxValue.CHECKED);
203-
expect(foundationsValue).toBe(CheckboxValue.INDETERMINATE);
204-
});
205182
});
206183
});
207184

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ let nodes;
99
let store;
1010
let contentNodeActions;
1111
let generalActions;
12-
let generalGetters;
1312

1413
const MIXED_VALUE = 'Mixed';
1514

@@ -64,12 +63,8 @@ describe('EditSourceModal', () => {
6463
generalActions = {
6564
showSnackbarSimple: jest.fn(),
6665
};
67-
generalGetters = {
68-
isAboutLicensesModalOpen: () => false,
69-
};
7066
store = new Vuex.Store({
7167
actions: generalActions,
72-
getters: generalGetters,
7368
modules: {
7469
contentNode: {
7570
namespaced: true,

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@
122122
</VFlex>
123123
</VLayout>
124124
</BottomBar>
125-
<AboutLicensesModal
126-
v-if="isAboutLicensesModalOpen"
127-
/>
128125
<InheritAncestorMetadataModal
129126
:parent="(createMode && detailNodeIds.length) ? parent : null"
130127
@inherit="inheritMetadata"
@@ -195,7 +192,6 @@
195192
import { fileSizeMixin, routerMixin } from 'shared/mixins';
196193
import FileStorage from 'shared/views/files/FileStorage';
197194
import MessageDialog from 'shared/views/MessageDialog';
198-
import AboutLicensesModal from 'shared/views/AboutLicensesModal';
199195
import ResizableNavigationDrawer from 'shared/views/ResizableNavigationDrawer';
200196
import Uploader from 'shared/views/files/Uploader';
201197
import LoadingText from 'shared/views/LoadingText';
@@ -226,7 +222,6 @@
226222
SavingIndicator,
227223
ToolBar,
228224
BottomBar,
229-
AboutLicensesModal,
230225
},
231226
mixins: [fileSizeMixin, routerMixin],
232227
props: {
@@ -260,7 +255,6 @@
260255
};
261256
},
262257
computed: {
263-
...mapGetters(['isAboutLicensesModalOpen']),
264258
...mapGetters('contentNode', ['getContentNode', 'getContentNodeIsValid']),
265259
...mapGetters('assessmentItem', ['getAssessmentItems']),
266260
...mapGetters('currentChannel', ['currentChannel', 'canEdit']),

0 commit comments

Comments
 (0)