Commit 54d248e5857b7bfd992bed13c1eaf4908304623d

Authored by Marcos Pereira
1 parent e935c71e

fix tests, add groups

app/models/add_member.rb
@@ -22,7 +22,7 @@ class AddMember < Task @@ -22,7 +22,7 @@ class AddMember < Task
22 self.roles = [Profile::Roles.member(organization.environment.id).id] 22 self.roles = [Profile::Roles.member(organization.environment.id).id]
23 end 23 end
24 target.affiliate(requestor, self.roles.select{|r| !r.to_i.zero? }.map{|i| Role.find(i)}) 24 target.affiliate(requestor, self.roles.select{|r| !r.to_i.zero? }.map{|i| Role.find(i)})
25 - person.follow(organization) 25 + person.follow(organization, 'member_of')
26 end 26 end
27 27
28 def title 28 def title
app/models/favorite_enterprise_person.rb
@@ -8,7 +8,7 @@ class FavoriteEnterprisePerson < ApplicationRecord @@ -8,7 +8,7 @@ class FavoriteEnterprisePerson < ApplicationRecord
8 belongs_to :person 8 belongs_to :person
9 9
10 after_create do |favorite| 10 after_create do |favorite|
11 - favorite.person.follow(favorite.enterprise) 11 + favorite.person.follow(favorite.enterprise, 'favorites')
12 end 12 end
13 13
14 protected 14 protected
app/models/profile.rb
@@ -773,7 +773,7 @@ private :generate_url, :url_options @@ -773,7 +773,7 @@ private :generate_url, :url_options
773 else 773 else
774 self.affiliate(person, Profile::Roles.admin(environment.id), attributes) if members.count == 0 774 self.affiliate(person, Profile::Roles.admin(environment.id), attributes) if members.count == 0
775 self.affiliate(person, Profile::Roles.member(environment.id), attributes) 775 self.affiliate(person, Profile::Roles.member(environment.id), attributes)
776 - person.follow(self) 776 + person.follow(self, 'member_of')
777 end 777 end
778 person.tasks.pending.of("InviteMember").select { |t| t.data[:community_id] == self.id }.each { |invite| invite.cancel } 778 person.tasks.pending.of("InviteMember").select { |t| t.data[:community_id] == self.id }.each { |invite| invite.cancel }
779 remove_from_suggestion_list person 779 remove_from_suggestion_list person
test/unit/person_notifier_test.rb
@@ -198,6 +198,7 @@ class PersonNotifierTest < ActiveSupport::TestCase @@ -198,6 +198,7 @@ class PersonNotifierTest < ActiveSupport::TestCase
198 'friend_url' => '/', 'friend_profile_custom_icon' => [], 'friend_name' => ['joe'], 198 'friend_url' => '/', 'friend_profile_custom_icon' => [], 'friend_name' => ['joe'],
199 'resource_name' => ['resource'], 'resource_profile_custom_icon' => [], 'resource_url' => ['/'], 199 'resource_name' => ['resource'], 'resource_profile_custom_icon' => [], 'resource_url' => ['/'],
200 'enterprise_name' => 'coop', 'enterprise_url' => '/coop', 200 'enterprise_name' => 'coop', 'enterprise_url' => '/coop',
  201 + 'follower_url' => '/', 'follower_profile_custom_icon' => [], 'follower_name' => ['joe'],
201 'view_url'=> ['/'], 'thumbnail_path' => ['1'], 202 'view_url'=> ['/'], 'thumbnail_path' => ['1'],
202 } 203 }
203 a.get_url = '' 204 a.get_url = ''