DASH-1281 block_dash: add "Hide suspended users" condition - #130
Draft
stefanscholz wants to merge 2 commits into
Draft
DASH-1281 block_dash: add "Hide suspended users" condition#130stefanscholz wants to merge 2 commits into
stefanscholz wants to merge 2 commits into
Conversation
stefanscholz
marked this pull request as draft
July 24, 2026 10:23
The users data source excludes deleted users but still lists suspended accounts, with no way to filter them out. Add an opt-in condition that restricts results to u.suspended = 0. Use OPERATION_EQUAL rather than the inherited OPERATION_IN_OR_EQUAL so the placeholder is named after the condition instead of $DB->get_in_or_equal()'s process-wide counter.
Pull requests are built on every branch, so every commit that lands on dev has already been built by the pull request that introduced it. Building the dev push as well duplicates the matrix for no extra signal. main still keeps its push trigger because release commits land there directly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
stefanscholz
force-pushed
the
DASH-1281
branch
from
August 10, 2026 10:43
3c9c027 to
bbf46b7
Compare
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.
The users data source excludes deleted users (
u.deleted = 0) but still lists suspended accounts, with no way to filter them out. This adds an opt-in condition — "Hide suspended users" — that restricts results tou.suspended = 0.Behaviour
Off by default, like every other Dash condition.
abstract_data_source::before_data()removes any filter whosepreferences[filters][<name>][enabled]is falsy (and removes all filters when nofilterspreference exists at all), so existing block instances are unaffected until someone ticks the box on the block's Conditions tab.u.suspendedclauseu.suspendedclauseu.suspended = :hide_suspended_usersNotes
get_operation()returnsOPERATION_EQUALrather than the inheritedOPERATION_IN_OR_EQUAL. The latter routes through$DB->get_in_or_equal(), which names its placeholder from a process-wide counter (param1,param2, …), making the emitted SQL depend on how many unrelated DML calls preceded it.OPERATION_EQUALyields the stableu.suspended = :hide_suspended_users.block_dash_has_pro()guard, so it is available (and unit-testable) without local_dash.version.phpbumped to refresh the lang-string cache on upgrade. Nodb/upgrade.phpsavepoint — this is not a DB upgrade.Tests
New
tests/hide_suspended_users_condition_test.phpcovers the generated SQL and params, that the condition is registered on the users data source but disabled by default, and that suspended users drop out of the result set only once it is enabled.Follow-up (not in this PR)
Conditions do not propagate — each data source hard-codes its own set in
build_filter_collection(). Wiring this into the local_dash addon data sources is a separate ticket. Two of them need care:calendar_eventsLEFT JOINs{user}once.userid(0 for site/course/category events) so it would need a null-safe(u.id IS NULL OR u.suspended = 0), andbadgesLEFT JOINs{user}pinned to$USER->id, souis the viewer rather than the row subject and the condition would be meaningless there.