Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch release v2024.12.03 #4830

Merged
merged 40 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
bcc2873
Add regression test for case where internal create channel method tri…
rtibbles Oct 9, 2024
0232932
Merge pull request #4785 from rtibbles/acting_up
rtibbles Oct 9, 2024
5d25fac
Revert accidental change to update as admin method.
rtibbles Oct 22, 2024
6726e56
tests and validation for invalid uuid
ozer550 Oct 22, 2024
624963b
Merge pull request #4794 from ozer550/add-validation-for-pk-public-api
rtibbles Nov 6, 2024
710927f
Add two defensive programming checks to stop 500s when getting channe…
rtibbles Nov 6, 2024
e18df39
Require the root node to have descendant resources, not just descenda…
rtibbles Nov 6, 2024
86062a3
optimize garabge collection command
ozer550 Nov 8, 2024
d2e9353
fix model in the query
ozer550 Nov 8, 2024
4f962db
Add pagination to trash modal.
rtibbles Nov 8, 2024
7c31713
Add pagination to move modal.
rtibbles Nov 8, 2024
41615c1
Add pagination to import modal.
rtibbles Nov 8, 2024
b849dbc
indiviually loop through contentnodes for updates
ozer550 Nov 11, 2024
3ef9044
Merge pull request #4807 from rtibbles/channel_details_modal
bjester Nov 12, 2024
7038023
avoid iterating over every channel
ozer550 Nov 13, 2024
5a26027
Adds missing string(IMSCP) for HTML5 file type
akolson Nov 13, 2024
d8f95b5
Merge pull request #4818 from akolson/adds-missing-imscp-string
bjester Nov 13, 2024
eb3aadc
Merge pull request #4808 from ozer550/optimize-garbage-collection-com…
bjester Nov 14, 2024
0ab30af
clean up migrations
ozer550 Oct 7, 2024
c874a46
Merge pull request #4821 from bjester/pick-migration-removal
bjester Nov 14, 2024
faa4274
Merge pull request #4791 from rtibbles/going_into_administration
bjester Nov 14, 2024
928d5b8
Update loadChildren mock in trash model tests.
rtibbles Nov 14, 2024
78b3b71
Merge pull request #4810 from rtibbles/paging_dr_idiot
rtibbles Nov 14, 2024
3288945
Update node details query to use CTE, and more robust tests
bjester Nov 15, 2024
2ee61dc
Add analytics for viewing details
bjester Nov 15, 2024
dad41bb
Remove bucket persistence in tests
bjester Nov 15, 2024
6cc44b4
Use CTE for server rev query, add tests
bjester Nov 15, 2024
e349e81
Merge pull request #4824 from bjester/far-fetching-sql-details
rtibbles Nov 15, 2024
f1caf61
Merge pull request #4826 from bjester/load-channel-rev
rtibbles Nov 15, 2024
f0f196d
Merge pull request #4831 from learningequality/master
bjester Nov 19, 2024
63f033c
Add signal handler that runs postgres setting on connection created
bjester Nov 20, 2024
bccbaa7
Merge pull request #4834 from bjester/jit-setting
rtibbles Nov 20, 2024
5045248
Conditionalize the setting
bjester Nov 20, 2024
39fecd2
Merge pull request #4835 from bjester/jit-setting
rtibbles Nov 20, 2024
dd3ae5a
Fixes sorting order of trash items
akolson Dec 3, 2024
81d0d21
Optimize language existant query
bjester Dec 3, 2024
6a76e74
Merge pull request #4845 from akolson/fix-trash
bjester Dec 3, 2024
b3c96fe
Merge pull request #4847 from bjester/inherit-modal
bjester Dec 3, 2024
5be153e
Prevent inherit modal from appearing when sorting items in a folder t…
bjester Dec 3, 2024
161a0b4
Merge pull request #4849 from bjester/no-mo-modal
rtibbles Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ migrate:
# 4) Remove the management command from this `deploy-migrate` recipe
# 5) Repeat!
deploy-migrate:
python contentcuration/manage.py rectify_incorrect_contentnode_source_fields
echo "Nothing to do here!"

contentnodegc:
python contentcuration/manage.py garbage_collect
Expand Down
3 changes: 3 additions & 0 deletions contentcuration/contentcuration/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class ContentConfig(AppConfig):
name = 'contentcuration'

def ready(self):
# Import signals
import contentcuration.signals # noqa

if settings.AWS_AUTO_CREATE_BUCKET and not is_gcs_backend():
from contentcuration.utils.minio_utils import ensure_storage_bucket_public
ensure_storage_bucket_public()
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
<VDivider v-if="index < children.length - 1" :key="`move-divider-${node.id}`" />
</template>
</VList>
<div class="show-more-button-container">
<KButton v-if="more" :disabled="moreLoading" @click="loadMore">
{{ showMoreLabel }}
</KButton>
</div>
</VFlex>
<ResourceDrawer
:nodeId="previewNodeId"
Expand Down Expand Up @@ -146,6 +151,13 @@
import Thumbnail from 'shared/views/files/Thumbnail';
import { ContentKindsNames } from 'shared/leUtils/ContentKinds';
import { titleMixin } from 'shared/mixins';
import { createTranslator } from 'shared/i18n';

// Can't use cross component translator to get the NodePanel translations
// here, because the NodePanel component imports this component.
const showMoreTranslator = createTranslator('NodePanel', {
showMore: 'Show more',
});

export default {
name: 'MoveModal',
Expand Down Expand Up @@ -182,6 +194,8 @@
return {
showNewTopicModal: false,
loading: false,
more: null,
moreLoading: false,
moveNodesInProgress: false,
targetNodeId: null,
previewNodeId: null,
Expand Down Expand Up @@ -234,6 +248,10 @@
crumbs() {
return this.getContentNodeAncestors(this.targetNodeId, true) || [];
},
showMoreLabel() {
// eslint-disable-next-line kolibri/vue-no-undefined-string-uses
return showMoreTranslator.$tr('showMore');
},
},
watch: {
targetNodeId() {
Expand All @@ -247,7 +265,7 @@
this.targetNodeId = this.currentLocationId || this.rootId;
},
methods: {
...mapActions('contentNode', ['createContentNode', 'loadChildren']),
...mapActions('contentNode', ['createContentNode', 'loadChildren', 'loadContentNodes']),
isDisabled(node) {
return this.moveNodeIds.includes(node.id);
},
Expand All @@ -272,8 +290,9 @@
return this.loadChildren({
parent: this.targetNodeId,
root_id: this.rootId,
}).then(() => {
}).then(childrenResponse => {
this.loading = false;
this.more = childrenResponse.more || null;
});
}
return Promise.resolve();
Expand Down Expand Up @@ -302,6 +321,15 @@
});
this.moveNodesInProgress = false;
},
loadMore() {
if (this.more && !this.moreLoading) {
this.moreLoading = true;
this.loadContentNodes(this.more).then(response => {
this.more = response.more || null;
this.moreLoading = false;
});
}
},
},
$trs: {
moveItems:
Expand Down Expand Up @@ -350,4 +378,11 @@
}
}

.show-more-button-container {
display: flex;
justify-content: center;
width: 100%;
margin-bottom: 10px;
}

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@
},
inheritanceParent() {
const firstNode = this.currentInheritingNodes[0];

if (!firstNode) {
return;
}
Expand Down Expand Up @@ -726,6 +727,7 @@
handleDragDrop(drop) {
const { data } = drop;
const { identity, section, relative } = data.target;
const targetMetadata = identity.metadata || {};
const isTargetTree =
drop.target && drop.target.region && drop.target.region.id === DraggableRegions.TREE;

Expand All @@ -742,7 +744,7 @@
position = this.relativePosition(relative > DraggableFlags.NONE ? relative : section);
} else {
// Safety check
const { kind } = identity.metadata || {};
const { kind } = targetMetadata;
if (kind && kind !== ContentKindsNames.TOPIC) {
return Promise.reject('Cannot set child of non-topic');
}
Expand All @@ -756,7 +758,7 @@
const sources = drop.sources || [];
const sourceRegion = sources.length > 0 ? sources[0].region : null;
const payload = {
target: identity.metadata.id,
target: targetMetadata.id,
position,
};

Expand All @@ -765,7 +767,7 @@
// `excluded_descendants` by accessing the copy trees through the clipboard node ID
if (sourceRegion && sourceRegion.id === DraggableRegions.CLIPBOARD) {
return Promise.all(
data.sources.map(source => {
sources.map(source => {
// Using `getCopyTrees` we can access the `excluded_descendants` for the node, such
// that we make sure to skip copying nodes that aren't intended to be copied
const trees = this.getCopyTrees(source.metadata.clipboardNodeId, true);
Expand All @@ -789,10 +791,27 @@
);
}

// We want to avoid launching the inherit modal when the move operation is a prepend or
// append move, and target is the current parent. When the move operation is relative to
// the target, that is left or right, we want only launch the modal if the parent is
// changing
let inherit = false;
if (
position === RELATIVE_TREE_POSITIONS.FIRST_CHILD ||
position === RELATIVE_TREE_POSITIONS.LAST_CHILD
) {
inherit = !sources.some(s => s.metadata.parent === targetMetadata.id);
} else if (
position === RELATIVE_TREE_POSITIONS.LEFT ||
position === RELATIVE_TREE_POSITIONS.RIGHT
) {
inherit = !sources.some(s => s.metadata.parent === targetMetadata.parent);
}

return this.moveContentNodes({
...payload,
id__in: data.sources.map(s => s.metadata.id),
inherit: !data.sources.some(s => s.metadata.parent === payload.target),
id__in: sources.map(s => s.metadata.id),
inherit,
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
/>
</VFlex>
</VLayout>
<div class="show-more-button-container">
<KButton v-if="more" :disabled="moreLoading" @click="loadMore">
{{ showMoreLabel }}
</KButton>
</div>
</div>
</VContainer>

Expand All @@ -55,13 +60,17 @@
import intersectionBy from 'lodash/intersectionBy';
import { mapActions, mapGetters } from 'vuex';
import find from 'lodash/find';
import NodePanel from '../NodePanel';
import { RouteNames } from '../../constants';
import BrowsingCard from './BrowsingCard';
import Breadcrumbs from 'shared/views/Breadcrumbs';
import Checkbox from 'shared/views/form/Checkbox';
import LoadingText from 'shared/views/LoadingText';
import { constantsTranslationMixin } from 'shared/mixins';
import { ChannelListTypes } from 'shared/constants';
import { crossComponentTranslator } from 'shared/i18n';

const showMoreTranslator = crossComponentTranslator(NodePanel);

export default {
name: 'ContentTreeList',
Expand All @@ -85,6 +94,8 @@
data() {
return {
loading: false,
more: null,
moreLoading: false,
};
},
computed: {
Expand Down Expand Up @@ -142,39 +153,44 @@
...ancestorsLinks,
];
},
showMoreLabel() {
// eslint-disable-next-line kolibri/vue-no-undefined-string-uses
return showMoreTranslator.$tr('showMore');
},
},
watch: {
topicId(parent) {
topicId(newTopicId, oldTopicId) {
if (newTopicId !== oldTopicId && newTopicId) {
this.loadData();
}
},
},
created() {
this.loadData();
},
methods: {
...mapActions('contentNode', ['loadChildren', 'loadAncestors', 'loadContentNodes']),
loadData() {
this.loading = true;
return this.loadChildren({
parent,
const params = {
complete: true,
}).then(() => {
};
const channelListType = this.$route.query.channel_list || ChannelListTypes.PUBLIC;
if (channelListType === ChannelListTypes.PUBLIC) {
// TODO: load from public API instead
// TODO: challenging because of node_id->id and root_id->channel_id
params.published = true;
}

return Promise.all([
this.loadChildren({ parent: this.topicId, ...params }).then(childrenResponse => {
this.more = childrenResponse.more || null;
}),
this.loadAncestors({ id: this.topicId }),
]).then(() => {
this.loading = false;
});
},
},
mounted() {
this.loading = true;
const params = {
complete: true,
};
const channelListType = this.$route.query.channel_list || ChannelListTypes.PUBLIC;
if (channelListType === ChannelListTypes.PUBLIC) {
// TODO: load from public API instead
// TODO: challenging because of node_id->id and root_id->channel_id
params.published = true;
}

return Promise.all([
this.loadChildren({ parent: this.topicId, ...params }),
this.loadAncestors({ id: this.topicId }),
]).then(() => {
this.loading = false;
});
},
methods: {
...mapActions('contentNode', ['loadChildren', 'loadAncestors']),
// @public
scrollToNode(nodeId) {
const ref = this.$refs[nodeId];
Expand All @@ -187,6 +203,15 @@
toggleSelected(node) {
this.$emit('change_selected', { nodes: [node], isSelected: !this.isSelected(node) });
},
loadMore() {
if (this.more && !this.moreLoading) {
this.moreLoading = true;
this.loadContentNodes(this.more).then(response => {
this.more = response.more || null;
this.moreLoading = false;
});
}
},
},
$trs: {
allChannelsLabel: 'Channels',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
this.currentChannel.publishing ||
!this.isChanged ||
!this.currentChannel.language ||
(this.rootNode && !this.rootNode.total_count)
(this.rootNode && !this.rootNode.resource_count)
);
},
publishButtonTooltip() {
Expand Down
Loading
Loading