Commit e935c71efb9b5d4589bbe78314751ce3a84261f7

Authored by Marcos Pereira
1 parent c4bef211

fixes notificatio message and data migration

app/helpers/action_tracker_helper.rb
... ... @@ -15,7 +15,7 @@ module ActionTrackerHelper
15 15 end
16 16  
17 17 def new_follower_description ta
18   - n_('has followed 1 new profile:<br />%{name}', 'has followed %{num} new profiles:<br />%{name}', ta.get_follower_name.size).html_safe % {
  18 + n_('has 1 new follower:<br />%{name}', 'has %{num} new followers:<br />%{name}', ta.get_follower_name.size).html_safe % {
19 19 num: ta.get_follower_name.size,
20 20 name: safe_join(ta.collect_group_with_index(:follower_name) do |n,i|
21 21 link_to image_tag(ta.get_follower_profile_custom_icon[i] || default_or_themed_icon("/images/icons-app/person-icon.png")),
... ...
db/migrate/20160608123748_create_profile_followers_table.rb
1 1 class CreateProfileFollowersTable < ActiveRecord::Migration
2   - def change
  2 + def up
3 3 create_table :profile_followers do |t|
4 4 t.column :profile_id, :integer
5 5 t.column :follower_id, :integer
6 6 t.column :group, :string
7 7 end
  8 +
  9 + add_index :profile_followers, [:profile_id, :follower_id], :name => "profile_followers_composite_key_index", :unique => true
  10 +
  11 + execute("INSERT INTO profile_followers(follower_id, profile_id, \"group\") SELECT f.person_id, f.friend_id, f.group FROM friendships as f")
  12 + execute("INSERT INTO profile_followers(follower_id, profile_id, \"group\") SELECT f.person_id, f.enterprise_id, 'favorites' FROM favorite_enterprise_people AS f")
  13 + 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")
  14 + end
  15 +
  16 + def down
  17 + remove_index :profile_followers, :name => "profile_followers_composite_key_index"
  18 + drop_table :profile_followers
8 19 end
9 20 end
... ...
db/migrate/20160616143830_create_followers_for_social_circles.rb
... ... @@ -1,11 +0,0 @@
1   -class CreateFollowersForSocialCircles < ActiveRecord::Migration
2   - def up
3   - #OK amizades
4   - #membros de comunidade
5   - #OK fans de empreendimento
6   -
7   - execute("INSERT INTO profile_followers(follower_id, profile_id, group) SELECT friend_id, person_id, group FROM friendships")
8   - execute("INSERT INTO profile_followers(follower_id, profile_id, group) SELECT f.person_id, f.enterprise_id, 'favorites' FROM favorite_enterprise_people AS f")
9   -
10   - end
11   -end