Skip to content

fix: allow closing draft CLs and fix draft list ordering#1982

Merged
benjamin-747 merged 3 commits into
gitmono-dev:mainfrom
WiedersehenM:feat/cl-draft-close-and-sort-fix
Mar 3, 2026
Merged

fix: allow closing draft CLs and fix draft list ordering#1982
benjamin-747 merged 3 commits into
gitmono-dev:mainfrom
WiedersehenM:feat/cl-draft-close-and-sort-fix

Conversation

@WiedersehenM

Copy link
Copy Markdown
Contributor

Summary

  • Allow draft change lists (CLs) to be closed via the existing close API.
  • Fix ordering of CL list so newly created CLs (including drafts) appear first as expected.

Changes

  • Updated close_cl handler to close CLs when their status is either Open or Draft, and still record a Closed conversation event.
  • Removed the unconditional ORDER BY id ASC from ClStorage::get_cl_list to avoid overriding user-specified sort options.
  • Applied dynamic sorting based on sort_by (created_at or updated_at) and asc, and defaulted to ORDER BY id DESC when no sort field is provided so newest CLs show up on the first page.

Notes

  • Reviewer and merge flows remain blocked for draft CLs; this change only affects closing and list ordering.

- Allow /api/v1/cl/{link}/close to close both Open and Draft change lists so draft CLs can be closed from the UI
- Remove default ORDER BY id ASC in CL list query and respect created_at/updated_at sorting
- Ensure newly created draft CLs appear on the first page when sorted by latest creation time

Signed-off-by: Hongze Gao <15101764808@163.com>
@github-actions

github-actions Bot commented Mar 3, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87d979a024

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread jupiter/src/storage/cl_storage.rs Outdated
Comment on lines +112 to +113
if params.sort_by.is_none() {
sorted_query = sorted_query.order_by_desc(mega_cl::Column::Id);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve default ordering when sort field is unrecognized

In get_cl_list, the fallback sort now runs only when sort_by is None, but the request model still accepts any sort_by string (ceres/src/model/change_list.rs), and apply_sort silently ignores unknown keys. If a client sends an unexpected value (e.g. typo or older field name), this path skips both dynamic sort and fallback, producing an unordered paginated query; that can cause unstable page results (items shifting/duplicating across pages). Before this change, the base ORDER BY id ASC at least kept pagination deterministic for invalid sort inputs.

Useful? React with 👍 / 👎.

- Ensure CL list falls back to ORDER BY id DESC when no valid sort field is provided
- Treat unknown sort_by values the same as missing ones to keep pagination stable
- Preserve created_at/updated_at based ordering when a recognized sort field is passed

Signed-off-by: Hongze Gao <15101764808@163.com>
@github-actions

github-actions Bot commented Mar 3, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

Signed-off-by: Hongze Gao <15101764808@163.com>
@github-actions

github-actions Bot commented Mar 3, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@benjamin-747 benjamin-747 added this pull request to the merge queue Mar 3, 2026
Merged via the queue into gitmono-dev:main with commit c7d9c89 Mar 3, 2026
9 of 10 checks passed
@WiedersehenM WiedersehenM deleted the feat/cl-draft-close-and-sort-fix branch March 11, 2026 13:00
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.

2 participants