Skip to content

fix: use a new function for adding notice for SSL issue and already o…#61

Open
Arukuen wants to merge 2 commits into
developfrom
feat/notice
Open

fix: use a new function for adding notice for SSL issue and already o…#61
Arukuen wants to merge 2 commits into
developfrom
feat/notice

Conversation

@Arukuen

@Arukuen Arukuen commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

…ptimized media

fixes #48
fixes #49
fixes #54

Summary by CodeRabbit

  • New Features

    • Introduced upload notification system displaying conversion and optimization messages within the Media Library sidebar.
    • Added notice alerting users when image conversion would result in a file larger than the original.
  • Bug Fixes

    • Fixed CSS syntax issue in media upload styling.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Arukuen, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 45 minutes and 33 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd0aec17-c16d-4894-a8b7-7b9b25e81892

📥 Commits

Reviewing files that changed from the base of the PR and between fa40017 and 3024ed4.

📒 Files selected for processing (1)
  • src/shared/upload-notice-cache.js
📝 Walkthrough

Walkthrough

This PR adds a transient upload-notice flow: converter results can carry notices, optimization handlers cache them by normalized filename, and media sidebar views read and render those notices. It also adds notice styling and fixes a CSS closing brace in the admin stylesheet.

Changes

Upload Notice Capture and Sidebar Rendering

Layer / File(s) Summary
Upload Notice cache primitives
src/shared/upload-notice-cache.js
Introduces cache key normalization, numeric suffix stripping, global in-memory notice storage, fallback lookup behavior, and cacheConverterNotice(result) for extracting and caching notices from optimizer output.
Optimization pipeline notice capture
src/shared/converters/image-converter.js, src/admin/js/media-manager/drop-zone.js, src/admin/js/media-manager/select-files.js
ImageConverter.convert() now includes a localized notice in the oversized-result early return path, and both optimization entry points call cacheConverterNotice(result) right after converter.optimize().
Attachment details notice render + styles
src/admin/js/media-manager/sidebar-info.js, src/admin/css/index.css
Adds injectCimoUploadNotice to retrieve a cached notice by attachment filename, prevent duplicate inserts, and append a plain-text notice node in both editor and two-column details renders; adds .cimo-media-upload-notice styles and closes a hover rule block with a missing brace fix.

Sequence Diagram(s)

sequenceDiagram
  participant Uploader
  participant Converter
  participant NoticeCache
  participant DetailsPanel
  participant SidebarDom

  Uploader->>Converter: optimize(file)
  Converter-->>Uploader: result with notice
  Uploader->>NoticeCache: cacheConverterNotice(result)
  DetailsPanel->>NoticeCache: getCachedUploadNotice(filename)
  NoticeCache-->>DetailsPanel: notice
  DetailsPanel->>SidebarDom: inject and display notice
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • gambitph/Cimo#39: Both change sets touch the same optimize-result flow in drop-zone.js and select-files.js, and this PR consumes converter notice data in that path.
  • gambitph/Cimo#34: Both modify media manager sidebar/details rendering paths and related conversion-to-UI integration points.

Poem

🐇 I cached a whisper from each upload hop,
then tucked it safe where filename echoes stop.
In sidebar grass, the tiny notices bloom,
with soft CSS they brighten every room.
Carrot cheers for clearer media news! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references SSL issues and already optimized media, which aligns with the main changes addressing issues #48, #49, and #54 in the PR objectives.
Linked Issues check ✅ Passed The PR implements all three linked issue requirements: caching notices for already-optimized media (#48), adding SSL-related notices (#49, #54), and integrating them into the media manager UI.
Out of Scope Changes check ✅ Passed All changes directly support the objectives: upload-notice cache module, notice integration in media-manager files, and CSS styling for the notice display.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/notice

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

🤖 Pull request artifacts

file commit
pr61-cimo-61-merge.zip 3024ed4

github-actions Bot added a commit that referenced this pull request Jun 11, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/shared/upload-notice-cache.js`:
- Around line 41-74: Add early guards in getCachedUploadNotice and
setCachedUploadNotice to ensure filename is truthy before calling getCacheKey;
if filename is falsy (null/undefined/empty) immediately return null (for
getters) or no-op (for setters). Locate uses of getCacheKey inside
getCachedUploadNotice and setCachedUploadNotice and short-circuit before
computing cacheKey/baseFileKey so you never read/write the "undefined" key in
window.cimoUploadNoticeCache.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52760490-8e8b-40f6-8651-4eea4b503bcf

📥 Commits

Reviewing files that changed from the base of the PR and between ddd2f82 and fa40017.

📒 Files selected for processing (6)
  • src/admin/css/index.css
  • src/admin/js/media-manager/drop-zone.js
  • src/admin/js/media-manager/select-files.js
  • src/admin/js/media-manager/sidebar-info.js
  • src/shared/converters/image-converter.js
  • src/shared/upload-notice-cache.js

Comment thread src/shared/upload-notice-cache.js
github-actions Bot added a commit that referenced this pull request Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant