diff --git a/app/views/profile/_comment.rhtml b/app/views/profile/_comment.rhtml index 8b40ba5..c5f40f4 100644 --- a/app/views/profile/_comment.rhtml +++ b/app/views/profile/_comment.rhtml @@ -5,19 +5,35 @@
  • -
    +
    <% if comment.author %> <%= link_to image_tag(profile_icon(comment.author, :minor)), - Person.find(comment.author_id).url, + comment.author_url, :class => 'comment-picture', :title => comment.author_name %> + <% else %> + <% url_image, status_class = comment.author_id ? + [comment.removed_user_image, 'icon-user-removed'] : + [str_gravatar_url_for( comment.email ), 'icon-user-unknown'] %> + + <%= link_to( + image_tag(url_image, :onerror=>'gravatarCommentFailback(this)', + 'data-gravatar'=>str_gravatar_url_for(comment.email)) + + content_tag('span', comment.author_name, :class => 'comment-info') + + content_tag('span', comment.message, + :class => 'comment-user-status comment-user-status-wall ' + status_class), + gravatar_profile_url(comment.email), + :target => '_blank', + :class => 'comment-picture', + :title => '%s %s' % [comment.author_name, comment.message] + )%> <% end %>
    - <%= link_to(comment.author_name, comment.author.url) %> + <%= comment.author.present? ? link_to(comment.author_name, comment.author.url) : content_tag('strong', comment.author_name) %> <% unless comment.title.blank? %> <%= comment.title %>
    <% end %> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 85bf012..5c6c5e9 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1094,6 +1094,10 @@ a.comment-picture { left: 33px; background-repeat: no-repeat; } +.comment-user-status-wall { + top: 16px; + left: 16px; +} #article .article-comments-list, #article .article-comments-list ul, #article .article-comments-list li { padding: 0; margin: 0; diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 74a635a..196d760 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -1300,4 +1300,28 @@ class ProfileControllerTest < ActionController::TestCase assert_response :success assert_equal "Comment successfully added.", assigns(:message) end + + should 'display comment in wall if user was removed' do + UserStampSweeper.any_instance.stubs(:current_user).returns(profile) + article = TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') + to_be_removed = create_user('removed_user').person + comment = Comment.create!(:author => to_be_removed, :title => 'Test Comment', :body => 'My author does not exist =(', :source_id => article.id, :source_type => 'Article') + to_be_removed.destroy + + login_as(profile.identifier) + get :index, :profile => profile.identifier + + assert_tag :tag => 'span', :content => '(removed user)', :attributes => {:class => 'comment-user-status comment-user-status-wall icon-user-removed'} + end + + should 'display comment in wall from non logged users' do + UserStampSweeper.any_instance.stubs(:current_user).returns(profile) + article = TinyMceArticle.create!(:profile => profile, :name => 'An article about free software') + comment = Comment.create!(:name => 'outside user', :email => 'outside@localhost.localdomain', :title => 'Test Comment', :body => 'My author does not exist =(', :source_id => article.id, :source_type => 'Article') + + login_as(profile.identifier) + get :index, :profile => profile.identifier + + assert_tag :tag => 'span', :content => '(unauthenticated user)', :attributes => {:class => 'comment-user-status comment-user-status-wall icon-user-unknown'} + end end -- libgit2 0.21.2