[Git][noosfero/noosfero][master] 2 commits: Make invitation accepts profile id as int

Leandro Nunes gitlab at mg.gitlab.com
Fri Jun 2 09:03:17 BRT 2017


Leandro Nunes pushed to branch master at Noosfero / noosfero


Commits:
b1cb7cb1 by Victor Costa at 2017-06-01T13:55:31-03:00
Make invitation accepts profile id as int

- - - - -
500594d5 by Leandro Nunes dos Santos at 2017-06-02T08:37:22-03:00
Merge branch 'noosferogov/noosfero-invitation-fix'

- - - - -


2 changed files:

- app/models/invitation.rb
- test/unit/invitation_test.rb


Changes:

=====================================
app/models/invitation.rb
=====================================
--- a/app/models/invitation.rb
+++ b/app/models/invitation.rb
@@ -52,7 +52,7 @@ class Invitation < Task
     contacts_to_invite.each do |contact_to_invite|
       next if contact_to_invite == _("Firstname Lastname <friend at email.com>")
 
-      contact_to_invite.strip!
+      contact_to_invite = contact_to_invite.to_s.strip
       find_by_profile_id = false
       if contact_to_invite.match(/^\d*$/)
         find_by_profile_id = true


=====================================
test/unit/invitation_test.rb
=====================================
--- a/test/unit/invitation_test.rb
+++ b/test/unit/invitation_test.rb
@@ -147,4 +147,16 @@ class InvitationTest < ActiveSupport::TestCase
     end
   end
 
+  should 'invite friends through profile id as integer' do
+    person = create_user('testuser1').person
+    friend = create_user('testuser2').person
+    community = fast_create(Community)
+
+    assert_difference 'InviteMember.count' do
+      Invitation.invite(person, [friend.id], 'hello friend <url>', community)
+    end
+    assert_difference 'InviteFriend.count' do
+      Invitation.invite(person, [friend.id], 'hello friend <url>', person)
+    end
+  end
 end



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/87f5c5a79b81e20009574582906ac4a446ba2e06...500594d50759beca96ba9ece960e24ba9a18033e

---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/87f5c5a79b81e20009574582906ac4a446ba2e06...500594d50759beca96ba9ece960e24ba9a18033e
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170602/436548c3/attachment-0001.html>


More information about the Noosfero-dev mailing list