Skip to content
Browse files

bugfix: taking requester out of cc list now works

  • Loading branch information...
1 parent 3ba48fd commit 3da9d2b45d2968b3346436ad9c7e542601545efd @benilovj benilovj committed Mar 21, 2013
Showing with 4 additions and 5 deletions.
  1. +2 −4 app/models/shared/requester.rb
  2. +2 −1 test/unit/models/requester_test.rb
View
6 app/models/shared/requester.rb
@@ -16,13 +16,11 @@ def email=(new_email)
end
def collaborator_emails
- @collaborator_emails || []
+ (@collaborator_emails || []).reject { |collab| collab == email }
end
def collaborator_emails=(emails_as_string)
- collaborator_emails = emails_as_string.split(",").collect(&:strip)
- filtered_collaborators = collaborator_emails.reject { |collab| collab == email }
- @collaborator_emails = filtered_collaborators
+ @collaborator_emails = emails_as_string.split(",").collect(&:strip)
end
def collaborator_emails_are_all_valid
View
3 test/unit/models/requester_test.rb
@@ -29,7 +29,8 @@ class RequesterTest < Test::Unit::TestCase
end
should "remove the requester from the collaborators (as Zendesk doesn't allow this)" do
- requester = Requester.new(email: "requester@x.com", collaborator_emails: "a@b.com, requester@x.com, c@d.com")
+ requester = Requester.new(collaborator_emails: "a@b.com, requester@x.com, c@d.com")
+ requester.email = "requester@x.com"
assert_equal ["a@b.com", "c@d.com"], requester.collaborator_emails
end
end

0 comments on commit 3da9d2b

Please sign in to comment.
Something went wrong with that request. Please try again.