🐛[BUG] "Assigned to me"-Entity does not work if backstage username is different from email prefix
Describe the bug
The "Assigned to me" Entity does not work if the backstage username is different from the email-prefix.
For example, Backstage user: user:default/FooBar does not work for email addresses like: [email protected] or [email protected].
I would expect that it is not needed for the username to match the email-address.
Possible solution
After roughly looking at the code-base, I guess the issue comes from the way the userIdentiy is used.
Currently, the username is taken from the identityAPI.userEntityRef and the email suffix is then added based on the JIRA_EMAIL_SUFFIX configuration variable.
A better approach would be to directly use the email address of the user. Maybe this can be used?
Code-Directions:
- https://github.com/AxisCommunications/backstage-plugins/blob/ce0637c46b8e96491a419a619dd76b69dc61b967/plugins/jira-dashboard-backend/src/filters.ts#L6
- https://github.com/AxisCommunications/backstage-plugins/blob/ce0637c46b8e96491a419a619dd76b69dc61b967/plugins/jira-dashboard-backend/src/service/router.ts#L148
- https://github.com/AxisCommunications/backstage-plugins/blob/ce0637c46b8e96491a419a619dd76b69dc61b967/plugins/jira-dashboard-backend/src/service/router.ts#L135
Screenshots
Additional context
If you need any additional information, I am more than happy to help!
Actually, just changing this line should fix it, as you can just query against the username and do not need the mail suffix.
https://github.com/AxisCommunications/backstage-plugins/blob/ce0637c46b8e96491a419a619dd76b69dc61b967/plugins/jira-dashboard-backend/src/filters.ts#L37
const assignedToMeFilter: Filter = {
name: 'Assigned to me',
shortName: 'ME',
query: `assignee = ${username} AND resolution = Unresolved ORDER BY updated DESC`,
};
Hi @MZerbe ! Thank you for pointing this out :+1: I'll take a look at it! Makes sense that the table should work even if backstage username does not match the email-prefix.
Will the PR solve your problem @MZerbe? Would appreciate your feedback if you have any :)