Commit aa24ce6d92d33704bd96710c1e4307a362663a27

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent 6bcae58c

ActionItem1202: removing option to moderate new members for enterprise

* only admin can add users, so moderation is not needed
app/views/profile_editor/_organization.rhtml
... ... @@ -63,23 +63,24 @@
63 63 <%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %>
64 64  
65 65 <h1><%= _('Moderation options') %></h1>
66   - <div style='margin-bottom: 1em'>
67   - <%= _('New members must be approved:')%>
68   - </div>
69   - <div style='margin-bottom: 0.5em'>
70   - <%= radio_button 'profile_data', 'closed', 'true', :style => 'float: left' %>
71   - <div style='margin-left: 30px'>
72   - <%= _('<strong>Before</strong> joining this group (a moderator has to accept the member in pending request before member can access the intranet and/or the website).') %>
  66 + <% if profile.community? %>
  67 + <div style='margin-bottom: 1em'>
  68 + <%= _('New members must be approved:')%>
73 69 </div>
74   - </div>
75   - <div>
76   - <%= radio_button 'profile_data', 'closed', 'false', :style => 'float: left' %>
77   - <div style='margin-left: 30px'>
78   - <%= _('<strong>After</strong> joining this group (a moderator can always desactivate access for users later).') %>
  70 + <div style='margin-bottom: 0.5em'>
  71 + <%= radio_button 'profile_data', 'closed', 'true', :style => 'float: left' %>
  72 + <div style='margin-left: 30px'>
  73 + <%= _('<strong>Before</strong> joining this group (a moderator has to accept the member in pending request before member can access the intranet and/or the website).') %>
  74 + </div>
79 75 </div>
80   - </div>
81   -
82   - <br>
  76 + <div>
  77 + <%= radio_button 'profile_data', 'closed', 'false', :style => 'float: left' %>
  78 + <div style='margin-left: 30px'>
  79 + <%= _('<strong>After</strong> joining this group (a moderator can always desactivate access for users later).') %>
  80 + </div>
  81 + </div>
  82 + <br>
  83 + <% end %>
83 84 <div style='margin-bottom: 1em'>
84 85 <%= _('New articles posted by members of this group must be approved:')%>
85 86  
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -302,31 +302,23 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
302 302 assert_not_nil assigns(:profile).image
303 303 end
304 304  
305   - should 'display closed attribute for enterprise when it is set' do
306   - org = Enterprise.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => true, :environment => Environment.default)
  305 + should 'display closed attribute for communities when it is set' do
  306 + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => true, :environment => Environment.default)
307 307 get :edit, :profile => 'testorg'
308 308  
309 309 assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' }
310 310 assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' }
311 311 end
312 312  
313   - should 'display closed attribute for organizations when it is set' do
314   - org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => true, :environment => Environment.default)
315   - get :edit, :profile => 'testorg'
316   -
317   - assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' }
318   - assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' }
319   - end
320   -
321   - should 'display closed attribute for organizations when it is set to false' do
322   - org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => false)
  313 + should 'display closed attribute for communities when it is set to false' do
  314 + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => false)
323 315 get :edit, :profile => 'testorg'
324 316 assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' }
325 317 assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' }
326 318 end
327 319  
328   - should 'display closed attribute for organizations when it is set to nothing at all' do
329   - org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => nil)
  320 + should 'display closed attribute for communities when it is set to nothing at all' do
  321 + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => nil)
330 322 get :edit, :profile => 'testorg'
331 323 assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' }
332 324 assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' }
... ... @@ -348,6 +340,22 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
348 340 assert !org.closed
349 341 end
350 342  
  343 + should 'not display option to close when it is enterprise' do
  344 + org = Enterprise.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :environment => Environment.default)
  345 + get :edit, :profile => 'testorg'
  346 +
  347 + assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true' }
  348 + assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false' }
  349 + end
  350 +
  351 + should 'display option to close when it is community' do
  352 + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :environment => Environment.default)
  353 + get :edit, :profile => 'testorg'
  354 +
  355 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true' }
  356 + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false' }
  357 + end
  358 +
351 359 should 'display manage members options if has permission' do
352 360 profile = Profile['ze']
353 361 community = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :environment => Environment.default)
... ...