Skip to content

feat(dashboard): daily activity for the last 14 days, linking into the activity log - #1625

Open
rstrzelecki-inne-projekty wants to merge 3 commits into
apache:mainfrom
rstrzelecki-inne-projekty:feat/dashboard-daily-activity
Open

rstrzelecki-inne-projekty wants to merge 3 commits into
apache:mainfrom
rstrzelecki-inne-projekty:feat/dashboard-daily-activity

Conversation

@rstrzelecki-inne-projekty

Copy link
Copy Markdown

Proposed Changes

Depends on #1624 (community activity log) — this PR is stacked on that branch, so its diff shows both until #1624 is merged. The change specific to this PR is the last commit (feat(dashboard): daily activity …, 12 files).

Adds a card "Activity in the last 14 days" to the admin dashboard, under the existing cards: one row per day (today first) with the number of questions, answers, comments (incl. replies), review-queue items, badge awards and page views. Every number is a link that opens the activity log in a new tab, already filtered to that day and those actions (e.g. /admin/activity-log?range=custom&from=2026-09-16&to=2026-09-16&action=question.create); the date link opens the whole day.

  • GET /answer/admin/api/activity-log/daily?days=14&tz_offset=<minutes> — counts per local day; days are bucketed in the admin's time zone (the UI sends -Date.getTimezoneOffset()), not in UTC, so "today" means the admin's today. Aggregated in Go from created_at + action of the log rows since the start of the range (one cheap SELECT of two columns).
  • UI: Admin/Dashboard/components/DailyActivity (react-bootstrap Table in a Card), i18n admin.dashboard.daily_activity.*.

Why: the dashboard's site statistics are lifetime totals; admins wanted to see at a glance whether anything happened today / this week and jump straight to the details.

Verified on our production instance (2.0.2 + #1624 + this): counts match the activity log filters they link to.

🤖 Generated with Claude Code

https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR

Adds an admin-only "Activity log" (Admin → Community → Activity log) that
records what users do, with filters and a TSV export:

- activity_log table (created on start-up), async write queue
- the base queue accepts several handlers, so the event queue now feeds
  both the badge rules and the log
- events: question/answer/comment create, update, delete, vote (with
  direction and cancel), accept, flag, react, comment replies
- hooks where no event exists: every login (method, IP, UA), badge
  awards, review queue (queued / approved / rejected), every reputation
  change (with the object and activity that caused it), role changes,
  suspend / unsuspend / delete
- page views sent by the UI on route change (deduplicated), kept for
  ACTIVITY_LOG_PAGEVIEW_DAYS days (default 90, cleaned by cron)
- admin API: paged list with date range / user / action / free-text
  filters, action counts, TSV export (UTF-8 BOM, streamed, 100k cap)
- admin UI page with date presets, user suggestions, multi-select action
  filter, search, export; all filters live in the URL

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR
rstrzelecki-inne-projekty pushed a commit to rstrzelecki-inne-projekty/answer that referenced this pull request Sep 16, 2026
rafmaster7 and others added 2 commits September 16, 2026 17:51
Text columns of the export (titles, excerpts, reasons, user names) are
user-influenced; a value starting with =, +, -, @, | or % would be
evaluated as a formula by Excel / LibreOffice. Such cells now get a
leading apostrophe; the numeric reputation delta is left as is.
…e activity log

Adds a card to the admin dashboard with one row per day (today first) and
the number of questions, answers, comments, review-queue items, badge
awards and page views. Every number opens the activity log in a new tab,
already filtered to that day and those actions; the date opens the whole
day. Days are bucketed in the admin's time zone (tz_offset).

Backed by GET /answer/admin/api/activity-log/daily?days=&tz_offset=
(aggregated in Go from created_at + action of the activity_log rows).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0181uZ2px83HmPo3HKSEzWQR
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.

2 participants