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,17 +0,0 @@
1
- class EmptyTiesCount < ActiveRecord::Migration
2
- def up
3
- change_column :contacts, :ties_count, :integer, :default => 0
4
-
5
- ts_status = Contact.record_timestamps
6
- Contact.record_timestamps = false
7
-
8
- Contact.all.each do |c|
9
- c.update_attribute(:ties_count, 0) if c.ties_count.nil?
10
- end
11
-
12
- Contact.record_timestamps = ts_status
13
- end
14
-
15
- def down
16
- end
17
- end
@@ -1,30 +0,0 @@
1
- class RemoveSpheres < ActiveRecord::Migration
2
- def up
3
- remove_foreign_key "relations", :name => "relations_on_sphere_id"
4
-
5
- remove_foreign_key "spheres", :name => "spheres_on_actor_id"
6
-
7
- remove_column :relations, :sphere_id
8
-
9
- drop_table :spheres
10
- end
11
-
12
- def down
13
- add_column :relations, :sphere_id, :integer
14
-
15
- add_index "relations", "sphere_id"
16
-
17
- create_table "spheres", :force => true do |t|
18
- t.string "name"
19
- t.integer "actor_id"
20
- t.datetime "created_at"
21
- t.datetime "updated_at"
22
- end
23
-
24
- add_index "spheres", "actor_id"
25
-
26
- add_foreign_key "relations", "spheres", :name => "relations_on_sphere_id"
27
-
28
- add_foreign_key "spheres", "actors", :name => "spheres_on_actor_id"
29
- end
30
- end
@@ -1,26 +0,0 @@
1
- class RemovePermissionFunction < ActiveRecord::Migration
2
- def up
3
- remove_column :permissions, :function
4
-
5
- ts = RelationPermission.record_timestamps
6
- RelationPermission.record_timestamps = false
7
-
8
- Permission.all.each do |p|
9
- q = Permission.find_by_action_and_object p.action, p.object
10
-
11
- next if p == q
12
-
13
- p.relation_permissions.each do |rp|
14
- rp.update_attribute :permission_id, q.id
15
- end
16
-
17
- p.reload.destroy
18
- end
19
-
20
- RelationPermission.record_timestamps = ts
21
- end
22
-
23
- def down
24
- add_column :permissions, :function, :string
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- class AddRejectRelation < ActiveRecord::Migration
2
- def up
3
- Actor.all.each do |a|
4
- Relation::Reject.default_for(a)
5
- end
6
-
7
- Tie.
8
- includes(:relation, :contact, :sender).
9
- merge(Relation.where(:type => 'Relation::Public')).
10
- each do |t|
11
- if t.contact.ties_count != 1
12
- logger.warn "Public contact #{ t.contact_id } has #{ contact.ties_count }, when expecting 1"
13
- end
14
-
15
- t.update_attribute :relation_id, Relation::Reject.instance.id
16
- end
17
- end
18
-
19
- def down
20
- Tie.
21
- includes(:relation, :contact).
22
- merge(Relation.where(:type => 'Relation::Reject')).
23
- each do |t|
24
- t.update_attribute :relation_id, Relation::Public.instance.id
25
- end
26
-
27
- Relation::Reject.destroy_all
28
- end
29
- end
@@ -1,52 +0,0 @@
1
- class ObjectActors < ActiveRecord::Migration
2
- def up
3
- change_table :activity_objects do |t|
4
- t.integer :author_id
5
- t.integer :owner_id
6
- t.integer :user_author_id
7
- end
8
-
9
- add_index "activity_objects", "author_id"
10
- add_index "activity_objects", "owner_id"
11
- add_index "activity_objects", "user_author_id"
12
-
13
- add_foreign_key "activity_objects", "actors", :name => "index_activity_objects_on_author_id", :column => :author_id
14
- add_foreign_key "activity_objects", "actors", :name => "index_activity_objects_on_owner_id", :column => :owner_id
15
- add_foreign_key "activity_objects", "actors", :name => "index_activity_objects_on_user_author_id", :column => :user_author_id
16
-
17
- ActivityObject.record_timestamps = false
18
-
19
- ActivityObject.all.each do |a|
20
- if a.object_type == "Actor"
21
- next if a.object.is_a? User
22
-
23
- author = user_author = a.object.sent_ties.order(:created_at).first.receiver
24
-
25
- until user_author.subject_type == "User"
26
- user_author = user_author.sent_ties.order(:created_at).first.receiver
27
- end
28
-
29
- a.author = author
30
- a.user_author = user_author
31
- else
32
- next if a.post_activity.blank?
33
-
34
- a.author = a.post_activity.sender
35
- a.owner = a.post_activity.receiver
36
- a.user_author = (a.author.subject.is_a?(User) ? a.author : a.author.sent_ties.order(:created_at).first.receiver)
37
- end
38
-
39
- a.save!
40
- end
41
- end
42
-
43
- def down
44
- remove_foreign_key "activity_objects", :name => "index_activity_objects_on_author_id"
45
- remove_foreign_key "activity_objects", :name => "index_activity_objects_on_owner_id"
46
- remove_foreign_key "activity_objects", :name => "index_activity_objects_on_user_author_id"
47
-
48
- remove_column :activity_objects, :author_id
49
- remove_column :activity_objects, :owner_id
50
- remove_column :activity_objects, :user_author_id
51
- end
52
- end
@@ -1,13 +0,0 @@
1
- class AddLanguageField < ActiveRecord::Migration
2
- def self.up
3
- change_table "users" do |t|
4
- t.string "language", :default => "en"
5
- end
6
- end
7
-
8
- def self.down
9
- change_table :users do |t|
10
- t.remove "language"
11
- end
12
- end
13
- end
@@ -1,88 +0,0 @@
1
- class AddChannels < ActiveRecord::Migration
2
- def up
3
- create_table :channels do |t|
4
- t.integer :author_id
5
- t.integer :owner_id
6
- t.integer :user_author_id
7
-
8
- t.timestamps
9
- end
10
-
11
- add_index "channels", "author_id"
12
- add_index "channels", "owner_id"
13
- add_index "channels", "user_author_id"
14
-
15
- add_foreign_key "channels", "actors", :name => "index_channels_on_author_id", :column => :author_id
16
- add_foreign_key "channels", "actors", :name => "index_channels_on_owner_id", :column => :owner_id
17
- add_foreign_key "channels", "actors", :name => "index_channels_on_user_author_id", :column => :user_author_id
18
-
19
- change_table :activity_objects do |t|
20
- t.integer :channel_id
21
- end
22
-
23
- add_index "activity_objects", "channel_id"
24
-
25
- add_foreign_key "activity_objects", "channels", :name => "index_activity_objects_on_channel_id"
26
-
27
- ActivityObject.record_timestamps = false
28
-
29
- ActivityObject.reset_column_information
30
-
31
- ActivityObject.all.each do |a|
32
- %w( author user_author owner ).each do |m|
33
- a.channel!.__send__ "#{ m }_id=", a.read_attribute("#{ m }_id") # a.channel!.author_id = a.read_attribute("author_id")
34
- end
35
-
36
- a.save!
37
- end
38
-
39
- remove_foreign_key "activity_objects", :name => "index_activity_objects_on_author_id"
40
- remove_foreign_key "activity_objects", :name => "index_activity_objects_on_owner_id"
41
- remove_foreign_key "activity_objects", :name => "index_activity_objects_on_user_author_id"
42
-
43
- remove_column :activity_objects, :author_id
44
- remove_column :activity_objects, :owner_id
45
- remove_column :activity_objects, :user_author_id
46
-
47
- ActivityObject.reset_column_information
48
- end
49
-
50
- def down
51
- change_table :activity_objects do |t|
52
- t.integer :author_id
53
- t.integer :owner_id
54
- t.integer :user_author_id
55
- end
56
-
57
- add_index "activity_objects", "author_id"
58
- add_index "activity_objects", "owner_id"
59
- add_index "activity_objects", "user_author_id"
60
-
61
- add_foreign_key "activity_objects", "actors", :name => "index_activity_objects_on_author_id", :column => :author_id
62
- add_foreign_key "activity_objects", "actors", :name => "index_activity_objects_on_owner_id", :column => :owner_id
63
- add_foreign_key "activity_objects", "actors", :name => "index_activity_objects_on_user_author_id", :column => :user_author_id
64
-
65
- ActivityObject.reset_column_information
66
- ActivityObject.record_timestamps = false
67
-
68
- ActivityObject.all.each do |a|
69
- next if a.channel.blank?
70
-
71
- a.author_id = a.channel.author_id
72
- a.owner_id = a.channel.owner_id
73
- a.user_author_id = a.channel.user_author_id
74
-
75
- a.save!
76
- end
77
-
78
- remove_foreign_key "activity_objects", :name => "index_activity_objects_on_channel_id"
79
-
80
- remove_column :activity_objects, :channel_id
81
-
82
- remove_foreign_key "channels", :name => "index_channels_on_author_id"
83
- remove_foreign_key "channels", :name => "index_channels_on_owner_id"
84
- remove_foreign_key "channels", :name => "index_channels_on_user_author_id"
85
-
86
- drop_table :channels
87
- end
88
- end
@@ -1,15 +0,0 @@
1
- # Before the 'notify' permission was added, only users with the first relation in each group where notified by email
2
- # This migration preserves the old behavior by granting the 'notify' permission to the first relation in each group
3
- class UpdateNotifyPermissions < ActiveRecord::Migration
4
- def up
5
- perm_notify = Permission.find_or_create_by_action('notify')
6
- Group.all.each do |g|
7
- r = g.relation_customs.first
8
- next if r.blank?
9
- r.permissions << perm_notify
10
- end
11
- end
12
-
13
- def down
14
- end
15
- end
@@ -1,9 +0,0 @@
1
- class RemoveLanguageDefault < ActiveRecord::Migration
2
- def up
3
- change_column_default('users', 'language', nil)
4
- end
5
-
6
- def down
7
- change_column_default('users', 'language', 'en')
8
- end
9
- end
@@ -1,74 +0,0 @@
1
- class ActivityChannels < ActiveRecord::Migration
2
- class ActivityMigration < ActiveRecord::Base
3
- self.record_timestamps = false
4
- set_table_name "activities"
5
- end
6
-
7
- def up
8
- change_table :activities do |t|
9
- t.integer :channel_id
10
- end
11
-
12
- add_index "activities", "channel_id"
13
-
14
- add_foreign_key "activities", "channels", :name => "index_activities_on_channel_id"
15
-
16
- ActivityMigration.reset_column_information
17
-
18
- ActivityMigration.all.each do |a|
19
- activity = Activity.find(a.id)
20
-
21
- case activity.verb
22
-
23
- when "post", "update"
24
- a.channel_id = activity.direct_object.channel_id
25
- else
26
- contact = Contact.find activity.contact_id
27
-
28
- author_id = contact.sender_id
29
- owner_id = contact.receiver_id
30
-
31
- user_author_id =
32
- (contact.sender_subject.is_a?(User) ?
33
- contact.sender :
34
- contact.sender.sent_ties.order(:created_at).first.receiver).id
35
-
36
- a.channel_id =
37
- Channel.find_or_create_by_author_id_and_user_author_id_and_owner_id(author_id,
38
- user_author_id,
39
- owner_id).id
40
- end
41
-
42
- a.save!
43
- end
44
-
45
- remove_foreign_key "activities", :name => "index_activities_on_contact_id"
46
-
47
- remove_column :activities, :contact_id
48
-
49
- Activity.reset_column_information
50
- end
51
-
52
- def down
53
- change_table :activities do |t|
54
- t.integer :contact_id
55
- end
56
-
57
- add_index "activities", "contact_id"
58
-
59
- add_foreign_key "activities", "contacts", :name => "index_activities_on_contact_id"
60
-
61
- ActivityMigration.reset_column_information
62
-
63
- ActivityMigration.all.each do |a|
64
- channel = Channel.find a.channel_id
65
- a.contact_id = Contact.find_by_sender_id_and_receiver_id(channel.author_id, channel.owner_id)
66
-
67
- a.save!
68
- end
69
-
70
- remove_foreign_key "activities", :name => "index_activities_on_channel_id"
71
-
72
- remove_column :activities, :channel_id
73
- end
74
- end
@@ -1,9 +0,0 @@
1
- class AddFileProcessingToDocument < ActiveRecord::Migration
2
- def self.up
3
- add_column :documents, :file_processing, :boolean
4
- end
5
-
6
- def self.down
7
- remove_column :documents, :file_processing
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- class AddTitleAndDescriptionToDocument < ActiveRecord::Migration
2
- def self.up
3
- add_column :documents, :title, :string
4
- add_column :documents, :description, :text
5
- end
6
-
7
- def self.down
8
- remove_column :documents, :title
9
- remove_column :documents, :description
10
- end
11
- end
@@ -1,16 +0,0 @@
1
- class DocumentObjectType < ActiveRecord::Migration
2
- class ActivityObjectMigration < ActiveRecord::Base
3
- self.record_timestamps = false
4
- set_table_name "activity_objects"
5
- end
6
-
7
- def up
8
- ActivityObjectMigration.where(:object_type => %w( Picture Audio Video )).each do |a|
9
- a.object_type = "Document"
10
- a.save!
11
- end
12
- end
13
-
14
- def down
15
- end
16
- end
@@ -1,13 +0,0 @@
1
- class CreateEvents < ActiveRecord::Migration
2
- def change
3
- create_table :events do |t|
4
- t.integer :activity_object_id
5
- t.string :title
6
- t.datetime :start_at
7
- t.datetime :end_at
8
- t.boolean :all_day
9
-
10
- t.timestamps
11
- end
12
- end
13
- end
@@ -1,26 +0,0 @@
1
- class CreateRooms < ActiveRecord::Migration
2
- def up
3
- create_table :rooms do |t|
4
- t.references :actor
5
- t.string :name
6
-
7
- t.timestamps
8
- end
9
-
10
- change_table :events do |t|
11
- t.references :room
12
- end
13
-
14
- add_index :rooms, :actor_id
15
- add_index :events, :room_id
16
- add_foreign_key :rooms, :actors, :name => "index_rooms_on_actor_id"
17
- add_foreign_key :events, :rooms, :name => "index_events_on_room_id"
18
- end
19
-
20
- def down
21
- remove_foreign_key :rooms, :name => "index_rooms_on_actor_id"
22
- remove_foreign_key :events, :name => "index_events_on_room_id"
23
-
24
- drop_table :rooms
25
- end
26
- end