Skip to content

Add a guard against missing projects in todos

Sam Beckham requested to merge todo-500 into master

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

image

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 into app/views/dashboard/todos/_todo.html.haml to get the id of one of my pending todos.
  • In the console, Todo.find(6).update_attribute(:project_id, nil). Same for group_id.
  • Go to /dashboard/todos.
Edited by Thomas Hutterer

Merge request reports

Loading