Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove explicit project column from notifications #16492

Conversation

ulferts
Copy link
Contributor

@ulferts ulferts commented Aug 21, 2024

Ticket

https://community.openproject.org/wp/57351

What are you trying to accomplish?

The bug is caused by notifications having references to a deleted project. The project reference is not strictly necessary to have on notifications. It can be fetched from the resource (e.g. work package) that is notified on.

What approach did you choose and why?

The project_id column is removed from the notifications table. That way, the reference need not be maintained any more. It can still be fetched from the resource. That is done to keep the Notification representation intact, so no change to the API takes place.

This comes at the cost of more complicated queries particularly when sorting/grouping/filtering in the NotificationQuery. They for now have become way more WorkPackage specific. That query however was already work package specific given the way the visibility was checked.

The alternative would be to keep the project reference. In that case, whenever any resource is moved, the reference would have to be updated. That approach seems to be quite error prone, which is why it was discarded.

Merge checklist

  • Added/updated tests

@ulferts ulferts force-pushed the bug/57351-internal-error-when-trying-to-access-notifications-menu branch 4 times, most recently from a4c53d3 to cf981c2 Compare August 21, 2024 14:07
@ulferts ulferts marked this pull request as ready for review August 22, 2024 07:05
@ulferts ulferts force-pushed the bug/57351-internal-error-when-trying-to-access-notifications-menu branch from cf981c2 to b17ce58 Compare August 22, 2024 07:28
@ulferts ulferts changed the base branch from dev to release/14.4 August 22, 2024 07:28
@ulferts ulferts force-pushed the bug/57351-internal-error-when-trying-to-access-notifications-menu branch from b17ce58 to 70407f5 Compare August 22, 2024 07:29
Copy link

1 Warning
⚠️ This PR has migration-related changes on a release branch. Ping @opf/operations

Generated by 🚫 Danger

@oliverguenther oliverguenther merged commit eb98b08 into release/14.4 Aug 22, 2024
11 checks passed
@oliverguenther oliverguenther deleted the bug/57351-internal-error-when-trying-to-access-notifications-menu branch August 22, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants