Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/feedback',
},
});
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/feedback',
},
});
expect(response.status).toEqual(201);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,16 @@ export async function createRouter(
type: 'entity',
entityRef: entityOwner,
};

// Construct entity URL from entityRef (format: "kind:namespace/name")
const [kind, namespaceName] = req.params.entityRef.split(':');
const [namespace, name] = namespaceName.split('/');
Copy link
Member

Choose a reason for hiding this comment

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

FYI you can use parseEntityRef to parse entity refs

const entityUrl = `/catalog/${namespace}/${kind}/${name}/feedback`;
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for suggesting this change however it is not guaranteed that this is always the entity URL - consumers are free to attach the catalog plugin and "feedback" tab to any custom route name of their choosing even though this is the default. Therefore we probably need a more configurable way to construct this url that is consistent with how the frontend plugin is setup


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