Skip to content

Conversation

@taoerman
Copy link
Member

…annels

Summary

Adds backend validation to ensure channels cannot be both public (visible in Kolibri's library) and community channels (curated for Community Library) at the same time.

The implementation includes model validation, serializer validation, and API endpoint validation with clear error messages.

Comprehensive tests verify the mutual exclusivity rules work correctly across all layers.

Tests the new logic manually.

References

#5302

Reviewer guidance

run the unit tests

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good overall! Just found some little bugs with the tooltips on dropdown options, and a nitpick comment around the Python tests organization

},
isCommunityChannel() {
const status = this.channel.latest_community_library_submission_status;
return status === 'APPROVED' || status === 'LIVE';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly a nitpick, but it's usually a good idea to avoid the usage of "magic strings" and use constants instead, just in case anything changes, we would need to update just one place. Here we could use the CommunityLibraryStatus constant from here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Alex, I forgot using CommunityLibraryStatus instead of magic strings!! I've fixed.

</VListTile>
</div>
</template>
<span>This channel has been added to the Community Library and cannot be marked
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, this tooltip is appearing in the other corner of the screen.

Image

We are currently working on a "KDS to Studio" project, and we will eventually need to migrate this to use our KDropdownMenu, and that component does not provide support for tooltips on disabled options. So, to prevent that, I think another idea could be to show this message on the make public dialog here? And show the error message on the dialog and disable the submit button if the selected channel is in the community library.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That make sense.

Comment on lines 98 to 112
<VTooltip
v-if="currentChannel.public"
bottom
attach="body"
lazy
>
<template #activator="{ on }">
<div v-on="on">
<VListTile disabled>
<VListTileTitle>{{ $tr('submitToCommunityLibrary') }}</VListTileTitle>
</VListTile>
</div>
</template>
<span>{{ $tr('publicChannelCannotSubmitToCommunityLibrary') }}</span>
</VTooltip>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we already prevented a public channel from being submitted to the community library by showing a warning message and disable the submit button in the create submission side panel

Image

So, I think we can revert this change (also because this is showing the tooltip on the other corner of the screen for some reason).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this test to the public app tests instead? Seems like a more meaningful location, and perhaps a name like test_public_models_mutual_exclusivity may express the intention of the file a bit better? Just some thoughts, as right now contentcuration/tests/test_mutual_exclusivity does not sound like anything related to community channels or public channels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've removed!

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @taoerman! Code changes look good to me, and tests are working fine. Merging! :)

@AlexVelezLl AlexVelezLl merged commit e4c43a2 into learningequality:unstable Oct 28, 2025
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESoCC: Prevent inconsistent states beteween public channels and community channels

2 participants