social_stream 0.24.1 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/base/app/assets/javascripts/social_stream.action.js +40 -0
  2. data/base/app/assets/javascripts/social_stream.comments.js +26 -1
  3. data/base/app/assets/javascripts/social_stream.timeline.js +15 -7
  4. data/base/app/assets/javascripts/social_stream.wall.js.erb +1 -0
  5. data/base/app/assets/stylesheets/social_stream-base.css.scss +13 -0
  6. data/base/app/models/activity.rb +5 -1
  7. data/base/app/models/activity_action.rb +6 -0
  8. data/base/app/models/activity_object.rb +131 -9
  9. data/base/app/models/actor.rb +2 -0
  10. data/base/app/models/channel.rb +0 -1
  11. data/base/app/models/comment.rb +0 -6
  12. data/base/app/views/activity_actions/_update.js.erb +11 -0
  13. data/base/app/views/activity_actions/create.js.erb +1 -1
  14. data/base/app/views/activity_actions/update.js.erb +1 -1
  15. data/base/app/views/comments/create.js.erb +1 -1
  16. data/base/app/views/posts/create.js.erb +1 -1
  17. data/base/db/migrate/20120111141717_create_social_stream.rb +265 -0
  18. data/base/db/migrate/20120326083509_object_channels_to_actions.rb +45 -0
  19. data/base/lib/social_stream/ability/base.rb +2 -2
  20. data/base/lib/social_stream/base/version.rb +1 -1
  21. data/base/lib/social_stream/controllers/cancan_devise_integration.rb +9 -5
  22. data/base/lib/social_stream/models/object.rb +0 -72
  23. data/base/lib/social_stream/models/subject.rb +2 -1
  24. data/base/lib/social_stream/models/subtype.rb +6 -1
  25. data/base/spec/controllers/groups_controller_spec.rb +6 -0
  26. data/base/spec/factories/post.rb +6 -0
  27. data/base/spec/models/activity_action_spec.rb +35 -0
  28. data/documents/app/assets/javascripts/social_stream.video.js.erb +2 -1
  29. data/documents/app/controllers/documents_controller.rb +4 -1
  30. data/documents/app/models/document.rb +10 -0
  31. data/documents/app/models/video.rb +17 -1
  32. data/documents/app/views/videos/_video_processed.html.erb +1 -0
  33. data/documents/app/views/videos/_video_show.html.erb +2 -1
  34. data/documents/db/migrate/{20110615143707_create_social_stream_documents.rb → 20120109155431_create_social_stream_documents.rb} +9 -11
  35. data/documents/lib/social_stream/documents/engine.rb +1 -0
  36. data/documents/lib/social_stream/documents/version.rb +1 -1
  37. data/documents/social_stream-documents.gemspec +1 -1
  38. data/events/app/assets/javascripts/social_stream.calendar.js.erb +15 -9
  39. data/events/app/assets/javascripts/social_stream.events.action.js +31 -0
  40. data/events/db/migrate/20111218203314_create_events.rb +33 -0
  41. data/events/db/migrate/20120330131859_create_social_stream_events.rb +10 -0
  42. data/events/lib/social_stream/events/version.rb +1 -1
  43. data/events/social_stream-events.gemspec +1 -1
  44. data/lib/social_stream/version.rb +1 -1
  45. data/lib/tasks/migrations.rake +2 -0
  46. data/linkser/app/views/links/create.js.erb +1 -1
  47. data/linkser/db/migrate/{20111129100618_create_social_stream_linkser.rb → 20111219122952_create_social_stream_linkser.rb} +4 -7
  48. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  49. data/linkser/social_stream-linkser.gemspec +1 -1
  50. data/presence/db/migrate/20120330132148_create_social_stream_presence.rb +10 -0
  51. data/presence/lib/social_stream/presence/version.rb +1 -1
  52. data/presence/social_stream-presence.gemspec +1 -1
  53. data/social_stream.gemspec +5 -5
  54. metadata +42 -54
  55. data/base/app/assets/stylesheets/social_stream-base.css +0 -5
  56. data/base/app/views/activity_actions/_update_form.js.erb +0 -2
  57. data/base/db/migrate/20110610112023_create_social_stream.rb +0 -319
  58. data/base/db/migrate/20110705103202_empty_ties_count.rb +0 -17
  59. data/base/db/migrate/20110712090343_remove_spheres.rb +0 -30
  60. data/base/db/migrate/20110712142140_remove_permission_function.rb +0 -26
  61. data/base/db/migrate/20110912074426_add_reject_relation.rb +0 -29
  62. data/base/db/migrate/20111124100618_object_actors.rb +0 -52
  63. data/base/db/migrate/20111221103509_add_language_field.rb +0 -13
  64. data/base/db/migrate/20120103103125_add_channels.rb +0 -88
  65. data/base/db/migrate/20120109081509_update_notify_permissions.rb +0 -15
  66. data/base/db/migrate/20120111120920_remove_language_default.rb +0 -9
  67. data/base/db/migrate/20120111141717_activity_channels.rb +0 -74
  68. data/documents/db/migrate/20110922173707_add_file_processing_to_document.rb +0 -9
  69. data/documents/db/migrate/20111005112707_add_title_and_description_to_document.rb +0 -11
  70. data/documents/db/migrate/20120109155431_document_object_type.rb +0 -16
  71. data/events/db/migrate/20111101193523_create_events.rb +0 -13
  72. data/events/db/migrate/20111120104349_create_rooms.rb +0 -26
  73. data/events/db/migrate/20111204155637_add_scheduler.rb +0 -33
  74. data/events/db/migrate/20111218203314_change_scheduler.rb +0 -11
  75. data/linkser/db/migrate/20111219122952_add_width_height_to_link.rb +0 -15
@@ -1 +1 @@
1
- <%= render :partial => 'update_form', :locals => { :activity_object => @activity_object } %>
1
+ <%= render :partial => 'update' %>
@@ -1 +1 @@
1
- <%= render :partial => 'update_form', :locals => { :activity_object => @activity_action.activity_object } %>
1
+ <%= render :partial => 'update' %>
@@ -5,4 +5,4 @@ $(".input_new_comments").each(function() {
5
5
  $(this).focus().val("").blur();
6
6
  });
7
7
 
8
- SocialStream.Timeline.newActivity("<%= escape_javascript dom_id(@comment.post_activity) %>");
8
+ SocialStream.Timeline.create("<%= escape_javascript dom_id(@comment.post_activity) %>");
@@ -1,4 +1,4 @@
1
1
  //Display the new post
2
2
  $("#wall").prepend("<%= escape_javascript(render @post.post_activity) %>");
3
3
 
4
- SocialStream.Timeline.newActivity("<%= escape_javascript dom_id(@post.post_activity) %>");
4
+ SocialStream.Timeline.create("<%= escape_javascript dom_id(@post.post_activity) %>");
@@ -0,0 +1,265 @@
1
+ class CreateSocialStream < ActiveRecord::Migration
2
+ def change
3
+ create_table "activities", :force => true do |t|
4
+ t.integer "activity_verb_id"
5
+ t.datetime "created_at"
6
+ t.datetime "updated_at"
7
+ t.string "ancestry"
8
+ t.integer "channel_id"
9
+ end
10
+
11
+ add_index "activities", ["activity_verb_id"], :name => "index_activities_on_activity_verb_id"
12
+ add_index "activities", ["channel_id"], :name => "index_activities_on_channel_id"
13
+
14
+ create_table "activity_object_activities", :force => true do |t|
15
+ t.integer "activity_id"
16
+ t.integer "activity_object_id"
17
+ t.datetime "created_at"
18
+ t.datetime "updated_at"
19
+ t.string "object_type"
20
+ end
21
+
22
+ add_index "activity_object_activities", ["activity_id"], :name => "index_activity_object_activities_on_activity_id"
23
+ add_index "activity_object_activities", ["activity_object_id"], :name => "index_activity_object_activities_on_activity_object_id"
24
+
25
+ create_table "activity_objects", :force => true do |t|
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ t.string "object_type", :limit => 45
29
+ t.integer "like_count", :default => 0
30
+ t.integer "channel_id"
31
+ end
32
+
33
+ add_index "activity_objects", ["channel_id"], :name => "index_activity_objects_on_channel_id"
34
+
35
+ create_table "activity_verbs", :force => true do |t|
36
+ t.string "name", :limit => 45
37
+ t.datetime "created_at"
38
+ t.datetime "updated_at"
39
+ end
40
+
41
+ create_table "actors", :force => true do |t|
42
+ t.string "name"
43
+ t.string "email", :default => "", :null => false
44
+ t.string "slug"
45
+ t.string "subject_type"
46
+ t.boolean "notify_by_email", :default => true
47
+ t.datetime "created_at"
48
+ t.datetime "updated_at"
49
+ t.integer "activity_object_id"
50
+ t.integer "follower_count", :default => 0
51
+ end
52
+
53
+ add_index "actors", ["activity_object_id"], :name => "index_actors_on_activity_object_id"
54
+ add_index "actors", ["email"], :name => "index_actors_on_email"
55
+ add_index "actors", ["slug"], :name => "index_actors_on_slug", :unique => true
56
+
57
+ create_table "audiences", :force => true do |t|
58
+ t.integer "relation_id"
59
+ t.integer "activity_id"
60
+ end
61
+
62
+ add_index "audiences", ["activity_id"], :name => "index_audiences_on_activity_id"
63
+ add_index "audiences", ["relation_id"], :name => "index_audiences_on_relation_id"
64
+
65
+ create_table "authentications", :force => true do |t|
66
+ t.integer "user_id"
67
+ t.string "provider"
68
+ t.string "uid"
69
+ t.datetime "created_at", :null => false
70
+ t.datetime "updated_at", :null => false
71
+ end
72
+
73
+ add_index "authentications", ["user_id"], :name => "index_authentications_on_user_id"
74
+
75
+ create_table "avatars", :force => true do |t|
76
+ t.integer "actor_id"
77
+ t.string "logo_file_name"
78
+ t.string "logo_content_type"
79
+ t.integer "logo_file_size"
80
+ t.datetime "logo_updated_at"
81
+ t.boolean "active", :default => true
82
+ end
83
+
84
+ add_index "avatars", ["actor_id"], :name => "index_avatars_on_actor_id"
85
+
86
+ create_table "channels", :force => true do |t|
87
+ t.integer "author_id"
88
+ t.integer "owner_id"
89
+ t.integer "user_author_id"
90
+ t.datetime "created_at", :null => false
91
+ t.datetime "updated_at", :null => false
92
+ end
93
+
94
+ add_index "channels", ["author_id"], :name => "index_channels_on_author_id"
95
+ add_index "channels", ["owner_id"], :name => "index_channels_on_owner_id"
96
+ add_index "channels", ["user_author_id"], :name => "index_channels_on_user_author_id"
97
+
98
+ create_table "comments", :force => true do |t|
99
+ t.integer "activity_object_id"
100
+ t.text "text"
101
+ t.datetime "created_at"
102
+ t.datetime "updated_at"
103
+ end
104
+
105
+ add_index "comments", ["activity_object_id"], :name => "index_comments_on_activity_object_id"
106
+
107
+ create_table "contacts", :force => true do |t|
108
+ t.integer "sender_id"
109
+ t.integer "receiver_id"
110
+ t.datetime "created_at"
111
+ t.datetime "updated_at"
112
+ t.integer "inverse_id"
113
+ t.integer "ties_count", :default => 0
114
+ end
115
+
116
+ add_index "contacts", ["inverse_id"], :name => "index_contacts_on_inverse_id"
117
+ add_index "contacts", ["receiver_id"], :name => "index_contacts_on_receiver_id"
118
+ add_index "contacts", ["sender_id"], :name => "index_contacts_on_sender_id"
119
+
120
+ create_table "groups", :force => true do |t|
121
+ t.integer "actor_id"
122
+ t.datetime "created_at"
123
+ t.datetime "updated_at"
124
+ end
125
+
126
+ add_index "groups", ["actor_id"], :name => "index_groups_on_actor_id"
127
+
128
+ create_table "permissions", :force => true do |t|
129
+ t.string "action"
130
+ t.string "object"
131
+ t.datetime "created_at"
132
+ t.datetime "updated_at"
133
+ end
134
+
135
+ create_table "posts", :force => true do |t|
136
+ t.integer "activity_object_id"
137
+ t.datetime "created_at"
138
+ t.datetime "updated_at"
139
+ t.text "text"
140
+ end
141
+
142
+ add_index "posts", ["activity_object_id"], :name => "index_posts_on_activity_object_id"
143
+
144
+ create_table "profiles", :force => true do |t|
145
+ t.integer "actor_id"
146
+ t.date "birthday"
147
+ t.datetime "created_at"
148
+ t.datetime "updated_at"
149
+ t.string "organization", :limit => 45
150
+ t.string "phone", :limit => 45
151
+ t.string "mobile", :limit => 45
152
+ t.string "fax", :limit => 45
153
+ t.string "address"
154
+ t.string "city"
155
+ t.string "zipcode", :limit => 45
156
+ t.string "province", :limit => 45
157
+ t.string "country", :limit => 45
158
+ t.integer "prefix_key"
159
+ t.string "description"
160
+ t.string "experience"
161
+ t.string "website"
162
+ t.string "skype", :limit => 45
163
+ t.string "im", :limit => 45
164
+ end
165
+
166
+ add_index "profiles", ["actor_id"], :name => "index_profiles_on_actor_id"
167
+
168
+ create_table "relation_permissions", :force => true do |t|
169
+ t.integer "relation_id"
170
+ t.integer "permission_id"
171
+ t.datetime "created_at"
172
+ t.datetime "updated_at"
173
+ end
174
+
175
+ add_index "relation_permissions", ["permission_id"], :name => "index_relation_permissions_on_permission_id"
176
+ add_index "relation_permissions", ["relation_id"], :name => "index_relation_permissions_on_relation_id"
177
+
178
+ create_table "relations", :force => true do |t|
179
+ t.integer "actor_id"
180
+ t.string "type"
181
+ t.string "name"
182
+ t.datetime "created_at"
183
+ t.datetime "updated_at"
184
+ t.string "sender_type"
185
+ t.string "receiver_type"
186
+ t.string "ancestry"
187
+ end
188
+
189
+ add_index "relations", ["actor_id"], :name => "index_relations_on_actor_id"
190
+ add_index "relations", ["ancestry"], :name => "index_relations_on_ancestry"
191
+
192
+ create_table "ties", :force => true do |t|
193
+ t.integer "contact_id"
194
+ t.integer "relation_id"
195
+ t.datetime "created_at"
196
+ t.datetime "updated_at"
197
+ end
198
+
199
+ add_index "ties", ["contact_id"], :name => "index_ties_on_contact_id"
200
+ add_index "ties", ["relation_id"], :name => "index_ties_on_relation_id"
201
+
202
+ create_table "users", :force => true do |t|
203
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
204
+ t.string "password_salt"
205
+ t.string "reset_password_token"
206
+ t.datetime "reset_password_sent_at"
207
+ t.datetime "remember_created_at"
208
+ t.integer "sign_in_count", :default => 0
209
+ t.datetime "current_sign_in_at"
210
+ t.datetime "last_sign_in_at"
211
+ t.string "current_sign_in_ip"
212
+ t.string "last_sign_in_ip"
213
+ t.string "authentication_token"
214
+ t.datetime "created_at", :null => false
215
+ t.datetime "updated_at", :null => false
216
+ t.integer "actor_id"
217
+ t.string "language"
218
+ end
219
+
220
+ add_index "users", ["actor_id"], :name => "index_users_on_actor_id"
221
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
222
+
223
+ add_foreign_key "activities", "activity_verbs", :name => "index_activities_on_activity_verb_id"
224
+ add_foreign_key "activities", "channels", :name => "index_activities_on_channel_id"
225
+
226
+ add_foreign_key "activity_object_activities", "activities", :name => "index_activity_object_activities_on_activity_id"
227
+ add_foreign_key "activity_object_activities", "activity_objects", :name => "activity_object_activities_on_activity_object_id"
228
+
229
+ add_foreign_key "activity_objects", "channels", :name => "index_activity_objects_on_channel_id"
230
+
231
+ add_foreign_key "actors", "activity_objects", :name => "actors_on_activity_object_id"
232
+
233
+ add_foreign_key "audiences", "activities", :name => "audiences_on_activity_id"
234
+ add_foreign_key "audiences", "relations", :name => "audiences_on_relation_id"
235
+
236
+ add_foreign_key "authentications", "users", :name => "authentications_on_user_id"
237
+
238
+ add_foreign_key "avatars", "actors", :name => "avatars_on_actor_id"
239
+
240
+ add_foreign_key "channels", "actors", :name => "index_channels_on_author_id", :column => "author_id"
241
+ add_foreign_key "channels", "actors", :name => "index_channels_on_owner_id", :column => "owner_id"
242
+ add_foreign_key "channels", "actors", :name => "index_channels_on_user_author_id", :column => "user_author_id"
243
+
244
+ add_foreign_key "comments", "activity_objects", :name => "comments_on_activity_object_id"
245
+
246
+ add_foreign_key "contacts", "actors", :name => "contacts_on_receiver_id", :column => "receiver_id"
247
+ add_foreign_key "contacts", "actors", :name => "contacts_on_sender_id", :column => "sender_id"
248
+
249
+ add_foreign_key "groups", "actors", :name => "groups_on_actor_id"
250
+
251
+ add_foreign_key "posts", "activity_objects", :name => "posts_on_activity_object_id"
252
+
253
+ add_foreign_key "profiles", "actors", :name => "profiles_on_actor_id"
254
+
255
+ add_foreign_key "relation_permissions", "permissions", :name => "relation_permissions_on_permission_id"
256
+ add_foreign_key "relation_permissions", "relations", :name => "relation_permissions_on_relation_id"
257
+
258
+ add_foreign_key "relations", "actors", :name => "relations_on_actor_id"
259
+
260
+ add_foreign_key "ties", "contacts", :name => "ties_on_contact_id"
261
+ add_foreign_key "ties", "relations", :name => "ties_on_relation_id"
262
+
263
+ add_foreign_key "users", "actors", :name => "users_on_actor_id"
264
+ end
265
+ end
@@ -0,0 +1,45 @@
1
+ class ObjectChannelsToActions < ActiveRecord::Migration
2
+ def up
3
+ add_column :activity_actions, :author, :boolean, :default => false
4
+ add_column :activity_actions, :user_author, :boolean, :default => false
5
+ add_column :activity_actions, :owner, :boolean, :default => false
6
+
7
+ ActivityAction.reset_column_information
8
+ ActivityAction.record_timestamps = false
9
+ ActivityObject.record_timestamps = false
10
+
11
+ ActivityObject.all.each do |ao|
12
+ channel = Channel.find ao.channel_id
13
+
14
+ %w{ author user_author owner }.each do |role|
15
+ next unless channel.__send__ "#{ role }_id"
16
+
17
+ ao.__send__"#{ role }_id=", channel.__send__("#{ role }_id")
18
+ end
19
+
20
+ ao.received_actions.each do |a|
21
+ a.created_at = a.updated_at = ao.created_at
22
+ end
23
+
24
+ ao.save!
25
+ end
26
+
27
+ remove_foreign_key :activity_objects, :name => "index_activity_objects_on_channel_id"
28
+ remove_column :activity_objects, :channel_id
29
+
30
+ ActivityObject.reset_column_information
31
+
32
+ ActivityAction.record_timestamps = true
33
+ ActivityObject.record_timestamps = true
34
+ end
35
+
36
+ def down
37
+ remove_column :activity_actions, :author
38
+ remove_column :activity_actions, :user_author
39
+ remove_column :activity_actions, :owner
40
+
41
+ add_column :activity_objects, :channel_id, :integer
42
+ add_index :activity_objects, :channel_id
43
+ add_foreign_key :activity_actions, :channel_id, :name => "index_activity_objects_on_channel_id"
44
+ end
45
+ end
@@ -22,11 +22,11 @@ module SocialStream
22
22
  end
23
23
 
24
24
  can :update, klass do |k| # can :update, Post do |post|
25
- [k.channel.author_id, k.channel.owner_id].include?(Actor.normalize_id(subject))
25
+ [k.author_id, k.owner_id].include?(Actor.normalize_id(subject))
26
26
  end
27
27
 
28
28
  can :destroy, klass do |k| # can :destroy, Post do |post|
29
- [k.channel.author_id, k.channel.owner_id].include?(Actor.normalize_id(subject))
29
+ [k.author_id, k.owner_id].include?(Actor.normalize_id(subject))
30
30
  end
31
31
  end
32
32
 
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.18.1".freeze
3
+ VERSION = "0.19.0".freeze
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ module SocialStream
3
3
  # Common methods added to ApplicationController
4
4
  module CancanDeviseIntegration
5
5
  extend ActiveSupport::Concern
6
-
6
+
7
7
  private
8
8
 
9
9
  # Catch some authorization errors:
@@ -17,14 +17,18 @@ module SocialStream
17
17
  if user_signed_in?
18
18
  if params[:s].present? && controller_name != 'home'
19
19
  redirect_to :home
20
- else
21
- raise exception
20
+ return
22
21
  end
23
22
  else
24
- redirect_to new_user_session_path
23
+ if request.get?
24
+ session["user_return_to"] = request.fullpath
25
+ redirect_to new_user_session_path
26
+ return
27
+ end
25
28
  end
29
+
30
+ raise exception
26
31
  end
27
32
  end
28
33
  end
29
34
  end
30
-
@@ -5,15 +5,9 @@ module SocialStream
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- attr_writer :_relation_ids
9
- attr_accessor :_activity_parent_id
10
-
11
8
  subtype_of :activity_object,
12
9
  :build => { :object_type => to_s }
13
10
 
14
- has_one :channel, :through => :activity_object
15
- has_many :activity_object_activities, :through => :activity_object
16
-
17
11
  unless self == Actor
18
12
  validates_presence_of :author_id, :owner_id, :user_author_id
19
13
 
@@ -28,72 +22,6 @@ module SocialStream
28
22
  merge(ActivityObject.authored_by(subject))
29
23
  }
30
24
  end
31
-
32
- # All the activities with this object
33
- def activities
34
- Activity.
35
- includes(:activity_objects => self.class.to_s.underscore).
36
- where("#{ self.class.quoted_table_name }.id" => self.id)
37
- end
38
-
39
- # Build the post activity when this object is not saved
40
- def build_post_activity
41
- Activity.new :channel => channel!,
42
- :relation_ids => Array(_relation_ids)
43
- end
44
-
45
- def _contact
46
- @_contact ||= author && owner && author.contact_to!(owner)
47
- end
48
-
49
- def _contact_id
50
- _contact.try(:id)
51
- end
52
-
53
- def _relation_ids
54
- @_relation_ids ||=
55
- if _contact_id.nil?
56
- nil
57
- else
58
- # FIXME: repeated in Activity#fill_relations
59
- if _contact.reflexive?
60
- _contact.sender.relation_customs.map(&:id)
61
- else
62
- _contact.
63
- receiver.
64
- relation_customs.
65
- allow(_contact.sender, 'create', 'activity').
66
- map(&:id)
67
- end
68
- end
69
- end
70
-
71
- def _activity_parent
72
- @_activity_parent ||= Activity.find(_activity_parent_id)
73
- end
74
-
75
- private
76
-
77
- def create_post_activity
78
- create_activity "post"
79
- end
80
-
81
- def create_update_activity
82
- return if _contact_id.blank?
83
-
84
- create_activity "update"
85
- end
86
-
87
- def create_activity(verb)
88
- a = Activity.new :verb => verb,
89
- :channel => channel,
90
- :relation_ids => _relation_ids,
91
- :parent_id => _activity_parent_id
92
-
93
- a.activity_objects << activity_object
94
-
95
- a.save!
96
- end
97
25
  end
98
26
  end
99
27
  end