Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/feedback-notification-links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-entity-feedback-backend': patch
---

Add clickable link to feedback notifications. When entity owners receive notifications about new feedback, the notification now includes a link to navigate directly to the entity's feedback page.
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ describe('createRouter', () => {
payload: {
title: 'New feedback for component:default/service',
description: 'Comments: feedback',
link: '/catalog/default/component/service',
},
});
expect(response.status).toEqual(201);
Expand Down Expand Up @@ -357,6 +358,7 @@ describe('createRouter', () => {
payload: {
title: 'New feedback for component:default/service',
description: 'Comments: feedback',
link: '/catalog/default/component/service',
},
});
expect(response.status).toEqual(201);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
Entity,
RELATION_OWNED_BY,
stringifyEntityRef,
parseEntityRef,
} from '@backstage/catalog-model';
import { IdentityApi } from '@backstage/plugin-auth-node';
import {
Expand Down Expand Up @@ -227,9 +228,25 @@ export async function createRouter(
type: 'entity',
entityRef: entityOwner,
};

// Construct entity URL from entityRef using configurable pattern
const { kind, namespace, name } = parseEntityRef(req.params.entityRef);

// Allow customization of the feedback URL pattern via config
// Default: /catalog/:namespace/:kind/:name
const feedbackUrlPattern =
config.getOptionalString('entityFeedback.feedbackUrlPattern') ||
Copy link
Member

@kuangp kuangp Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually another option which may be more robust is to send this info from the frontend plugin since the routing can be derived there automatically:

if you can emulate what's done here to derive the route of the entity: https://github.com/backstage/backstage/blob/fea3e3972daf42fc75c107568a693eeb14a4d672/plugins/catalog-react/src/components/EntityRefLink/EntityRefLink.tsx#L84-L88, then pass it along in the request to the backend here:

, it would be available in this express route for it to be included in the notification payload

The benefit of the above is that it will always consistently construct the appropriate entity url (including custom ones) without any additional configuration from the consumer

'/catalog/:namespace/:kind/:name';

const entityUrl = feedbackUrlPattern
.replace(':kind', kind)
.replace(':namespace', namespace)
.replace(':name', name);

const payload: NotificationPayload = {
title: `New feedback for ${req.params.entityRef}`,
description: `Comments: ${JSON.parse(comments).additionalComments}`,
link: entityUrl,
};
await notificationService.send({
recipients,
Expand Down
Loading