Handle Commits without Email
Created by: mutewinter
I get the following error when GitLabHQ tries to parse a commit message without an email.
ActionView::Template::Error (Sorry, we can't guess the encoding on a nil object):
1: %a.project-update{:href => dashboard_feed_path(project, update)}
2: = image_tag gravatar_icon(update.author_email), :class => "left", :width => 40
3: %span.update-title
4: = dashboard_feed_title(update)
5: %span.update-author
lib/utils.rb:21:in `encode'
app/models/commit.rb:33:in `author_email'
app/views/projects/_feed.html.haml:2:in `_app_views_projects__feed_html_haml___4602359052882356175_49395020'
app/views/projects/show.html.haml:9:in `block in _app_views_projects_show_html_haml__37675904477004384_47715740'
app/views/projects/show.html.haml:8:in `each'
app/views/projects/show.html.haml:8:in `_app_views_projects_show_html_haml__37675904477004384_47715740'
The culprit is app/models/commit.rb:33
Here's the fix I used for this problem
def author_email
if author.email
encode(author.email)
else
''
end
end