Skip to content

Commit 6fb0141

Browse files
committed
Actually check that channel ids match in allChannelsHaveStats
1 parent d9c37b2 commit 6fb0141

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

kolibri/plugins/management/assets/src/state/manageContentActions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ export function refreshChannelList() {
2020
* @returns {Promise}
2121
*/
2222
export function deleteChannel(store, channelId) {
23-
return ChannelResource.getModel(channelId).delete()
23+
return ChannelResource.getModel(channelId)
24+
.delete()
2425
.then(() => {
2526
store.dispatch(mutationTypes.REMOVE_CHANNEL_FILE_SUMMARY, channelId);
2627
})
27-
.then(refreshChannelList)
28+
.then(refreshChannelList);
2829
}
2930

3031
/**

kolibri/plugins/management/assets/src/state/manageContentMutations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ function MANAGE_CONTENT_REMOVE_CHANNEL_FILE_SUMMARY(state, channelId) {
2828
export default {
2929
MANAGE_CONTENT_ADD_CHANNEL_FILE_SUMMARY,
3030
MANAGE_CONTENT_REMOVE_CHANNEL_FILE_SUMMARY,
31-
}
31+
};

kolibri/plugins/management/assets/src/views/manage-content-page/wizard-export.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
available: 'available',
6666
cancel: 'Cancel',
6767
export: 'Export',
68-
exportPromptPrefix: 'You are about to export {numChannels, number} {numChannels, plural, one {channel} other {channels}}',
68+
exportPromptPrefix:
69+
'You are about to export {numChannels, number} {numChannels, plural, one {channel} other {channels}}',
6970
notWritable: 'Not writable',
7071
refresh: 'Refresh',
7172
title: 'Export to where?',
@@ -86,7 +87,9 @@
8687
return !this.drivesLoading && !this.wizardState.busy && this.selectedDrive !== '';
8788
},
8889
exportContentSize() {
89-
const allChannelsHaveStats = this.allChannels.length === Object.keys(this.channelsWithStats).length;
90+
const allChannelsHaveStats = this.allChannels.reduce((flag, channel) => {
91+
return flag && Boolean(this.channelsWithStats[channel.id]);
92+
}, true);
9093
if (allChannelsHaveStats) {
9194
const totalSize = sumBy(Object.values(this.channelsWithStats), 'totalFileSizeInBytes');
9295
return bytesForHumans(totalSize);
@@ -117,7 +120,7 @@
117120
},
118121
vuex: {
119122
getters: {
120-
allChannels: (state) => state.core.channels.list,
123+
allChannels: state => state.core.channels.list,
121124
channelsWithStats: state => state.pageState.channelFileSummaries,
122125
wizardState: state => state.pageState.wizardState,
123126
},

0 commit comments

Comments
 (0)