Commit e6dbb3e982d90eb7433f98d0ef7888e0aa18da04

Authored by Leandro Santos
2 parents e4b31d74 54002230

Merge branch 'P398-main-block-should-not-be-invible' into 'master'

Main block should not be invisible

There used to happen a situation that visitors see an empty profile since the main block was not visible for all users.

Now the main block user visibility can not be set for logged, not_logged or followers anymore, only to "All users".

See merge request !499
app/models/main_block.rb
... ... @@ -24,4 +24,10 @@ class MainBlock < Block
24 24 ['always', 'except_home_page']
25 25 end
26 26  
  27 + def display_user_options
  28 + @display_user_options = {
  29 + 'all' => _('All users')
  30 + }
  31 + end
  32 +
27 33 end
... ...
test/functional/profile_design_controller_test.rb
... ... @@ -755,4 +755,12 @@ class ProfileDesignControllerTest < ActionController::TestCase
755 755 assert_response :forbidden
756 756 end
757 757  
  758 + should 'guarantee main block is always visible to everybody' do
  759 + get :edit, :profile => 'designtestuser', :id => @b4.id
  760 + %w[logged not_logged followers].each do |option|
  761 + assert_no_tag :select, :attributes => {:name => 'block[display_user]'},
  762 + :descendant => {:tag => 'option', :attributes => {:value => option}}
  763 + end
  764 + end
  765 +
758 766 end
... ...
test/unit/main_block_test.rb
... ... @@ -29,4 +29,8 @@ class MainBlockTest < ActiveSupport::TestCase
29 29 assert !block.visible?
30 30 end
31 31  
  32 + should 'guarantee main block is always visible to everybody' do
  33 + assert_equal MainBlock.new.display_user_options, {"all"=>_('All users')}
  34 + end
  35 +
32 36 end
... ...