Add a guard against missing projects in todos
What does this MR do and why?
Adds a guard against missing projects in todos.
Fixes Opening `/dashboard/todos` on Omnibus install g... (#388051 - closed).
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
This is a bit tricky to validate, because todos with neither a group
nor a project
are invalid. It's unclear how the users that reported this got such todos in their database. Possibly a project/group got deleted in a way that their dependent todos didn't get cleaned up
To take the screenshot above, I did this:
- Added a
= todo.inspect
intoapp/views/dashboard/todos/_todo.html.haml
to get theid
of one of my pending todos. - In the console,
Todo.find(6).update_attribute(:project_id, nil)
. Same forgroup_id
. - Go to
/dashboard/todos
.
Edited by Thomas Hutterer