Skip to content

fix: prevent error and aborted XHR on export notification click#69

Merged
imorland merged 1 commit intomainfrom
im/fix-export-notification-error
Mar 2, 2026
Merged

fix: prevent error and aborted XHR on export notification click#69
imorland merged 1 commit intomainfrom
im/fix-export-notification-error

Conversation

@imorland
Copy link
Copy Markdown
Member

@imorland imorland commented Mar 2, 2026

Summary

  • Clicking the export-ready notification triggered a full page navigation (the href contained :// so the Link component rendered a plain <a> tag)
  • This aborted the concurrent mark-as-read POST /api/notifications/:id XHR with status 0 (NS_BINDING_ABORTED), causing a spurious "oops something went wrong" error dialog
  • Override view() to intercept the click with e.preventDefault(), then trigger the download via window.open(..., '_blank') so the current page is not navigated away from and the XHR completes cleanly
  • Renames the file from .ts.tsx to support JSX in the overridden view()

Test plan

  • Click an export-ready notification — download should start in a new tab and no error dialog should appear
  • Verify the notification is marked as read after clicking
  • Verify the unread notification count decrements correctly

🤖 Generated with Claude Code

The export notification href was a full external URL, causing the browser
to navigate away on click. This aborted the concurrent mark-as-read XHR
(status 0 / NS_BINDING_ABORTED), surfacing a spurious error dialog.

Override href() to return '#' to prevent page navigation, and override
markAsRead() to open the download via window.open(_blank) instead.
The mark-as-read XHR then completes cleanly without being aborted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@imorland imorland force-pushed the im/fix-export-notification-error branch from 68c133e to 05f4d57 Compare March 2, 2026 20:54
@imorland imorland merged commit d5c6e80 into main Mar 2, 2026
25 checks passed
@imorland imorland deleted the im/fix-export-notification-error branch March 2, 2026 20:56
imorland added a commit that referenced this pull request Mar 3, 2026
…rt (#4396)

* [2.x] feat(gdpr): PII field declarations, anonymized context support, and user column overview (#65, #67, #68, #69)

Port #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>

* Apply fixes from StyleCI

* fix(gdpr): add PHPStan type annotations to resolve array_values template type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(gdpr): restore Form layout, fix customSetting JSX and type:text for 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>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
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.

1 participant