social_stream-base 0.23.0 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/like.rb +8 -3
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/db/migrate/{20120111141717_create_social_stream.rb → 20120326083509_create_social_stream.rb} +33 -8
- data/lib/generators/social_stream/base/install_generator.rb +1 -1
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/social_stream/controllers/objects.rb +4 -2
- data/lib/tasks/attachments.rake +22 -0
- data/social_stream-base.gemspec +4 -4
- data/spec/controllers/relation_customs_controller_spec.rb +2 -1
- data/spec/dummy/config/initializers/devise.rb +5 -11
- metadata +13 -17
- data/db/migrate/20120201185454_singleton_single_relations.rb +0 -46
- data/db/migrate/20120208135718_group_title_and_description_in_activity_object.rb +0 -54
- data/db/migrate/20120302215722_activity_object_properties.rb +0 -24
- data/db/migrate/20120316093946_create_activity_actions.rb +0 -15
- data/db/migrate/20120316113728_activity_action_follow.rb +0 -23
- data/db/migrate/20120326083509_object_channels_to_actions.rb +0 -47
data/app/models/like.rb
CHANGED
@@ -5,7 +5,8 @@ class Like
|
|
5
5
|
class << self
|
6
6
|
# Find the children activity of activity_id liked by subject
|
7
7
|
def find(subject, object)
|
8
|
-
like = new(object.liked_by(subject).first)
|
8
|
+
like = new(object.liked_by(subject).readonly(false).first)
|
9
|
+
return nil if like.object.nil?
|
9
10
|
# Cache object to make it available before it is destroyed
|
10
11
|
like.object
|
11
12
|
like
|
@@ -18,7 +19,9 @@ class Like
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def build(subject, user, object)
|
21
|
-
|
22
|
+
l = self.find(subject,object)
|
23
|
+
l = new object.new_like(subject, user) if l.nil?
|
24
|
+
l
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -34,7 +37,9 @@ class Like
|
|
34
37
|
# The object that is liked. It can be an activity
|
35
38
|
def object
|
36
39
|
@object ||=
|
37
|
-
if @like.
|
40
|
+
if @like.nil?
|
41
|
+
nil
|
42
|
+
elsif @like.is_root?
|
38
43
|
obj = @like.direct_object
|
39
44
|
obj = obj.subject if obj.is_a?(Actor)
|
40
45
|
obj
|
data/config/locales/en.yml
CHANGED
@@ -66,6 +66,7 @@ en:
|
|
66
66
|
atom_title: "Activity Stream from %{subject}"
|
67
67
|
title:
|
68
68
|
follow: "%{author} added %{activity_object} as contact"
|
69
|
+
unfollow: "%{author} removed %{activity_object} as contact"
|
69
70
|
like: "%{author} likes %{activity_object}"
|
70
71
|
make-friend: "%{author} also added %{activity_object} as contact"
|
71
72
|
post: "%{author} posted %{activity_object}"
|
data/config/locales/es.yml
CHANGED
@@ -65,6 +65,7 @@ es:
|
|
65
65
|
atom_title: "Actividades de %{subject}"
|
66
66
|
title:
|
67
67
|
follow: "%{author} añadió a %{activity_object} como contacto"
|
68
|
+
unfollow: "%{author} eliminó a %{activity_object} como contacto"
|
68
69
|
like: "A %{author} le gusta %{activity_object}"
|
69
70
|
make-friend: "%{author} también añadió a %{activity_object} como contacto"
|
70
71
|
post: "%{author} publicó %{activity_object}"
|
data/db/migrate/{20120111141717_create_social_stream.rb → 20120326083509_create_social_stream.rb}
RENAMED
@@ -11,6 +11,19 @@ class CreateSocialStream < ActiveRecord::Migration
|
|
11
11
|
add_index "activities", ["activity_verb_id"], :name => "index_activities_on_activity_verb_id"
|
12
12
|
add_index "activities", ["channel_id"], :name => "index_activities_on_channel_id"
|
13
13
|
|
14
|
+
create_table :activity_actions do |t|
|
15
|
+
t.references :actor
|
16
|
+
t.references :activity_object
|
17
|
+
t.boolean :follow, :default => false
|
18
|
+
t.boolean :author, :default => false
|
19
|
+
t.boolean :user_author, :default => false
|
20
|
+
t.boolean :owner, :default => false
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
add_index :activity_actions, :actor_id
|
25
|
+
add_index :activity_actions, :activity_object_id
|
26
|
+
|
14
27
|
create_table "activity_object_activities", :force => true do |t|
|
15
28
|
t.integer "activity_id"
|
16
29
|
t.integer "activity_object_id"
|
@@ -23,14 +36,25 @@ class CreateSocialStream < ActiveRecord::Migration
|
|
23
36
|
add_index "activity_object_activities", ["activity_object_id"], :name => "index_activity_object_activities_on_activity_object_id"
|
24
37
|
|
25
38
|
create_table "activity_objects", :force => true do |t|
|
39
|
+
t.string "title", :default => ""
|
40
|
+
t.text "description"
|
26
41
|
t.datetime "created_at"
|
27
42
|
t.datetime "updated_at"
|
28
|
-
t.string "object_type",
|
29
|
-
t.integer "like_count",
|
30
|
-
t.integer "
|
43
|
+
t.string "object_type", :limit => 45
|
44
|
+
t.integer "like_count", :default => 0
|
45
|
+
t.integer "follower_count", :default => 0
|
31
46
|
end
|
32
47
|
|
33
|
-
|
48
|
+
create_table :activity_object_properties do |t|
|
49
|
+
t.integer :activity_object_id
|
50
|
+
t.integer :property_id
|
51
|
+
t.string :type
|
52
|
+
|
53
|
+
t.timestamp
|
54
|
+
end
|
55
|
+
|
56
|
+
add_index "activity_object_properties", "activity_object_id"
|
57
|
+
add_index "activity_object_properties", "property_id"
|
34
58
|
|
35
59
|
create_table "activity_verbs", :force => true do |t|
|
36
60
|
t.string "name", :limit => 45
|
@@ -47,7 +71,6 @@ class CreateSocialStream < ActiveRecord::Migration
|
|
47
71
|
t.datetime "created_at"
|
48
72
|
t.datetime "updated_at"
|
49
73
|
t.integer "activity_object_id"
|
50
|
-
t.integer "follower_count", :default => 0
|
51
74
|
end
|
52
75
|
|
53
76
|
add_index "actors", ["activity_object_id"], :name => "index_actors_on_activity_object_id"
|
@@ -97,7 +120,6 @@ class CreateSocialStream < ActiveRecord::Migration
|
|
97
120
|
|
98
121
|
create_table "comments", :force => true do |t|
|
99
122
|
t.integer "activity_object_id"
|
100
|
-
t.text "text"
|
101
123
|
t.datetime "created_at"
|
102
124
|
t.datetime "updated_at"
|
103
125
|
end
|
@@ -136,7 +158,6 @@ class CreateSocialStream < ActiveRecord::Migration
|
|
136
158
|
t.integer "activity_object_id"
|
137
159
|
t.datetime "created_at"
|
138
160
|
t.datetime "updated_at"
|
139
|
-
t.text "text"
|
140
161
|
end
|
141
162
|
|
142
163
|
add_index "posts", ["activity_object_id"], :name => "index_posts_on_activity_object_id"
|
@@ -223,10 +244,14 @@ class CreateSocialStream < ActiveRecord::Migration
|
|
223
244
|
add_foreign_key "activities", "activity_verbs", :name => "index_activities_on_activity_verb_id"
|
224
245
|
add_foreign_key "activities", "channels", :name => "index_activities_on_channel_id"
|
225
246
|
|
247
|
+
add_foreign_key "activity_actions", "actors", :name => "index_activity_actions_on_actor_id"
|
248
|
+
add_foreign_key "activity_actions", "activity_objects", :name => "index_activity_actions_on_activity_object_id"
|
249
|
+
|
226
250
|
add_foreign_key "activity_object_activities", "activities", :name => "index_activity_object_activities_on_activity_id"
|
227
251
|
add_foreign_key "activity_object_activities", "activity_objects", :name => "activity_object_activities_on_activity_object_id"
|
228
252
|
|
229
|
-
add_foreign_key "
|
253
|
+
add_foreign_key "activity_object_properties", "activity_objects", :name => "index_activity_object_properties_on_activity_object_id", :column => :activity_object_id
|
254
|
+
add_foreign_key "activity_object_properties", "activity_objects", :name => "index_activity_object_properties_on_property_id", :column => :property_id
|
230
255
|
|
231
256
|
add_foreign_key "actors", "activity_objects", :name => "actors_on_activity_object_id"
|
232
257
|
|
@@ -13,7 +13,7 @@ class SocialStream::Base::InstallGenerator < Rails::Generators::Base #:nodoc:
|
|
13
13
|
\n config.omniauth :facebook, \"129571360447856\",\"eef39dce5e20e76f77495c59623bdb38\"
|
14
14
|
\n #config.omniauth :twitter, \"wgTxO0fTpjTeSnjKC9ZHA\",\"JepulVWwLcuAnGfWjwCu47yEP0TcJJfKtvISPBsilI\"
|
15
15
|
\n config.token_authentication_key = :auth_token
|
16
|
-
\n config.
|
16
|
+
\n config.skip_session_storage << :token_auth",
|
17
17
|
:after => " # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'"
|
18
18
|
end
|
19
19
|
|
@@ -8,9 +8,11 @@ module SocialStream
|
|
8
8
|
|
9
9
|
before_filter :set_author_ids, :only => [ :new, :create, :update ]
|
10
10
|
|
11
|
-
|
11
|
+
before_filter :authenticate_user!, :only => [:new, :edit, :create, :update, :destroy]
|
12
12
|
|
13
|
-
|
13
|
+
after_filter :increment_visit_count, :only => :show
|
14
|
+
|
15
|
+
load_and_authorize_resource :except => [ :new, :index, :search ]
|
14
16
|
|
15
17
|
respond_to :html, :js
|
16
18
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :social_stream do
|
2
|
+
namespace :avatars do
|
3
|
+
desc "Fix avatar's attachment path from paperclip < 3.0"
|
4
|
+
task :fix => :environment do
|
5
|
+
dir = "#{ Rails.root }/public/system/logos/"
|
6
|
+
|
7
|
+
Avatar.all.each do |a|
|
8
|
+
old_logo_dir = "#{ dir }#{ a.id }/"
|
9
|
+
|
10
|
+
old_logo_contents = Dir["#{ old_logo_dir }*"]
|
11
|
+
|
12
|
+
new_logo_dir = "#{ Rails.root }/public#{ a.logo.to_s.split('original').first }"
|
13
|
+
|
14
|
+
puts "Moving #{ old_logo_dir } to #{ new_logo_dir }"
|
15
|
+
|
16
|
+
FileUtils.mkdir_p new_logo_dir
|
17
|
+
FileUtils.mv old_logo_contents, new_logo_dir
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
data/social_stream-base.gemspec
CHANGED
@@ -26,17 +26,17 @@ Gem::Specification.new do |s|
|
|
26
26
|
# SQL foreign keys
|
27
27
|
s.add_runtime_dependency('foreigner', '~> 1.1.1')
|
28
28
|
# Authentication
|
29
|
-
s.add_runtime_dependency('devise', '~> 1.
|
29
|
+
s.add_runtime_dependency('devise', '~> 2.1.2')
|
30
30
|
# CRUD controllers
|
31
31
|
s.add_runtime_dependency('inherited_resources', '~> 1.3.0')
|
32
32
|
# Slug generation
|
33
33
|
s.add_runtime_dependency('stringex', '~> 1.3.0')
|
34
34
|
# Avatar attachments
|
35
|
-
s.add_runtime_dependency('avatars_for_rails', '~> 0.2.
|
35
|
+
s.add_runtime_dependency('avatars_for_rails', '~> 0.2.8')
|
36
36
|
# jQuery
|
37
37
|
s.add_runtime_dependency('jquery-rails', '>= 1.0.9')
|
38
38
|
# Authorization
|
39
|
-
s.add_runtime_dependency('cancan', '1.6.7')
|
39
|
+
s.add_runtime_dependency('cancan', '~> 1.6.7')
|
40
40
|
# Pagination
|
41
41
|
s.add_runtime_dependency('kaminari', '~> 0.13.0')
|
42
42
|
# OAuth client
|
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
|
|
50
50
|
# HTML Forms
|
51
51
|
s.add_runtime_dependency('formtastic','>= 1.2.3')
|
52
52
|
# Background jobs
|
53
|
-
s.add_runtime_dependency('resque','~> 1.
|
53
|
+
s.add_runtime_dependency('resque','~> 1.23.0')
|
54
54
|
# Modernizr.js javascript library
|
55
55
|
s.add_runtime_dependency('modernizr-rails', '~> 2.0.6')
|
56
56
|
# Sphinx search engine
|
@@ -74,7 +74,8 @@ describe Relation::CustomsController do
|
|
74
74
|
begin
|
75
75
|
post :create, :custom => { :name => 'Test', :actor_id => actor.id }
|
76
76
|
|
77
|
-
|
77
|
+
assigns(:custom).should_not be_new_record
|
78
|
+
assigns(:custom).actor_id.should eq(@user.actor_id)
|
78
79
|
rescue CanCan::AccessDenied
|
79
80
|
assigns(:custom).should be_new_record
|
80
81
|
|
@@ -93,10 +93,6 @@ Devise.setup do |config|
|
|
93
93
|
# If true, extends the user's remember period when remembered via cookie.
|
94
94
|
# config.extend_remember_period = false
|
95
95
|
|
96
|
-
# If true, uses the password salt as remember token. This should be turned
|
97
|
-
# to false if you are not using database authenticatable.
|
98
|
-
config.use_salt_as_remember_token = true
|
99
|
-
|
100
96
|
# Options to be passed to the created cookie. For instance, you can set
|
101
97
|
# :secure => true in order to force SSL only cookies.
|
102
98
|
# config.cookie_options = {}
|
@@ -159,11 +155,7 @@ Devise.setup do |config|
|
|
159
155
|
# ==> Configuration for :token_authenticatable
|
160
156
|
# Defines name of the authentication token params key
|
161
157
|
# config.token_authentication_key = :auth_token
|
162
|
-
|
163
|
-
# If true, authentication through token does not store user in session and needs
|
164
|
-
# to be supplied on each request. Useful if you are using the token as API token.
|
165
|
-
# config.stateless_token = false
|
166
|
-
|
158
|
+
|
167
159
|
# ==> Scopes configuration
|
168
160
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
169
161
|
# "users/sessions/new". It's turned off by default because it's slower if you
|
@@ -205,9 +197,11 @@ Devise.setup do |config|
|
|
205
197
|
#config.omniauth :twitter, "wgTxO0fTpjTeSnjKC9ZHA","JepulVWwLcuAnGfWjwCu47yEP0TcJJfKtvISPBsilI"
|
206
198
|
|
207
199
|
config.token_authentication_key = :auth_token
|
208
|
-
|
209
|
-
config.stateless_token = true
|
210
200
|
|
201
|
+
#re state_less token removal
|
202
|
+
#https://github.com/plataformatec/devise/issues/1499
|
203
|
+
config.skip_session_storage << :token_auth
|
204
|
+
|
211
205
|
# ==> Warden configuration
|
212
206
|
# If you want to use other strategies, that are not supported by Devise, or
|
213
207
|
# change the failure app, you can configure them inside the config.warden block.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deep_merge
|
@@ -99,7 +99,7 @@ dependencies:
|
|
99
99
|
requirements:
|
100
100
|
- - ~>
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
102
|
+
version: 2.1.2
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -107,7 +107,7 @@ dependencies:
|
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 2.1.2
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: inherited_resources
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,7 +147,7 @@ dependencies:
|
|
147
147
|
requirements:
|
148
148
|
- - ~>
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: 0.2.
|
150
|
+
version: 0.2.8
|
151
151
|
type: :runtime
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -155,7 +155,7 @@ dependencies:
|
|
155
155
|
requirements:
|
156
156
|
- - ~>
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: 0.2.
|
158
|
+
version: 0.2.8
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: jquery-rails
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,7 +177,7 @@ dependencies:
|
|
177
177
|
requirement: !ruby/object:Gem::Requirement
|
178
178
|
none: false
|
179
179
|
requirements:
|
180
|
-
- -
|
180
|
+
- - ~>
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: 1.6.7
|
183
183
|
type: :runtime
|
@@ -185,7 +185,7 @@ dependencies:
|
|
185
185
|
version_requirements: !ruby/object:Gem::Requirement
|
186
186
|
none: false
|
187
187
|
requirements:
|
188
|
-
- -
|
188
|
+
- - ~>
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: 1.6.7
|
191
191
|
- !ruby/object:Gem::Dependency
|
@@ -307,7 +307,7 @@ dependencies:
|
|
307
307
|
requirements:
|
308
308
|
- - ~>
|
309
309
|
- !ruby/object:Gem::Version
|
310
|
-
version: 1.
|
310
|
+
version: 1.23.0
|
311
311
|
type: :runtime
|
312
312
|
prerelease: false
|
313
313
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -315,7 +315,7 @@ dependencies:
|
|
315
315
|
requirements:
|
316
316
|
- - ~>
|
317
317
|
- !ruby/object:Gem::Version
|
318
|
-
version: 1.
|
318
|
+
version: 1.23.0
|
319
319
|
- !ruby/object:Gem::Dependency
|
320
320
|
name: modernizr-rails
|
321
321
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1061,13 +1061,7 @@ files:
|
|
1061
1061
|
- config/locales/rails.es.yml
|
1062
1062
|
- config/locales/rails.pt.yml
|
1063
1063
|
- config/routes.rb
|
1064
|
-
- db/migrate/
|
1065
|
-
- db/migrate/20120201185454_singleton_single_relations.rb
|
1066
|
-
- db/migrate/20120208135718_group_title_and_description_in_activity_object.rb
|
1067
|
-
- db/migrate/20120302215722_activity_object_properties.rb
|
1068
|
-
- db/migrate/20120316093946_create_activity_actions.rb
|
1069
|
-
- db/migrate/20120316113728_activity_action_follow.rb
|
1070
|
-
- db/migrate/20120326083509_object_channels_to_actions.rb
|
1064
|
+
- db/migrate/20120326083509_create_social_stream.rb
|
1071
1065
|
- db/migrate/20120403175913_create_activity_object_audiences.rb
|
1072
1066
|
- db/migrate/20120411132550_add_visit_count_to_activity_object.rb
|
1073
1067
|
- db/migrate/20120411151413_relation_public_permissions.rb
|
@@ -1149,6 +1143,7 @@ files:
|
|
1149
1143
|
- lib/social_stream/views/settings/base.rb
|
1150
1144
|
- lib/social_stream/views/sidebar/base.rb
|
1151
1145
|
- lib/social_stream/views/toolbar/base.rb
|
1146
|
+
- lib/tasks/attachments.rake
|
1152
1147
|
- lib/tasks/db/populate.rake
|
1153
1148
|
- lib/tasks/workers.rake
|
1154
1149
|
- lib/thinking-sphinx/social_stream.rb
|
@@ -1305,3 +1300,4 @@ signing_key:
|
|
1305
1300
|
specification_version: 3
|
1306
1301
|
summary: Basic features for Social Stream, the core for building social network websites
|
1307
1302
|
test_files: []
|
1303
|
+
has_rdoc:
|
@@ -1,46 +0,0 @@
|
|
1
|
-
class SingletonSingleRelations < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
Tie.record_timestamps = false
|
4
|
-
Audience.record_timestamps = false
|
5
|
-
|
6
|
-
r_new = Relation::Public.instance
|
7
|
-
|
8
|
-
Relation::Public.all.each do |r|
|
9
|
-
next if r == r_new
|
10
|
-
|
11
|
-
# Reassign r -> r_new
|
12
|
-
r.ties.each do |t|
|
13
|
-
t.update_column(:relation_id, r_new.id)
|
14
|
-
end
|
15
|
-
|
16
|
-
r.audiences.each do |a|
|
17
|
-
a.update_column(:relation_id, r_new.id)
|
18
|
-
end
|
19
|
-
|
20
|
-
# Delete r
|
21
|
-
r.delete
|
22
|
-
end
|
23
|
-
|
24
|
-
r_new = Relation::Reject.instance
|
25
|
-
|
26
|
-
Relation::Reject.all.each do |r|
|
27
|
-
next if r == r_new
|
28
|
-
|
29
|
-
# Reassign r -> r_new
|
30
|
-
r.ties.each do |t|
|
31
|
-
t.update_column(:relation_id, r_new.id)
|
32
|
-
end
|
33
|
-
|
34
|
-
r.audiences.each do |a|
|
35
|
-
a.update_column(:relation_id, r_new.id)
|
36
|
-
end
|
37
|
-
|
38
|
-
# Delete r
|
39
|
-
r.delete
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def down
|
44
|
-
raise ActiveRecord::IrreversibleMigration
|
45
|
-
end
|
46
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
class GroupTitleAndDescriptionInActivityObject < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
ao_ts = ActivityObject.record_timestamps
|
4
|
-
ActivityObject.record_timestamps = false
|
5
|
-
|
6
|
-
change_table :activity_objects do |t|
|
7
|
-
t.string :title, :default => ""
|
8
|
-
t.text :description
|
9
|
-
end
|
10
|
-
|
11
|
-
ActivityObject.reset_column_information
|
12
|
-
|
13
|
-
# Fix 'comments' table
|
14
|
-
c_ts = Comment.record_timestamps
|
15
|
-
Comment.record_timestamps = false
|
16
|
-
|
17
|
-
Comment.all.each do |c|
|
18
|
-
# Remove comments that are not properly deleted
|
19
|
-
# https://github.com/ging/social_stream/issues/213
|
20
|
-
if c.activity_object.activities.blank?
|
21
|
-
c.destroy
|
22
|
-
next
|
23
|
-
end
|
24
|
-
|
25
|
-
c.activity_object.description = c.read_attribute(:text)
|
26
|
-
c.save!
|
27
|
-
end
|
28
|
-
change_table :comments do |t|
|
29
|
-
t.remove :text
|
30
|
-
end
|
31
|
-
Comment.reset_column_information
|
32
|
-
Comment.record_timestamps = c_ts
|
33
|
-
|
34
|
-
# Fix 'posts' table
|
35
|
-
p_ts = Post.record_timestamps
|
36
|
-
Post.record_timestamps = false
|
37
|
-
|
38
|
-
Post.all.each do |p|
|
39
|
-
p.activity_object.description = p.read_attribute(:text)
|
40
|
-
p.save!
|
41
|
-
end
|
42
|
-
change_table :posts do |t|
|
43
|
-
t.remove :text
|
44
|
-
end
|
45
|
-
Post.reset_column_information
|
46
|
-
Post.record_timestamps = p_ts
|
47
|
-
|
48
|
-
ActivityObject.record_timestamps = ao_ts
|
49
|
-
end
|
50
|
-
|
51
|
-
def down
|
52
|
-
raise ActiveRecord::IrreversibleMigration # Due to trans-gem oddities
|
53
|
-
end
|
54
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
class ActivityObjectProperties < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
create_table :activity_object_properties do |t|
|
4
|
-
t.integer :activity_object_id
|
5
|
-
t.integer :property_id
|
6
|
-
t.string :type
|
7
|
-
|
8
|
-
t.timestamp
|
9
|
-
end
|
10
|
-
|
11
|
-
add_index "activity_object_properties", "activity_object_id"
|
12
|
-
add_index "activity_object_properties", "property_id"
|
13
|
-
|
14
|
-
add_foreign_key "activity_object_properties", "activity_objects", :name => "index_activity_object_properties_on_activity_object_id", :column => :activity_object_id
|
15
|
-
add_foreign_key "activity_object_properties", "activity_objects", :name => "index_activity_object_properties_on_property_id", :column => :property_id
|
16
|
-
end
|
17
|
-
|
18
|
-
def down
|
19
|
-
remove_foreign_key "activity_object_properties", :name => "index_activity_object_properties_on_activity_object_id"
|
20
|
-
remove_foreign_key "activity_object_properties", :name => "index_activity_object_properties_on_property_id"
|
21
|
-
|
22
|
-
drop_table :activity_object_properties
|
23
|
-
end
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class CreateActivityActions < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :activity_actions do |t|
|
4
|
-
t.references :actor
|
5
|
-
t.references :activity_object
|
6
|
-
|
7
|
-
t.timestamps
|
8
|
-
end
|
9
|
-
add_index :activity_actions, :actor_id
|
10
|
-
add_index :activity_actions, :activity_object_id
|
11
|
-
|
12
|
-
add_foreign_key "activity_actions", "actors", :name => "index_activity_actions_on_actor_id"
|
13
|
-
add_foreign_key "activity_actions", "activity_objects", :name => "index_activity_actions_on_activity_object_id"
|
14
|
-
end
|
15
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class ActivityActionFollow < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
add_column :activity_actions, :follow, :boolean, :default => false
|
4
|
-
add_column :activity_objects, :follower_count, :integer, :default => 0
|
5
|
-
remove_column :actors, :follower_count
|
6
|
-
|
7
|
-
ActivityObject.reset_column_information
|
8
|
-
Actor.reset_column_information
|
9
|
-
|
10
|
-
Tie.
|
11
|
-
joins(:relation).
|
12
|
-
with_permissions('follow', nil).
|
13
|
-
each do |t|
|
14
|
-
t.set_follow_action
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def down
|
19
|
-
remove_column :activity_actions, :follow
|
20
|
-
remove_column :activity_objects, :follower_count
|
21
|
-
add_column :actors, :follower_count, :integer, :default => 0
|
22
|
-
end
|
23
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
class ObjectChannelsToActions < ActiveRecord::Migration
|
2
|
-
class Channel < ActiveRecord::Base; end
|
3
|
-
|
4
|
-
def up
|
5
|
-
add_column :activity_actions, :author, :boolean, :default => false
|
6
|
-
add_column :activity_actions, :user_author, :boolean, :default => false
|
7
|
-
add_column :activity_actions, :owner, :boolean, :default => false
|
8
|
-
|
9
|
-
ActivityAction.reset_column_information
|
10
|
-
ActivityAction.record_timestamps = false
|
11
|
-
ActivityObject.record_timestamps = false
|
12
|
-
|
13
|
-
ActivityObject.all.each do |ao|
|
14
|
-
channel = Channel.find ao.channel_id
|
15
|
-
|
16
|
-
%w{ author user_author owner }.each do |role|
|
17
|
-
next unless channel.__send__ "#{ role }_id"
|
18
|
-
|
19
|
-
ao.__send__"#{ role }_id=", channel.__send__("#{ role }_id")
|
20
|
-
end
|
21
|
-
|
22
|
-
ao.received_actions.each do |a|
|
23
|
-
a.created_at = a.updated_at = ao.created_at
|
24
|
-
end
|
25
|
-
|
26
|
-
ao.save!
|
27
|
-
end
|
28
|
-
|
29
|
-
remove_foreign_key :activity_objects, :name => "index_activity_objects_on_channel_id"
|
30
|
-
remove_column :activity_objects, :channel_id
|
31
|
-
|
32
|
-
ActivityObject.reset_column_information
|
33
|
-
|
34
|
-
ActivityAction.record_timestamps = true
|
35
|
-
ActivityObject.record_timestamps = true
|
36
|
-
end
|
37
|
-
|
38
|
-
def down
|
39
|
-
remove_column :activity_actions, :author
|
40
|
-
remove_column :activity_actions, :user_author
|
41
|
-
remove_column :activity_actions, :owner
|
42
|
-
|
43
|
-
add_column :activity_objects, :channel_id, :integer
|
44
|
-
add_index :activity_objects, :channel_id
|
45
|
-
add_foreign_key :activity_actions, :channel_id, :name => "index_activity_objects_on_channel_id"
|
46
|
-
end
|
47
|
-
end
|