Commit f8819012b810b31693ac6bb4dc9528b89d9f13fd
1 parent
e87330cc
Exists in
master
and in
22 other branches
ActionItem166: fixing crash with unanthenticated comments
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1546 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
11 additions
and
8 deletions
Show diff stats
app/views/content_viewer/_comment.rhtml
| 1 | -<div class="article-comment<%= | |
| 2 | - ' comment-from-owner' if ( @page.profile.name == comment.author.name ) %>"> | |
| 3 | - <%= link_to content_tag( 'span', comment.author.name() ), comment.author.url, | |
| 4 | - :class => 'comment-picture', | |
| 5 | - :style => 'background-image:url(%s)' % profile_icon(comment.author, :minor) %> | |
| 1 | +<div class="article-comment<%= ' comment-from-owner' if ( comment.author && (@page.profile.name == comment.author.name) ) %>"> | |
| 2 | + <% if comment.author %> | |
| 3 | + <%= link_to content_tag( 'span', comment.author.name() ), comment.author.url, | |
| 4 | + :class => 'comment-picture', | |
| 5 | + :style => 'background-image:url(%s)' % profile_icon(comment.author, :minor) %> | |
| 6 | + <% else %> | |
| 7 | + <%# unauthenticated user: display default icon %> | |
| 8 | + <%= content_tag('span', ' ', :class => 'comment-picture', :style => 'background-image: url(/images/icons-app/user_icon_size-minor.png)' )%> | |
| 9 | + <% end %> | |
| 10 | + | |
| 6 | 11 | <h4><%= comment.title %></h4> |
| 7 | 12 | <div class="comment-info"> |
| 8 | 13 | <%= _('By %{author} on %{date}') % { |
| 9 | - :author => link_to( | |
| 10 | - (comment.author ? comment.author.identifier : comment.name), | |
| 11 | - comment.author.url), | |
| 14 | + :author => comment.author ? link_to(comment.author.name, comment.author.url) : content_tag('u', comment.name), | |
| 12 | 15 | :date => show_time(comment.created_on) } %> |
| 13 | 16 | </div> |
| 14 | 17 | <div class="comment-text"> | ... | ... |