Publishing a draft of a public channel replaces its kolibri_public rows with the draft

Đang mở
#6,471 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
10/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
django, python
Lĩnh vực
backend, databases, testing

Hướng nghiên cứu

Read create_content_database in contentcuration/contentcuration/utils/publish.py and the mapper in contentcuration/kolibri_public/utils/mapper.py; trace how publish_next handles draft publishes from the main and staging trees. Then inspect the backend publish tests and add coverage for a full publish followed by a draft publish. Done means draft publishing preserves the prior kolibri_public metadata and content rows, while a full publish still replaces them.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug DEV: backend

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: unstable

Observed behavior

create_content_database maps the content database it has just built into kolibri_public whenever channel.public is true (publish.py#L203-L205), and does not check is_draft_version. A draft publish reaches it through publish_next, which accepts public channels.

The mapper deletes the channel's existing kolibri_public tree and writes the draft in its place (mapper.py#L53-L71). The draft ChannelMetadata has version 0 (publish.py#L839), and with use_staging_tree its nodes come from the staging tree.

Expected behavior

A draft publish leaves the channel's kolibri_public rows as the last full publish wrote them. The publish panel says so: "without altering the current version available for Kolibri users" (communityChannelsStrings.js#L41-L44).

User-facing consequences

  • Kolibri's Learn → Explore libraries shows the draft's topics and resources for the channel, to every Kolibri user, until the channel is next published in full.
  • /api/public/v2/channel/<channel_id>/ returns "version": 0 for the channel.

Steps to reproduce

  1. Sign in as a user with the draft_channels feature flag who can edit a public, published channel.
  2. Rename a resource in the channel.
  3. Choose Publish, select Publish draft channel, then Save draft.
  4. When the draft publish finishes, request /api/public/v2/channel/<channel_id>/ and /api/public/v2/contentnode/?channel_id=<channel_id>.

The channel has "version": 0 and the renamed resource has its new title.

Context

Studio hotfixes at 9b766019d6; unstable has the same check at publish.py#L206.

Acceptance Criteria

  • After a draft publish of a public channel, from the main tree or the staging tree, the channel's kolibri_public.ChannelMetadata.version and its kolibri_public.ContentNode rows are the ones the last full publish wrote.
  • A full publish of a public channel still replaces its kolibri_public rows.
  • A backend test publishes a public channel, edits it, publishes a draft, and asserts the kolibri_public rows did not change.

AI usage

Claude Code found this by reading create_content_database while reviewing the plan for #6469, and drafted this issue.

Ngôn ngữ chính
JavaScript
Star
214
Fork
327
Merge trung bình
17 giờ 5 phút
Pull request đã merge (30 ngày)
25

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của learningequality/studio

Tất cả issue của learningequality/studio

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.