Commit 56da3848 authored by azul's avatar azul

Revert "WIP: remove user participations when group membership ends"

This reverts commit 17911b99.
parent 27a02177
......@@ -159,14 +159,6 @@ module Group::Users
I18n.t(:no_such_membership_error, group: self.name, user: user.name)
end
# removing all participations (makes the stars disappear - not sure
# if we want this)
pages = membership.group.pages_owned
pages.each do |page|
page.users.delete user if page.users.include? user
page.save!
end
user.clear_peer_cache_of_my_peers
membership.destroy
Notice::UserRemovedNotice.create! group: self, user: user
......
......@@ -11,11 +11,7 @@ class User::ParticipationPolicy < ApplicationPolicy
elsif participation.user_id == page.owner_id and page.owner_type == 'User'
false
else
# FIXME: this is too restrictive, users should be able to remove
# themselves from pages if they are not page owners (which is
# tested above)
# user.may_admin_page_without?(page, participation)
true
user.may_admin_page_without?(page, participation)
end
end
......
......@@ -397,8 +397,7 @@ en:
group_successfully_created: Group was successfully created.
join_group_confirmation: Are you sure you want to join this %{group_type}?
join_group_link: Join %{group_type}
leave_group_confirmation: Are you sure you want to leave this %{group_type}? You will
loose access to all pages owned by this %{group_type}.
leave_group_confirmation: Are you sure you want to leave this %{group_type}?
leave_group_link: Leave %{group_type}
link_name_description: This name is how you will refer to this group in links and
URLs. It must only contain alphanumeric characters, no spaces allowed.
......
......@@ -89,7 +89,7 @@ en:
group_successfully_created: "Group was successfully created."
join_group_confirmation: "Are you sure you want to join this %{group_type}?"
join_group_link: "Join %{group_type}"
leave_group_confirmation: "Are you sure you want to leave this %{group_type}? You will loose access to all pages owned by this %{group_type}."
leave_group_confirmation: "Are you sure you want to leave this %{group_type}?"
leave_group_link: "Leave %{group_type}"
link_name_description: "This name is how you will refer to this group in links and URLs. It must only contain alphanumeric characters, no spaces allowed."
network_initial_member: "Choose an organization to be an initial member of this network."
......
......@@ -119,54 +119,4 @@ class GroupExpellTest < IntegrationTest
assert_no_content 'animals'
end
end
def test_do_not_list_group_pages_after_expel
# ensure everyone is a longterm member
Time.stub(:now, 2.weeks.from_now) do
@user = users(:blue)
page = create_page(owner: groups(:animals), title: 'animals secrets')
page.add(users(:kangaroo), star: true, access: :admin)
page.save!
login
visit '/animals'
click_on 'Members'
assert first('tr.even').has_content? 'Kangaroo!'
first('tr.even').click_on 'Remove'
logout
@user = users(:penguin)
login
visit '/animals'
click_on 'Members'
click_on 'Request to Remove Member is pending'
click_on 'Approve'
click_on 'Members'
assert_no_content 'Kangaroo!'
logout
@user = users(:kangaroo)
login
visit '/animals'
assert_no_content 'animals secrets'
end
end
def test_do_not_list_committee_pages_after_expel
page = create_page(owner: groups(:cold), title: 'cold colors secrets')
page.add(users(:penguin), star: true, access: :admin)
page.save!
@user = users(:penguin)
login
visit '/me'
assert_content 'cold colors secrets'
groups(:cold).remove_user! users(:penguin)
visit '/me'
assert_no_content 'cold colors secrets'
end
protected
def create_page(options = {})
defaults = { title: 'untitled page', public: false }
Page.create(defaults.merge(options))
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment