Commit 3b0ec706 authored by dgt's avatar dgt

Merge branch '244-remove-user-request-not-possible' into 'master'

fix: create new expell requests even if a request was rejected in the past

Closes #244

See merge request riseuplabs/crabgrass!218
parents 43036382 4d5dfa6a
......@@ -18,7 +18,7 @@ class RequestToRemoveGroup < Request
end
def self.for_membership(membership)
with_requestable(membership.group).for_recipient(membership.network)
with_requestable(membership.group).for_recipient(membership.network).where.not(state: 'rejected')
end
#
......
......@@ -18,7 +18,7 @@ class RequestToRemoveUser < Request
end
def self.for_membership(membership)
with_requestable(membership.user).for_recipient(membership.group)
with_requestable(membership.user).for_recipient(membership.group).where.not(state: 'rejected')
end
#
......
......@@ -23,6 +23,43 @@ class GroupExpellTest < IntegrationTest
end
end
def test_expell_other_member_second_try
# ensure everyone is a longterm member
Time.stub(:now, 2.weeks.from_now) do
@user = users(:blue)
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 'Reject'
click_on 'Members'
assert_content 'Kangaroo!'
logout
@user = users(:blue)
login
visit '/animals'
click_on 'Members'
assert first('tr.even').has_content? 'Kangaroo!'
first('tr.even').click_on 'Remove'
logout
@user = users(:iguana)
login
visit '/animals'
click_on 'Members'
click_on 'Request to Remove Member is pending'
click_on 'Approve'
click_on 'Members'
assert_no_content 'Kangaroo!'
end
end
def test_add_expelled_member
# ensure everyone is a longterm member
......
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