Skip to content

feat: add announcement banner - #2967

Open
dschmidt wants to merge 10 commits into
mainfrom
feat/announcement-banner
Open

feat: add announcement banner#2967
dschmidt wants to merge 10 commits into
mainfrom
feat/announcement-banner

Conversation

@dschmidt

@dschmidt dschmidt commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Announcement banner shown above the top bar to all users (including the login page), with a dialog showing Markdown detail text, plus an admin UI to manage it.

  • The banner reads options.announcement.{bannerText, infoText} from config.json; clicking it opens a dialog that renders infoText as read-only Markdown (via the shared TipTap editor).
  • Admin settings (General): loads the full state via an authenticated GET /announcement, edits bannerText + a Markdown infoText editor (image insertion disabled), an instant Enabled switch, a session-only Preview, and Save. An empty banner text removes the announcement.
  • Adds a reusable excludeActions option to useTextEditor.

Backend: opencloud-eu/opencloud#3189
fixes #2977

Screenshot_20260729_004439

@dschmidt
dschmidt requested a review from JammingBen July 28, 2026 17:01
@dschmidt
dschmidt marked this pull request as ready for review July 28, 2026 17:02
@dschmidt
dschmidt force-pushed the feat/announcement-banner branch 2 times, most recently from 9529b9f to 1a80512 Compare July 28, 2026 17:16
@dschmidt
dschmidt force-pushed the feat/announcement-banner branch from 1a80512 to dc339d8 Compare July 28, 2026 22:40
dschmidt added 3 commits July 29, 2026 08:18
The rich text editor renders a role="textbox" element, which axe flags
when it has no accessible name (aria-input-field-name). That broke the
a11y e2e check on the admin settings general page. Add an optional
ariaLabel to useTextEditor and set it on the announcement info editor and
the info dialog.
Map the write endpoint's status codes to a helpful message: a 413 (body
over the size cap) tells the admin to shorten the info text, a 403 that
they lack the permission, everything else keeps the generic message.
Gate the admin settings announcement section on a new Announcement CASL
ability (mapped from the Announcement.ReadWrite permission), so users
without it no longer see a non-functional section or hit a 403 on load.
@tbsbdr

tbsbdr commented Jul 29, 2026

Copy link
Copy Markdown
Member

awesome 🤟

infoText is updated via the editor's debounced onUpdate (250ms), so saving or
previewing within that window could drop the last edit. Read
infoEditor.getContent() at save/preview time instead of the debounced ref.
@tbsbdr

tbsbdr commented Jul 29, 2026

Copy link
Copy Markdown
Member

@dschmidt for endusers: if i dismiss the banner via the "x": when will the banner reappear and when will it disappear forever?

@dschmidt

dschmidt commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@dschmidt for endusers: if i dismiss the banner via the "x": when will the banner reappear and when will it disappear forever?

@tbsbdr It's just hidden until page reload. Hiding it temporarily or dismissing a specific message is way more complex and currently not worth the effort imho.

The idea is: yes, you can hide it if it really annoys you: for example when you need to take screenshots or similar, but you should be aware of the current announcement even if the admin enabled it 2 weeks ago

@tbsbdr tbsbdr mentioned this pull request Jul 29, 2026
2 tasks
dschmidt added 2 commits July 29, 2026 20:58
Mirror the disabled pattern from OcCheckbox: a disabled switch dims, shows a
default cursor and does not toggle. Replaces the ad-hoc pointer-events/opacity
workaround used to fake-disable the switch.
Use the new OcSwitch disabled prop instead of the pointer-events workaround:
the switch is disabled while busy or until a banner text has been saved, so the
save-first message is no longer needed.
@tbsbdr

tbsbdr commented Jul 29, 2026

Copy link
Copy Markdown
Member

Discussed with Domme: generally its annoying when something reappears after it got dismissed. After clicking around the UI, I noticed that full page reloads are relatively rare. With this in mind, I think your solution hits the sweet-spot of effort-value 👌 Thanks for your work!

dschmidt added 3 commits July 29, 2026 21:16
A tiptap update dropped the default role="textbox" from the contenteditable, so
the aria-label became invalid (axe aria-prohibited-attr). Set role="textbox" and
aria-multiline explicitly when an ariaLabel is given.
… dimming

Add a default slot rendered next to the label (e.g. for a contextual helper).
Dim only the label and toggle when disabled instead of the whole switch, so a
slotted popover is not trapped in an opacity stacking context.
Rename to Show banner / Banner / Banner details, shorten the section description
and add contextual helpers. The helpers note that the switch can only be enabled
once a banner text is saved, and that leaving the details empty makes the banner
non-clickable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add announcement banner

3 participants