Commit 43f8b543 authored by John Hope's avatar John Hope

Fix exception when epic has no author

Failure to assign the ghost author or delete epic when a user is
deleted with contributions has left some with no author. This
causes the Epic List to break as it tries to link to an author
that isn't there. This fixes the link_to_member method to handle
a missing author so at least this page will load.

Changelog: fixed
parent f9e06ba8
......@@ -54,14 +54,14 @@ module ProjectsHelper
default_opts = { avatar: true, name: true, title: ":name" }
opts = default_opts.merge(opts)
return "(deleted)" unless author
data_attrs = {
user_id: author.id,
username: author.username,
name: author.name
}
return "(deleted)" unless author
author_html = []
# Build avatar image tag
......
......@@ -345,6 +345,14 @@ RSpec.describe ProjectsHelper do
expect(link).not_to include(user.name)
end
end
context 'when user is nil' do
it 'returns "(deleted)"' do
link = helper.link_to_member(project, nil)
expect(link).to eq("(deleted)")
end
end
end
describe 'default_clone_protocol' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment