Skip to content

When a user is deleted we don't destroy project approver links

If a user is designated as an approver for a project and is subsequently deleted, we throw a 500 error when trying to visit project settings.

Can we make this part of the user destroy process? Otherwise we need to defensively code so the view doesn't blow up.

Completed 500 Internal Server Error in 72ms (ActiveRecord: 3.3ms) 
ActionView::Template::Error (undefined method `name' for nil:NilClass): 
54: %ul.well-list 
55: - @project.approvers.each do |approver| 
56: %li 
57: = link_to approver.user.name, approver.user 
58: .pull-right 
59: = link_to namespace_project_approver_path(@project.namespace, @project, approver), data: { confirm: "Are you sure you want to remove approver #{approver.user.name}"}, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove approver' do 
60: = icon("sign-out") 
app/views/projects/_merge_request_settings.html.haml:57:in `block in _app_views_projects__merge_request_settings_html_haml___2018037903180213602_70138118563400’

cc/ @rdavila @brodock What do you think?