Repository navigation
[SE-641] Add mentions in documents to the notification center - #26048
judithroth wants to merge 5 commits into
Conversation
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
44e10ec to
348b1d2
Compare
https://community.openproject.org/wp/SE-641 - notification-resource-id.ts (new): a helper that returns a notification's work package ID or document ID. - center/state/ian-center.service.ts: - When stepping to the next notification, document rows are skipped. If only documents are left, the split screen closes. - Only work package rows can be selected. - The service now uses the new helper wherever it read a work package ID from the link. - center/in-app-notification-center.component.ts: a document is never highlighted as the open work package. - center/in-app-notification-center.component.html: data-qa-ian-selected is now only set on the selected row. - ian-center.service.spec.ts (new). - path-helper.service.ts: new documentPath(). documents.component.ts in the documents widget now uses it, and the URL it builds is the same as before.
348b1d2 to
116b263
Compare
https://community.openproject.org/wp/SE-641 - Entry component (entry/in-app-notification-entry.component.{ts,html,sass}): the template is now a short @if / @else if / @else that picks the child component (work package or document) or the loading placeholder. It keeps: - the row element and its click and keyboard handling - markAsRead and showDetails - the shared #topLineDetails template (project, reasons, counter, buttons), which goes into each child through <ng-content> - New entry/work-package-content/ (TS, HTML, Sass, spec): renders status and #ID, type and subject, and the reminder alert, date alert or actors line. - New entry/document-content/ (TS, HTML, Sass): renders the "Document" label, the title link and the actors line. - New entry/has-notification-reason.ts: the reason check, now in one place for both components. - in-app-notifications.module.ts: declares the two new components.
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
https://community.openproject.org/wp/SE-641 - document_strategy.rb: supports_ian? returns reason.to_s == "mentioned". Document mentions now also appear in the notification center, and "document added" stays mail-only. - Specs for that change: document_strategy_spec.rb, create_from_api_service_spec.rb and notifications_api_create_resource_spec.rb now expect read_ian: false for mentions. - spec/support/pages/notifications/center.rb: new expect_document_item and click_document_label helpers. - New modules/documents/spec/features/notifications/document_mention_notification_spec.rb (7 examples): - how the row looks and links - clicking the row does nothing - mark as read and mark all as read - a document and work package with the same ID don't get mixed up - the split screen closes when only the document is left - project filter - end to end through POST /api/v3/notifications
116b263 to
81b4e29
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-layer notification changes have unresolved issues and need human review with runtime validation.
3 open findings
What changed in this PR
Adds document mentions to OpenProject’s notification center alongside work-package notifications.
Changes:
- Extends notification visibility, filtering, grouping, and API representations to documents.
- Adds document rows and resource-aware navigation.
- Adds regression coverage and updates API documentation.
| File | Description |
|---|---|
| spec/support/pages/notifications/center.rb | Adds document notification helpers. |
| spec/services/notifications/create_from_api_service_spec.rb | Expects unread document mentions. |
| spec/requests/api/v3/notifications/show_resource_spec.rb | Tests document links without embedding. |
| spec/requests/api/v3/notifications/notifications_api_create_resource_spec.rb | Updates mention creation expectations. |
| spec/requests/api/v3/notifications/index_resource_spec.rb | Covers document listing and filtering. |
| spec/requests/api/v3/notifications/bulk_unread_ian_resource_spec.rb | Protects email-only notifications. |
| spec/models/queries/notifications/notification_query_spec.rb | Tests mixed-resource queries. |
| spec/models/queries/base_query_group_bys_spec.rb | Updates project grouping expectations. |
| spec/models/notifications/scopes/visible_spec.rb | Tests document visibility rules. |
| spec/lib/api/v3/notifications/notification_representer_rendering_spec.rb | Covers document representation. |
| modules/documents/spec/services/notifications/create_from_model_service/document_strategy_spec.rb | Tests in-app mention support. |
| modules/documents/spec/features/notifications/document_mention_notification_spec.rb | Adds notification-center feature coverage. |
| modules/documents/app/services/notifications/create_from_model_service/document_strategy.rb | Enables in-app document mentions. |
| lib/api/v3/notifications/notifications_api.rb | Excludes email-only bulk updates. |
| lib/api/v3/notifications/notification_representer.rb | Links documents without embedding. |
| lib/api/decorators/polymorphic_resource.rb | Supports dynamic link-title attributes. |
| frontend/src/app/shared/components/grids/widgets/documents/documents.component.ts | Reuses document path helper. |
| frontend/src/app/features/in-app-notifications/notification-resource-id.ts | Adds resource-specific ID extraction. |
| frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts | Registers resource content components. |
| frontend/src/app/features/in-app-notifications/entry/work-package-content/in-app-notification-work-package-content.component.ts | Extracts work-package content logic. |
| frontend/src/app/features/in-app-notifications/entry/work-package-content/in-app-notification-work-package-content.component.spec.ts | Tests work-package content rendering. |
| frontend/src/app/features/in-app-notifications/entry/work-package-content/in-app-notification-work-package-content.component.sass | Extracts work-package layout styles. |
| frontend/src/app/features/in-app-notifications/entry/work-package-content/in-app-notification-work-package-content.component.html | Extracts work-package content template. |
| frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts | Handles resource-specific row behavior. |
| frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.spec.ts | Tests document and work-package rows. |
| frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.sass | Adds static-row styling. |
| frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.html | Selects resource-specific content. |
| frontend/src/app/features/in-app-notifications/entry/has-notification-reason.ts | Shares notification-reason lookup. |
| frontend/src/app/features/in-app-notifications/entry/document-content/in-app-notification-document-content.component.ts | Adds document content logic. |
| frontend/src/app/features/in-app-notifications/entry/document-content/in-app-notification-document-content.component.sass | Styles document notification content. |
| frontend/src/app/features/in-app-notifications/entry/document-content/in-app-notification-document-content.component.html | Renders document links and actors. |
| frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts | Skips documents during split-screen navigation. |
| frontend/src/app/features/in-app-notifications/center/state/ian-center.service.spec.ts | Tests mixed-resource navigation. |
| frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts | Restricts selection to work packages. |
| frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html | Omits selection attribute for unselected rows. |
| frontend/src/app/core/path-helper/path-helper.service.ts | Adds document URL helper. |
| docs/api/apiv3/tags/notifications.yml | Documents document notifications. |
| docs/api/apiv3/paths/notifications.yml | Documents resource-type filter values. |
| docs/api/apiv3/components/schemas/notification_model.yml | Updates embedding and activity requirements. |
| config/locales/js-en.yml | Adds document label. |
| app/models/queries/notifications/resource_project.rb | Shares resource-to-project SQL. |
| app/models/queries/notifications/orders/project_order.rb | Orders both resource types by project. |
| app/models/queries/notifications/group_bys/group_by_project.rb | Groups both resource types by project. |
| app/models/queries/notifications/filters/resource_type_filter.rb | Allows document resource types. |
| app/models/queries/notifications/filters/resource_id_filter.rb | Includes visible document IDs. |
| app/models/queries/notifications/filters/project_filter.rb | Filters projects across resource types. |
| app/models/notifications/scopes/visible.rb | Adds document-aware visibility. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| context "with document notifications from two projects" do | ||
| shared_let(:other_project) { create(:project, enabled_module_names: %w[documents]) } | ||
| shared_let(:other_document) { create(:document, project: other_project, title: "Pre-landing checklist") } |
| def visible_resource_scopes(user) | ||
| { | ||
| "WorkPackage" => WorkPackage.visible(user), | ||
| "Document" => Document.visible(user) |
| } | ||
|
|
||
| closeSplitScreen():void { | ||
| window.location.href = this.pathHelper.notificationsPath(); |


Ticket
https://community.openproject.org/wp/SE-641
What are you trying to accomplish?
Enhance OpenProjects notification center to show notifications when a user was mentioned in a document
Screenshots
What approach did you choose and why?
AI involvement
Merge checklist