IZ MS refactor commenting disabled
This commit is contained in:
parent
70d9dcf3b7
commit
0f073387ac
10 changed files with 27 additions and 50 deletions
|
|
@ -30,4 +30,13 @@ module CommentsHelper
|
|||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def commenting_disabled?
|
||||
return true unless user_signed_in?
|
||||
if defined?(@commenting_disabled)
|
||||
return @commenting_disabled
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
.likes_container
|
||||
= render "likes/likes_container", :target_id => comment.id, :likes_count => comment.likes_count, :target_type => "Comment"
|
||||
|
||||
- unless !user_signed_in? || @commenting_disabled
|
||||
- unless commenting_disabled?
|
||||
%span.like_action
|
||||
= like_action(comment, current_user)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@
|
|||
-else
|
||||
= render :partial => 'comments/comment', :collection => post.comments, :locals => {:post => post}
|
||||
|
||||
- unless !user_signed_in? || @commenting_disabled
|
||||
- unless commenting_disabled?
|
||||
.new_comment_form_wrapper{:class => comment_form_wrapper_class(post)}
|
||||
= new_comment_form(post.id, current_user)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
= render 'photos/index', :photos => @posts
|
||||
- else
|
||||
#main_stream.stream
|
||||
= render 'shared/stream', :posts => @posts, :commenting_disabled => @commenting_disabled
|
||||
= render 'shared/stream', :posts => @posts, :commenting_disabled => commenting_disabled?
|
||||
#pagination
|
||||
=link_to(t('more'), next_page_path, :class => 'paginate')
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
- if @post.is_a?(Photo)
|
||||
= render 'posts/photo', :post => @post
|
||||
- else
|
||||
= render 'shared/stream_element', :post => @post, :commenting_disabled => defined?(@commenting_disabled)
|
||||
= render 'shared/stream_element', :post => @post, :commenting_disabled => commenting_disabled?
|
||||
%br
|
||||
%br
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -4,5 +4,4 @@
|
|||
|
||||
.stream
|
||||
= render :partial => 'shared/stream_element',
|
||||
:locals => {:post => @post, :commenting_disabled => defined?(@commenting_disabled),
|
||||
:expanded_info => true}
|
||||
:locals => {:post => @post, :commenting_disabled => commenting_disabled?, :expanded_info => true}
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@
|
|||
= render :partial => 'shared/stream_element',
|
||||
:collection => posts,
|
||||
:as => :post,
|
||||
:locals => { :commenting_disabled => defined?(@commenting_disabled)}
|
||||
:locals => { :commenting_disabled => commenting_disabled?}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,21 +68,20 @@
|
|||
–
|
||||
|
||||
|
||||
- if user_signed_in?
|
||||
- unless @commenting_disabled
|
||||
%span.like_action
|
||||
= like_action(post, current_user)
|
||||
- unless commenting_disabled?
|
||||
%span.like_action
|
||||
= like_action(post, current_user)
|
||||
|
||||
- if (post.author_id != current_user.person.id) && (post.public?)
|
||||
·
|
||||
%span.reshare_action
|
||||
= reshare_link(post)
|
||||
- if (post.author_id != current_user.person.id) && (post.public?)
|
||||
·
|
||||
%span.reshare_action
|
||||
= reshare_link(post)
|
||||
·
|
||||
|
||||
= link_to t('comments.new_comment.comment'), '#', :class => 'focus_comment_textarea'
|
||||
= link_to t('comments.new_comment.comment'), '#', :class => 'focus_comment_textarea'
|
||||
|
||||
.likes.on_post
|
||||
.likes_container
|
||||
= render "likes/likes_container", :target_id => post.id, :likes_count => post.likes_count, :current_user => current_user, :target_type => "Post"
|
||||
|
||||
= render "comments/comments", :post => post, :current_user => current_user, :commenting_disabled => @commenting_disabled
|
||||
= render "comments/comments", :post => post, :current_user => current_user, :commenting_disabled => commenting_disabled?
|
||||
|
|
|
|||
|
|
@ -11,21 +11,8 @@ Feature: infinite scroll
|
|||
And I wait for the ajax to finish
|
||||
|
||||
Scenario: on the main stream by activity
|
||||
Then I should see 15 posts
|
||||
And I should see "alice - 26 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 30 posts
|
||||
And I should see "alice - 11 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 40 posts
|
||||
And I should see "alice - 1 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see "No more"
|
||||
|
||||
When I follow "generic"
|
||||
And I follow "commented on"
|
||||
And I wait for the ajax to finish
|
||||
Then I should see 15 posts
|
||||
And I should see "alice - 26 - #seeded"
|
||||
|
||||
|
|
@ -41,7 +28,6 @@ Feature: infinite scroll
|
|||
Then I should see "No more"
|
||||
|
||||
Scenario: on the main stream post created time
|
||||
And I follow "posted"
|
||||
And I go to the home page
|
||||
And I wait for the ajax to finish
|
||||
Then I should see 15 posts
|
||||
|
|
@ -58,22 +44,6 @@ Feature: infinite scroll
|
|||
When I scroll down
|
||||
Then I should see "No more"
|
||||
|
||||
When I follow "generic"
|
||||
And I wait for the ajax to finish
|
||||
Then I should see 15 posts
|
||||
And I should see "alice - 15 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 30 posts
|
||||
And I should see "alice - 30 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see 40 posts
|
||||
And I should see "alice - 40 - #seeded"
|
||||
|
||||
When I scroll down
|
||||
Then I should see "No more"
|
||||
|
||||
Scenario: On a tag page
|
||||
When I go to the tag page for "seeded"
|
||||
Then I should see 15 posts
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ describe StatusMessage do
|
|||
|
||||
it 'should require status messages to be less than 10000 characters' do
|
||||
message = ''
|
||||
10001.times do message = message +'1';end
|
||||
10001.times{message = message +'1'}
|
||||
status = Factory.build(:status_message, :text => message)
|
||||
|
||||
status.should_not be_valid
|
||||
|
|
|
|||
Loading…
Reference in a new issue