[2.x] feat(gdpr): PII field declarations and anonymized context support#4396
Merged
[2.x] feat(gdpr): PII field declarations and anonymized context support#4396
Conversation
… and user column overview (#65, #67, #68, #69) Port flarum/gdpr#65, #67, #68, #69 from the standalone 1.x repo to the 2.x monorepo. - Add `piiFields(): array` to `DataType` interface and `Type` base class; implement on `User`, `Posts`, `Tokens` - `DataProcessor::getPiiKeysForSerialization()` aggregates PII fields from all registered types plus extras - `DataProcessor::getPiiKeysWithExtensions()` builds a unified key→extensionId map (type-declared wins over extras) - `DataProcessor::$removeUserColumns` refactored from `string[]` to `array<string, string|null>` (column→extensionId map); add `removableUserColumnsWithExtensions()` and `resetRemovableUserColumns()` - `UserData` extender gains `addPiiKeysForSerialization()` and passes extensionId to `removeUserColumns()` - `DataTypeResource` `user-columns` endpoint now returns `piiKeys`, `piiKeyExtensions`, `removableColumns` (as map), `allColumns` - Admin `GdprPage` user table section fully implemented with 6-column grid (Column, Type, Nullable, PII, Redacted on export, Extension); uses `Icon` component (2.x) - `Exporter` guards against `null` return from `DataType::export()` - `ExportAvailableNotification` opens download in new tab via `markAsRead()` to prevent XHR abort - `User::piiFields()` expanded to include `nickname`, `suspend_reason`, `suspend_message` - Add `flarum-gdpr.lib.data.default_user_action` locale key; add 10 user table column UI keys - README: fix `Blomstra\` → `Flarum\` namespace references; add PII fields and anonymized contexts developer docs - Tests: 6 new integration tests (`ListUserColumnsDataControllerTest`), 7 new unit tests (`DataProcessorTest`), 4 new unit tests (`TypeTest`), 4 new integration tests (`ExtenderTest`) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ate type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…or admin settings page - Restore Form/Form-group/label structure in GdprPage (accidentally replaced with h3/hr layout following 1.x diff too closely) - Keep grid() as separate method, add userColumnTable() alongside it - Use customSetting() for the GDPR page link (JSX cannot be passed to setting()) - Fix default-anonymous-username type: 'string' → 'text' (unknown type rendered a bare input with no label) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
Port of flarum/gdpr#65, #67, #68, and #69 from the standalone 1.x repo to the 2.x monorepo.
Backend
piiFields(): arrayto theDataTypeinterface andTypebase class (default returns[]); implement onUser(5+3 fields),Posts(ip_address),Tokens(last_ip_address)DataProcessor::getPiiKeysForSerialization()aggregates PII fields from all registered types plus extrasDataProcessor::getPiiKeysWithExtensions()builds a unified key→extensionId map (type-declared wins over extras, replacesgetExtraPiiKeysWithExtensions())DataProcessor::$removeUserColumnsrefactored fromstring[]toarray<string, string|null>(column→extensionId map); newremovableUserColumnsWithExtensions()andresetRemovableUserColumns()methodsUserDataextender gainsaddPiiKeysForSerialization()and now passes extensionId toremoveUserColumns()DataTypeResourceuser-columnsendpoint updated to returnpiiKeys,piiKeyExtensions,removableColumns(as object/map),allColumnsExporterguards againstnullreturn fromDataType::export()Frontend
ExportAvailableNotificationopens download in new tab viamarkAsRead()to prevent XHR abort on navigation (usesIconcomponent, 2.x pattern)Locale
flarum-gdpr.lib.data.default_user_actionkeyuser_table_data.*keys for the new column grid UIREADME
Blomstra\namespace referencesTest plan
phpunit.unit.xml)phpunit.integration.xml) — including 6 new tests inListUserColumnsDataControllerTestyarn buildcompiles without errorsyarn formatreports all files unchangedemail,username, etc.GET /api/gdpr-datatypes/user-columnsreturnspiiKeys,piiKeyExtensions,removableColumns(object),allColumnsnullfromexport()does not throw🤖 Generated with Claude Code