[1.x] feat: announcements widget on admin dashboard#4472
Draft
[1.x] feat: announcements widget on admin dashboard#4472
Conversation
Backport of #4471 for Flarum 1.x. Adds an Announcements widget to the admin dashboard that fetches and displays the latest posts from discuss.flarum.org. Results are cached for 14 days with manual cache-busting support. The widget can be hidden (persisted in localStorage) or disabled entirely via `flarum_announcements.disabled` in config.php. - `AnnouncementsFetcher` — HTTP fetch with enriched User-Agent - `ListAnnouncementsController` — admin-only `GET /api/flarum/announcements` with `?bust=1` - `RefreshAnnouncementsCommand` + `WeeklySchedule` — weekly scheduled cache warming - `AnnouncementsServiceProvider` — conditional registration - `AnnouncementsWidget`, `AnnouncementList`, `AnnouncementItem` frontend components - `AdminPayload` injection of `announcementsDisabled` flag
Contributor
DavideIadeluca
left a comment
There was a problem hiding this comment.
Cool new feature! One minor thing for consideration
framework/core/src/Announcements/Console/RefreshAnnouncementsCommand.php
Outdated
Show resolved
Hide resolved
…ommand.php Co-authored-by: Davide Iadeluca <146922689+DavideIadeluca@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #4471 for Flarum 1.x.
Adds an Announcements widget to the admin dashboard that fetches and displays the latest posts from discuss.flarum.org. Results are cached for 14 days with manual cache-busting support. The widget can be hidden (persisted in localStorage) or disabled entirely via
flarum_announcements.disabledinconfig.php.Components
Backend
AnnouncementsFetcher— fetches discussions from discuss.flarum.org with enriched User-AgentListAnnouncementsController— admin-onlyGET /api/flarum/announcements, supports?bust=1for forced refreshRefreshAnnouncementsCommand+WeeklySchedule— weekly scheduled cache warmingAnnouncementsServiceProvider— conditionally registers console command and schedulerApi/routes.phpAdminPayloadinjectsannouncementsDisabledflagFrontend
AnnouncementsWidget— dashboard widget with refresh/hide/show controlsAnnouncementList— handles loading, error, and empty statesAnnouncementItem— individual announcement cardlocalStorage