Skip to content

Old Issues where author user has been deleted cannot be displayed

Plan

  1. Fix the code so that it works when author = nil (possibly 6 occurrences - issues, merge requests, notes)
  2. Migrate old records to the ghost user
  3. Simplify back the changed conditions

Problem

  • We add author existence check to the code.

https://sentry.gitlap.com/gitlab/gitlabcom/issues/42177/

NoMethodError: undefined method `id' for nil:NilClass
  app/views/projects/issues/show.html.haml:39:in `_app_views_projects_issues_show_html_haml___102245248575358473_70104893994460'
    %li= link_to 'Report abuse', new_abuse_report_path(user_id: @issue.author.id, ref_url: issue_url(@issue))
  app/controllers/projects/issues_controller.rb:94:in `show'
    respond_to do |format|
  lib/gitlab/i18n.rb:46:in `with_locale'
    yield
  lib/gitlab/i18n.rb:52:in `with_user_locale'
    with_locale(user&.preferred_language, &block)
  app/controllers/application_controller.rb:334:in `set_locale'
    Gitlab::I18n.with_user_locale(current_user, &block)
...
(148 additional frame(s) were not displayed)

ActionView::Template::Error: undefined method `id' for nil:NilClass

ActionView::Template::Error: undefined method `id' for nil:NilClass

/cc @markglenfletcher

Edited by Jarka Košanová