Skip to content

Fix announcement drawer read behavior#532

Merged
spashii merged 7 commits intomainfrom
fix/announcement-drawer-read-behavior
Apr 14, 2026
Merged

Fix announcement drawer read behavior#532
spashii merged 7 commits intomainfrom
fix/announcement-drawer-read-behavior

Conversation

@spashii
Copy link
Copy Markdown
Member

@spashii spashii commented Apr 14, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Users can now mark individual announcements as read or unread with dedicated toggle buttons
    • Read announcements are organized in a collapsible "Earlier" section
    • Visual indicators (border, color, styling) distinguish read from unread announcements
  • Bug Fixes

    • Removed automatic mark-all-as-read behavior that occurred when opening announcements
  • Documentation

    • Updated translations for new read/unread state controls across all supported languages

spashii added 7 commits April 14, 2026 18:46
…ontrols

Remove the auto-mark-all-as-read timer that was causing announcements to
disappear from the header on click. Announcements are now only marked as
read via explicit per-item "Mark as read" buttons or the "Mark all read"
header button. The drawer now splits items into unread (top) and an
"Earlier" collapsible section for read items, which auto-expands when
there are no unread items. Release notes are deduped against the main list.
Add useMarkAsUnreadMutation that deletes the activity record to revert
an announcement to unread. Read items in the Earlier section now show a
"Mark as unread" button so users can move items back to the top.
deleteItem likely fails on Directus permissions. Switch to updating
activity records to read: false, which also handles multiple activity
records correctly.
The readItems call on announcement_activity was silently failing
(likely permissions), preventing the mutationFn from ever executing.
Now activity IDs are extracted during announcement processing and
passed directly to the mutation, eliminating the lookup entirely.
After mark-as-unread then mark-as-read, multiple activity records exist.
The old check on activity[0] could pick the stale read:false record.
Now uses .some() to match any read:true record, consistent with how
AnnouncementIcon already checks read status.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR introduces mark-as-unread functionality for announcements. The feature refactors read/unread state management through separate mutations, adds activity ID tracking to announcements, reorganizes the UI to display separate read and unread sections, and updates localization strings across supported languages.

Changes

Cohort / File(s) Summary
Announcement Components
echo/frontend/src/components/announcement/AnnouncementItem.tsx, echo/frontend/src/components/announcement/Announcements.tsx
Added activityIds field to announcements. AnnouncementItem now receives onMarkAsRead and onMarkAsUnread callbacks to toggle read state via buttons. Removed auto-mark timer from Announcements. Refactored UI to render separate "Earlier" (read) collapsible section alongside unread items, computing both lists via useMemo. Added dedicated infinite-scroll sentinel element replacing conditional ref attachment.
Announcement Hooks & Processing
echo/frontend/src/components/announcement/hooks/index.ts, echo/frontend/src/components/announcement/hooks/useProcessedAnnouncements.ts
Added useMarkAsUnreadMutation hook with optimistic cache updates, error rollback, and invalidation. Updated ProcessedAnnouncement type to include activityIds and changed read detection logic from checking first activity to checking if any activity is read. Refined "What's New" detection to substring matching on "new" instead of prefix matching. Removed "What's New" filter from main processing.
Localization Files
echo/frontend/src/locales/{de-DE,en-US,es-ES,fr-FR,it-IT,nl-NL,uk-UA}.po
Updated source line references for existing announcement strings ("Earlier", "Failed to mark all announcements as read", "Mark as read", "No announcements available", "Release notes"). Activated previously obsolete entries. Added new translation keys: "Failed to mark announcement as unread" and "Mark as unread" (with empty translations pending localization).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

bug, improvement

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix announcement drawer read behavior' directly summarizes the main change: refactoring announcement read/unread state management with new callbacks and UI controls.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/announcement-drawer-read-behavior

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.

@coderabbitai coderabbitai bot added bug Something isn't working improvement labels Apr 14, 2026
@spashii spashii merged commit a4b23c5 into main Apr 14, 2026
10 of 11 checks passed
@spashii spashii deleted the fix/announcement-drawer-read-behavior branch April 14, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant