Commit ca7ec7f48ff8ee2e6636139be9b7883ad523b552

Authored by Antonio Terceiro
1 parent 8d1bd66e

ActionItem835: removing inverted login for join popup

app/helpers/application_helper.rb
@@ -826,7 +826,7 @@ module ApplicationHelper @@ -826,7 +826,7 @@ module ApplicationHelper
826 end 826 end
827 827
828 def ask_to_join? 828 def ask_to_join?
829 - return if environment.enabled?(:disable_join_community_popup) 829 + return if !environment.enabled?(:join_community_popup)
830 return unless profile && profile.kind_of?(Community) 830 return unless profile && profile.kind_of?(Community)
831 if (session[:no_asking] && session[:no_asking].include?(profile.id)) 831 if (session[:no_asking] && session[:no_asking].include?(profile.id))
832 return false 832 return false
app/models/environment.rb
@@ -111,7 +111,7 @@ class Environment < ActiveRecord::Base @@ -111,7 +111,7 @@ class Environment < ActiveRecord::Base
111 'disable_select_city_for_contact' => _('Disable state/city select for contact form'), 111 'disable_select_city_for_contact' => _('Disable state/city select for contact form'),
112 'disable_contact_person' => _('Disable contact for people'), 112 'disable_contact_person' => _('Disable contact for people'),
113 'disable_contact_community' => _('Disable contact for groups/communities'), 113 'disable_contact_community' => _('Disable contact for groups/communities'),
114 - 'disable_join_community_popup' => _('Disable the popup that ask to join a group/community'), 114 + 'join_community_popup' => _('Ask users to join a group/community with a popup'),
115 115
116 'enterprise_activation' => _('Enable activation of enterprises'), 116 'enterprise_activation' => _('Enable activation of enterprises'),
117 'warn_obsolete_browser' => _('Enable warning of obsolete browser'), 117 'warn_obsolete_browser' => _('Enable warning of obsolete browser'),
test/unit/application_helper_test.rb
@@ -351,7 +351,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -351,7 +351,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
351 351
352 should 'not ask_to_join unless profile defined' do 352 should 'not ask_to_join unless profile defined' do
353 e = Environment.default 353 e = Environment.default
354 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) 354 + e.stubs(:enabled?).with(:join_community_popup).returns(true)
355 stubs(:environment).returns(e) 355 stubs(:environment).returns(e)
356 356
357 stubs(:profile).returns(nil) 357 stubs(:profile).returns(nil)
@@ -360,7 +360,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -360,7 +360,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
360 360
361 should 'not ask_to_join unless profile is community' do 361 should 'not ask_to_join unless profile is community' do
362 e = Environment.default 362 e = Environment.default
363 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) 363 + e.stubs(:enabled?).with(:join_community_popup).returns(true)
364 stubs(:environment).returns(e) 364 stubs(:environment).returns(e)
365 365
366 p = create_user('test_user').person 366 p = create_user('test_user').person
@@ -370,7 +370,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -370,7 +370,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
370 370
371 should 'ask_to_join if its not logged and in a community' do 371 should 'ask_to_join if its not logged and in a community' do
372 e = Environment.default 372 e = Environment.default
373 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) 373 + e.stubs(:enabled?).with(:join_community_popup).returns(true)
374 stubs(:environment).returns(e) 374 stubs(:environment).returns(e)
375 375
376 c = Community.create(:name => 'test_comm', :identifier => 'test_comm') 376 c = Community.create(:name => 'test_comm', :identifier => 'test_comm')
@@ -381,7 +381,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -381,7 +381,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
381 381
382 should 'ask_to_join if user say so' do 382 should 'ask_to_join if user say so' do
383 e = Environment.default 383 e = Environment.default
384 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) 384 + e.stubs(:enabled?).with(:join_community_popup).returns(true)
385 stubs(:environment).returns(e) 385 stubs(:environment).returns(e)
386 386
387 c = Community.create(:name => 'test_comm', :identifier => 'test_comm') 387 c = Community.create(:name => 'test_comm', :identifier => 'test_comm')
@@ -396,7 +396,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -396,7 +396,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
396 396
397 should 'not ask_to_join if user say no' do 397 should 'not ask_to_join if user say no' do
398 e = Environment.default 398 e = Environment.default
399 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) 399 + e.stubs(:enabled?).with(:join_community_popup).returns(true)
400 stubs(:environment).returns(e) 400 stubs(:environment).returns(e)
401 c = Community.create(:name => 'test_comm', :identifier => 'test_comm') 401 c = Community.create(:name => 'test_comm', :identifier => 'test_comm')
402 stubs(:profile).returns(c) 402 stubs(:profile).returns(c)
@@ -410,7 +410,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -410,7 +410,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
410 410
411 should 'not ask_to_join if environment say no even if its not logged and in a community' do 411 should 'not ask_to_join if environment say no even if its not logged and in a community' do
412 e = Environment.default 412 e = Environment.default
413 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(true) 413 + e.stubs(:enabled?).with(:join_community_popup).returns(false)
414 stubs(:environment).returns(e) 414 stubs(:environment).returns(e)
415 c = Community.create(:name => 'test_comm', :identifier => 'test_comm') 415 c = Community.create(:name => 'test_comm', :identifier => 'test_comm')
416 stubs(:profile).returns(c) 416 stubs(:profile).returns(c)
@@ -420,7 +420,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -420,7 +420,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
420 420
421 should 'not ask_to_join if environment say no even if user say so' do 421 should 'not ask_to_join if environment say no even if user say so' do
422 e = Environment.default 422 e = Environment.default
423 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(true) 423 + e.stubs(:enabled?).with(:join_community_popup).returns(false)
424 stubs(:environment).returns(e) 424 stubs(:environment).returns(e)
425 c = Community.create(:name => 'test_comm', :identifier => 'test_comm') 425 c = Community.create(:name => 'test_comm', :identifier => 'test_comm')
426 stubs(:profile).returns(c) 426 stubs(:profile).returns(c)
@@ -434,7 +434,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -434,7 +434,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
434 434
435 should 'not ask_to_join if its recorded in the session' do 435 should 'not ask_to_join if its recorded in the session' do
436 e = Environment.default 436 e = Environment.default
437 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) 437 + e.stubs(:enabled?).with(:join_community_popup).returns(true)
438 stubs(:environment).returns(e) 438 stubs(:environment).returns(e)
439 439
440 c = Community.create(:name => 'test_comm', :identifier => 'test_comm') 440 c = Community.create(:name => 'test_comm', :identifier => 'test_comm')
@@ -447,7 +447,7 @@ class ApplicationHelperTest < Test::Unit::TestCase @@ -447,7 +447,7 @@ class ApplicationHelperTest < Test::Unit::TestCase
447 447
448 should 'not ask_to_join if its recorded in the session even for authenticated users' do 448 should 'not ask_to_join if its recorded in the session even for authenticated users' do
449 e = Environment.default 449 e = Environment.default
450 - e.stubs(:enabled?).with(:disable_join_community_popup).returns(false) 450 + e.stubs(:enabled?).with(:join_community_popup).returns(true)
451 stubs(:environment).returns(e) 451 stubs(:environment).returns(e)
452 452
453 c = Community.create(:name => 'test_comm', :identifier => 'test_comm') 453 c = Community.create(:name => 'test_comm', :identifier => 'test_comm')