Skip to content

[3.0] Adds a test that the board index, boards and topics are logged - #9781

Merged
live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/log-default-views
Oct 19, 2026
Merged

live627 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/log-default-views

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

@live627 asked for a test covering this case. In 2.1, #9778 found that the board index, boards and topics, the pages with no ?action= in their URL, had stopped being logged. Who's Online, last-active and the hit counter all missed them.

3.0 does not have the bug, so this PR adds only the test. Forum::findAction() resolves those requests to BoardIndex, MessageIndex and Display. Forum::preflight() then runs the logging before the action executes, and nothing in between returns early. None of the three overrides canBeLogged(), so they get true from ActionTrait.

tests/Integration/Http/DefaultViewLoggingTest.php holds that in place:

  • The three pages. The board index, ?board=1.0 and ?topic=1.0, each fetched as a guest with no cookies, must add a row to log_online and exactly one hit to log_activity.
  • A control. ?action=helpadmin, whose canBeLogged() is false, must change neither. This shows the assertions can tell a logged visit from one that was not.
  • Cleanup. trackStats and hitStats are turned on only for the test. Afterwards they get their old values back, or are removed if they were not set before.

Each request starts without cookies because User::logOnline() skips a session it logged in the last 8 seconds. The client's own log_online rows are deleted first because a guest's row is keyed by IP and written with INSERT IGNORE, so a row left by an earlier test would otherwise be counted as this visit.

What I ran, on MySQL and PostgreSQL:

  • Unchanged code: passes on both.
  • With the 2.1 bug reintroduced in preflight() (no logging when the request names no action): all three pages fail on both engines, and the control still passes.
  • With only the trackStats(['hits' => '+']) call removed: the hit assertion fails for all three pages.

Issues References (Fixes|Related|Closes)

  1. Related: [2.1] Log index, board and topic views again #9778 (the 2.1 fix)
  2. Reported at https://www.simplemachines.org/community/index.php?topic=595172.0

🤖 Generated with Claude Code

The pages with no action in their URL are the ones 2.1 stopped logging in
SimpleMachines#9778: Who's Online, last-active and the hit counter all missed them. 3.0
resolves them to BoardIndex, MessageIndex and Display before preflight()
runs, so they log as any other action does. This pins that down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@live627
live627 merged commit 7461d3f into SimpleMachines:release-3.0 Oct 19, 2026
13 checks passed
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.

2 participants