Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Set unpublishable: true on PublishedChange by construction to simplify handleMaxRevs predicate

Đang mở Phù hợp với người mới
#5,868 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với các constructor PublishedChange và PublishedNextChange trong changes.js, sau đó kiểm tra predicate lastChannelEditIndex trong serverSync.js. Cập nhật các constructor và loại bỏ điều kiện kiểu dư thừa, rồi chạy các bài kiểm thử PublishedChange hiện có trong changes.spec.js và xác minh rằng unpublished_changes vẫn chính xác sau một sự kiện publish.

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

Mô tả

DEV: frontend P3 - low

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

Current behavior

In serverSync.js, handleMaxRevs uses findLastIndex to compute two values for deciding whether to set unpublished_changes = true on a channel:

  • lastChannelEditIndex — the last publishable change, filtered (among other conditions) with c.type !== CHANGE_TYPES.PUBLISHED
  • lastPublishIndex — the last publish change, matched with c.type === CHANGE_TYPES.PUBLISHED

The predicate for lastChannelEditIndex already includes !c.unpublishable, making the explicit c.type !== CHANGE_TYPES.PUBLISHED check partially redundant: if PublishedChange always set unpublishable: true, the type check would be unnecessary.

Desired behavior

PublishedChange and PublishedNextChange set unpublishable: true by construction (in its constructor in changes.js), so the c.type !== CHANGE_TYPES.PUBLISHED guard in handleMaxRevs can be removed. The !c.unpublishable check alone is sufficient to exclude publish changes from lastChannelEditIndex.

This makes the semantics self-contained in the change object — callers don't need to know the type mapping — and reduces the risk of future change types being accidentally treated as publishable.

Acceptance Criteria

  • PublishedChange constructor in changes.js sets unpublishable: true unconditionally
  • The c.type !== CHANGE_TYPES.PUBLISHED condition is removed from the lastChannelEditIndex predicate in handleMaxRevs (serverSync.js)
  • Existing tests for PublishedChange in changes.spec.js pass (updated if needed to assert unpublishable: true)
  • unpublished_changes continues to be set correctly after a publish event (no regression)

References

Follow-up to https://github.com/learningequality/studio/pull/5844#discussion_r3125011603

AI usage

This issue was drafted with Claude Code assistance from session context and code review.

Ngôn ngữ chính
Python
Star
212
Fork
314
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
57

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ề Python

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.