Skip to content

fix(ui): mirror attachment-preview safety prompt for Hebrew - #1684

Open
nocturney wants to merge 2 commits into
UCSLabs:mainfrom
nocturney:night/l05-ucs-attachment-warning-rtl-20261119
Open

nocturney wants to merge 2 commits into
UCSLabs:mainfrom
nocturney:night/l05-ucs-attachment-warning-rtl-20261119

Conversation

@nocturney

@nocturney nocturney commented Nov 19, 2026 •

Copy link
Copy Markdown

What changes for the person using MailCraft

The attachment-preview safety prompt now follows the Hebrew reading direction: warning icon at the right edge, cautionary messages and preview/confirmation controls aligned to the right. The existing English/LTR row remains in the original branch of the layout, as do the real attachment safety restrictions, checkbox state and hit IDs.

This is an original source contribution to the official UCS MailCraft codebase. It does not add translations to the protected Hebrew catalogue. It is dormant on current official main until the proposed Hebrew locale in draft #1585 is registered.

Closes #1683. Related #1492 and #1585. Separate from deferred Unicode bidi work #483 and the reading-pane issue #603.

How it was checked

  • Exact official upstream main source was fetched before editing; branch contains only attachment_preview.rs plus its focused standalone attachment_preview_tests.rs.

  • git diff --check and Rust 2024 syntax parsing passed.

  • Headless egui regression tests the warning icon versus two text bounds for both left-to-right and right-to-left, without opening an attachment.

  • Focused Cargo test on exact HEAD 8973c28ccd7563ecccd8b93bf8912ea319a54210: PASSED, 1/1, 0 failures (2,299 other tests filtered), Mac-Bedroom.local, cargo test --locked --offline -p mailcraft-ui-egui attachment_safety_warning_mirrors_reading_edge. Initial isolated test attempt revealed wrong egui API ctx.run; committed test was fixed to ctx.run_ui, recompiled and passed. Headless layout regression only; Native Hebrew screenshot not done.

  • Native Hebrew screenshot and full cargo xtask ci: not run; no current integrated Hebrew UI exists on main.

  • No real mailbox, file preview, content execution, mail send, user session or installed application was changed.

  • cargo xtask ci passes (not run)

  • Focused LTR/RTL headless geometry test passes at exact HEAD

  • Native Hebrew/LTR screenshot check (not run)

  • Allow edits by maintainers (verify on PR readback)

  • I have personally signed the CLA (not verified; do not assume)

Summary by CodeRabbit

  • Bug Fixes
    • Improved the attachment safety prompt layout for Hebrew, aligning warning details and icons right-to-left. Other languages retain the existing layout.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The attachment safety prompt now checks whether the current language code is he. It uses a right-to-left warning row and right-aligned details for Hebrew, while retaining the existing layout otherwise. A geometry test checks icon and caption alignment in both directions.

Changes: Attachment warning layout

Layer / File(s) Summary
RTL warning layout and validation
crates/ui-egui/src/attachment_preview.rs, crates/ui-egui/src/attachment_preview_tests.rs
The prompt selects RTL-aware layout helpers for Hebrew. The test checks icon placement and caption alignment in RTL and LTR modes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Low

Possibly related PRs

Suggested reviewers: ferivoq, benandez

Merge Risk: Minimal · up to 8973c

This change mirrors the attachment safety prompt layout for Hebrew and leaves the existing layout otherwise unchanged. No concrete merge-blocking risk was found. The change stays dormant until the Hebrew locale is registered.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #1683 requires a Hebrew branch (current().code() == "he") in preview_prompt that places the warning icon at the right reading edge and right-aligns the notice and choice column. It also requ… Provide readable evidence of the attachment_preview.rs diff, or a readable blob for the file at the head. Confirm that preview_prompt branches on current().code() == "he" and that the LTR branch and its checkbox and hit IDs are unchan…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the change: a Hebrew (RTL) mirroring of the attachment-preview safety prompt in the ui-egui crate. It matches the raw summary, which describes RTL-aware layout helpers for the prompt, …
Out of Scope Changes check Passed The whole-PR file set, as described by the PR summary and the diff of attachment_preview_tests.rs, contains two files. Both belong to the attachment-preview safety prompt. The source file adds RTL-a…
Description check Passed The description covers the required sections in substance. It explains what changes for MailCraft users (Hebrew RTL layout for the attachment safety prompt, with the LTR branch kept) and gives detaile…
Full details: Title check

Explanation

The title names the change: a Hebrew (RTL) mirroring of the attachment-preview safety prompt in the ui-egui crate. It matches the raw summary, which describes RTL-aware layout helpers for the prompt, and the PR objectives, which target the Hebrew layout of preview_prompt. The conventional-commit prefix 'fix(ui)' fits a layout correction, and the title is specific and concise.

Full details: Out of Scope Changes check

Explanation

The whole-PR file set, as described by the PR summary and the diff of attachment_preview_tests.rs, contains two files. Both belong to the attachment-preview safety prompt. The source file adds RTL-aware helpers and a mod declaration for the test module. The test file adds a synthetic headless geometry test. The PR does not change mailbox, file preview, content execution, mail send, or locale catalogue code, according to the description and summary. No unrelated change is demonstrated. This assessment does not rely on the unreadable attachment_preview.rs diff; it relies on the PR summary for that file.

Full details: Description check

Explanation

The description covers the required sections in substance. It explains what changes for MailCraft users (Hebrew RTL layout for the attachment safety prompt, with the LTR branch kept) and gives detailed verification notes. It also states that the focused headless geometry test passed at the exact HEAD. Two template items are not complete: "cargo xtask ci" was not run, and the "Closes #" line is filled with #1683 but the issue linkage is written as prose. The CLA and "Allow edits by maintainers" boxes are unchecked and unverified, which the author states openly. The description is mostly complete, so this check passes. The unchecked boxes should still be resolved before merge.

Full details: Linked Issues check

Explanation

Issue #1683 requires a Hebrew branch (current().code() == "he") in preview_prompt that places the warning icon at the right reading edge and right-aligns the notice and choice column. It also requires the LTR row, checkbox behavior, hit IDs, and safety checks to remain unchanged. The new test attachment_safety_warning_mirrors_reading_edge in attachment_preview_tests.rs checks icon and caption bounds for LTR and RTL. It calls warning_row and warning_details, and the AI summary says these helpers were added to attachment_preview.rs. The diff for attachment_preview.rs could not be read: the tool reported that changed blobs are missing from the checkout. The source implementation, the Hebrew branch condition, and preservation of the LTR row, checkbox, and hit IDs therefore remain unverified. The test was not reported as passing; the PR states the focused Cargo test is still running. The test checks only geometry. It does not check hit IDs, checkbox state, or the safety checks.

Resolution

Provide readable evidence of the attachment_preview.rs diff, or a readable blob for the file at the head. Confirm that preview_prompt branches on current().code() == "he" and that the LTR branch and its checkbox and hit IDs are unchanged. Provide the result of the focused Cargo test for attachment_safety_warning_mirrors_reading_edge.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5767981 and 8973c28.

Files selected for processing: 2

  • crates/ui-egui/src/attachment_preview.rs
  • crates/ui-egui/src/attachment_preview_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@sonarqubecloud

Copy link
Copy Markdown

@benandez benandez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for continuing the Hebrew layout work. The same points as on the earlier PRs in this series (#1637–#1649) apply here:

  1. One shared helper, please. This uses crate::i18n::current().code() == "he", a third pattern next to Lang::Hebrew and the tag string. #1716 adds Lang::Hebrew. Once it lands, please add a single Lang::is_rtl() (and ideally one ui-egui RTL row helper), and rebase the series on it rather than adding a per-dialog check each time.
  2. Hebrew screenshots (light and dark) plus an English before/after, so we can see the LTR layout is unchanged.
  3. With 16+ one-dialog PRs open, could the rest be grouped into a few larger ones once the helper exists? It would make reviewing much quicker.

This one gets the height bound right (Align::Min, horizontal_top kept for LTR). Thanks. The test could also cover the Preview button and the checkbox, since they're the safety controls.

@omg-review-bot omg-review-bot 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.

🤖 Automated review of 8973c28

The change successfully implements the visual mirroring of the attachment safety prompt for Hebrew (RTL) using dedicated layout helper functions and includes comprehensive geometric tests. The code appears correct for its stated scope, but the RTL detection mechanism is limited only to the 'he' locale, which should be generalized for better maintainability.

Findings: 🔵 1 × [P4] MINOR (Quality)

⛔ Not approved: 1 unresolved finding(s) at [P4] MINOR (Quality) or above. I'll approve once they're fixed or resolved.

Model google/gemma-4-e4b · skill code-change-review · 2 files reviewed. Reply to an inline comment to discuss it.

let tokens = crate::theme::Tokens::get(ui.ctx());
let mut start = false;
let mut warn = app.attachment_selection.as_ref().is_none_or(|selection| selection.warn);
let rtl = crate::i18n::current().code() == "he";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P4] MINOR (Quality) RTL mirroring logic is hardcoded to Hebrew locale

[P4] MINOR (Quality) Limited to Hebrew locale for RTL mirroring
crates/ui-egui/src/attachment_preview.rs:529

Issue: The logic determining if the prompt should be mirrored only checks for the specific language code "he" (crate::i18n::current().code() == "he").

Why it matters: If MailCraft is extended to support other RTL languages (e.g., Arabic, Syriac), this logic will fail to mirror the prompt correctly because it only checks for Hebrew.

Suggested fix: Instead of checking for a single language code, check if the current locale's script directionality property indicates RTL. This would require integrating with crate::i18n or similar internationalization utilities that can determine general text directionality rather than just matching a specific ISO code.

Automated review. Reply here to discuss; this thread is resolved once a fix is confirmed.

@omg-review-bot omg-review-bot 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.

✅ Approved: every finding at [P2] MAJOR or above is now resolved.

This branch has not been deployed

No deployments
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.

Attachment preview warning uses LTR layout in the Hebrew preview locale

2 participants