Projects::IssuesController#show will 500 if the issue was edited by a deleted user
ZD ticket: https://gitlab.zendesk.com/agent/tickets/79997
Repro steps:
- Have 2 Users (Creator, Editor) that have access to project foo.
- Have the creator make an issue on project foo.
- Have Editor edit issue on project foo.
- Delete the Editor Account.
- Try to view issue.
Processing by Projects::IssuesController#show as HTML
Parameters: {"namespace_id"=>"test", "project_id"=>"testing-remove-editor-500", "id"=>"1"}
Completed 500 Internal Server Error in 129ms (ActiveRecord: 11.4ms | Elasticsearch: 0.0ms)
ActionView::Template::Error (undefined method `name' for nil:NilClass):
55:
56: .issue-details.issuable-details
57: .detail-page-description.content-block
58: %script#js-issuable-app-initial-data{ type: "application/json" }= issuable_initial_data(@issue)
59: #js-issuable-app
60: %h2.title= markdown_field(@issue, :title)
61: - if @issue.description.present?
app/helpers/issuables_helper.rb:245:in `updated_at_by'
app/helpers/issuables_helper.rb:234:in `issuable_initial_data'
app/views/projects/issues/show.html.haml:58:in `_app_views_projects_issues_show_html_haml__4002845293547056383_69837757354240'
app/controllers/projects/issues_controller.rb:97:in `show'
lib/gitlab/i18n.rb:39:in `with_locale'
lib/gitlab/i18n.rb:45:in `with_user_locale'
app/controllers/application_controller.rb:307:in `set_locale'
lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb:16:in `call'
lib/gitlab/middleware/multipart.rb:93:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/middleware/readonly_geo.rb:30:in `call'
lib/gitlab/request_context.rb:18:in `call'
Stan suggests
I think there needs to be
dependent: :destroy
in thebelongs_to :last_edited_by, class_name: 'User'