diff --git a/app/helpers/action_tracker_helper.rb b/app/helpers/action_tracker_helper.rb
index f8b0885..1da9210 100644
--- a/app/helpers/action_tracker_helper.rb
+++ b/app/helpers/action_tracker_helper.rb
@@ -15,7 +15,7 @@ module ActionTrackerHelper
end
def new_follower_description ta
- n_('has followed 1 new profile:
%{name}', 'has followed %{num} new profiles:
%{name}', ta.get_follower_name.size).html_safe % {
+ n_('has 1 new follower:
%{name}', 'has %{num} new followers:
%{name}', ta.get_follower_name.size).html_safe % {
num: ta.get_follower_name.size,
name: safe_join(ta.collect_group_with_index(:follower_name) do |n,i|
link_to image_tag(ta.get_follower_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")),
diff --git a/db/migrate/20160608123748_create_profile_followers_table.rb b/db/migrate/20160608123748_create_profile_followers_table.rb
index e83e708..70e50d5 100644
--- a/db/migrate/20160608123748_create_profile_followers_table.rb
+++ b/db/migrate/20160608123748_create_profile_followers_table.rb
@@ -1,9 +1,20 @@
class CreateProfileFollowersTable < ActiveRecord::Migration
- def change
+ def up
create_table :profile_followers do |t|
t.column :profile_id, :integer
t.column :follower_id, :integer
t.column :group, :string
end
+
+ add_index :profile_followers, [:profile_id, :follower_id], :name => "profile_followers_composite_key_index", :unique => true
+
+ execute("INSERT INTO profile_followers(follower_id, profile_id, \"group\") SELECT f.person_id, f.friend_id, f.group FROM friendships as f")
+ execute("INSERT INTO profile_followers(follower_id, profile_id, \"group\") SELECT f.person_id, f.enterprise_id, 'favorites' FROM favorite_enterprise_people AS f")
+ execute("INSERT INTO profile_followers(follower_id, profile_id, \"group\") SELECT ra.accessor_id, ra.resource_id, 'member_of' FROM role_assignments as ra JOIN roles ON ra.role_id = roles.id WHERE roles.name IN ('Member','Moderator','Profile Administrator') ON CONFLICT DO NOTHING")
+ end
+
+ def down
+ remove_index :profile_followers, :name => "profile_followers_composite_key_index"
+ drop_table :profile_followers
end
end
diff --git a/db/migrate/20160616143830_create_followers_for_social_circles.rb b/db/migrate/20160616143830_create_followers_for_social_circles.rb
deleted file mode 100644
index f22077c..0000000
--- a/db/migrate/20160616143830_create_followers_for_social_circles.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateFollowersForSocialCircles < ActiveRecord::Migration
- def up
- #OK amizades
- #membros de comunidade
- #OK fans de empreendimento
-
- execute("INSERT INTO profile_followers(follower_id, profile_id, group) SELECT friend_id, person_id, group FROM friendships")
- execute("INSERT INTO profile_followers(follower_id, profile_id, group) SELECT f.person_id, f.enterprise_id, 'favorites' FROM favorite_enterprise_people AS f")
-
- end
-end
--
libgit2 0.21.2