social_stream 0.29.0 → 0.30.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/base/app/models/like.rb +8 -3
  2. data/base/config/locales/en.yml +1 -0
  3. data/base/config/locales/es.yml +1 -0
  4. data/base/db/migrate/{20120111141717_create_social_stream.rb → 20120326083509_create_social_stream.rb} +33 -8
  5. data/base/lib/generators/social_stream/base/install_generator.rb +1 -1
  6. data/base/lib/social_stream/base/version.rb +1 -1
  7. data/base/lib/social_stream/controllers/objects.rb +4 -2
  8. data/base/lib/tasks/attachments.rake +22 -0
  9. data/base/social_stream-base.gemspec +4 -4
  10. data/base/spec/controllers/relation_customs_controller_spec.rb +2 -1
  11. data/base/spec/dummy/config/initializers/devise.rb +5 -11
  12. data/documents/app/controllers/documents_controller.rb +1 -0
  13. data/documents/app/models/audio.rb +3 -3
  14. data/documents/app/models/document.rb +1 -3
  15. data/documents/app/models/picture.rb +4 -7
  16. data/documents/app/models/video.rb +2 -9
  17. data/documents/app/views/videos/_video_show.html.erb +1 -1
  18. data/documents/db/migrate/{20120109155431_create_social_stream_documents.rb → 20120208143721_create_social_stream_documents.rb} +0 -2
  19. data/documents/lib/delayed_paperclip/social_stream-documents.rb +7 -12
  20. data/documents/lib/generators/social_stream/documents/install_generator.rb +4 -0
  21. data/documents/lib/generators/social_stream/documents/templates/initializer.rb +26 -0
  22. data/documents/lib/social_stream-documents.rb +29 -0
  23. data/documents/lib/social_stream/documents/dependencies.rb +0 -1
  24. data/documents/lib/social_stream/documents/version.rb +1 -1
  25. data/documents/social_stream-documents.gemspec +4 -4
  26. data/documents/spec/dummy/config/initializers/devise.rb +4 -4
  27. data/events/db/migrate/20120330131859_create_social_stream_events.rb +29 -6
  28. data/events/lib/social_stream/events/version.rb +1 -1
  29. data/events/social_stream-events.gemspec +1 -1
  30. data/lib/social_stream/version.rb +1 -1
  31. data/linkser/app/controllers/links_controller.rb +8 -0
  32. data/linkser/db/migrate/{20111219122952_create_social_stream_linkser.rb → 20120208143739_create_social_stream_linkser.rb} +2 -2
  33. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  34. data/linkser/social_stream-linkser.gemspec +1 -1
  35. data/linkser/spec/dummy/config/initializers/devise.rb +5 -9
  36. data/ostatus/app/decorators/social_stream/base/contact_decorator.rb +3 -0
  37. data/ostatus/lib/social_stream-ostatus.rb +1 -0
  38. data/ostatus/lib/social_stream/ostatus/activity_streams.rb +4 -2
  39. data/ostatus/lib/social_stream/ostatus/models/contact.rb +64 -0
  40. data/ostatus/lib/social_stream/ostatus/models/tie.rb +9 -8
  41. data/ostatus/lib/social_stream/ostatus/version.rb +1 -1
  42. data/ostatus/social_stream-ostatus.gemspec +2 -2
  43. data/presence/db/migrate/20120330132148_create_social_stream_presence.rb +6 -7
  44. data/presence/lib/social_stream/presence/version.rb +1 -1
  45. data/presence/social_stream-presence.gemspec +1 -1
  46. data/social_stream.gemspec +6 -6
  47. data/spec/dummy/config/database.yml +2 -0
  48. data/spec/dummy/config/initializers/devise.rb +4 -8
  49. metadata +22 -33
  50. data/base/db/migrate/20120201185454_singleton_single_relations.rb +0 -46
  51. data/base/db/migrate/20120208135718_group_title_and_description_in_activity_object.rb +0 -54
  52. data/base/db/migrate/20120302215722_activity_object_properties.rb +0 -24
  53. data/base/db/migrate/20120316093946_create_activity_actions.rb +0 -15
  54. data/base/db/migrate/20120316113728_activity_action_follow.rb +0 -23
  55. data/base/db/migrate/20120326083509_object_channels_to_actions.rb +0 -47
  56. data/documents/db/migrate/20120208143721_documents_group_title_and_description_in_activity_object.rb +0 -28
  57. data/documents/lib/paperclip/social_stream-documents.rb +0 -62
  58. data/events/db/migrate/20111218203314_create_events.rb +0 -33
  59. data/events/db/migrate/20120208143756_events_group_title_and_description_in_activity_object.rb +0 -26
  60. data/events/db/migrate/20120208144948_add_events_foreign_key.rb +0 -9
  61. data/linkser/db/migrate/20120202104549_add_links_foreign_key.rb +0 -9
  62. data/linkser/db/migrate/20120208143739_linkser_group_title_and_description_in_activity_object.rb +0 -30
  63. data/presence/db/migrate/20110711111408_add_connected_column_to_user.rb +0 -9
  64. data/presence/db/migrate/20110928135031_add_status_column_to_user.rb +0 -9
  65. data/presence/db/migrate/20111116194112_add_chat_enabled_column_to_user.rb +0 -9
@@ -8,6 +8,35 @@ module SocialStream
8
8
  end
9
9
 
10
10
  module Documents
11
+ # Picture thumbnails
12
+ mattr_accessor :picture_styles
13
+ @@picture_styles = {
14
+ :thumb48sq => ["48x48"],
15
+ :thumbwall => ["130x97#"],
16
+ # midwall preserves A4 proportion: 210x297
17
+ :midwall => ["80x113#"],
18
+ :preview => ["500>"]
19
+ }
20
+
21
+ mattr_accessor :audio_styles
22
+ @@audio_styles = { :webma => {:format => 'webm'} }
23
+
24
+ mattr_accessor :video_styles
25
+ @@video_styles = {
26
+ :webm => { :format => 'webm' },
27
+ :flv => { :format => 'flv' },
28
+ :mp4 => { :format => 'mp4' },
29
+ :poster => { :format => 'png', :time => 5 },
30
+ :thumb48sq => { :geometry => "48x48" , :format => 'png', :time => 5 },
31
+ :thumbwall => { :geometry => "130x97#", :format => 'png', :time => 5 }
32
+ }
33
+
34
+ class << self
35
+ def setup
36
+ yield self
37
+ end
38
+ end
39
+
11
40
  # Add :document to SocialStream.objects and SocialStream.activity_forms by default
12
41
  # It can be configured by users at application's config/initializers/social_stream.rb
13
42
  [ :picture, :video, :audio, :document].each do |o|
@@ -1,6 +1,5 @@
1
1
  require 'social_stream-base'
2
2
  require 'paperclip'
3
- require 'paperclip/social_stream-documents'
4
3
  require 'paperclip-ffmpeg'
5
4
  require 'delayed_paperclip'
6
5
  require 'delayed_paperclip/social_stream-documents'
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "0.17.0".freeze
3
+ VERSION = "0.18.0".freeze
4
4
  end
5
5
  end
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
16
- s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
17
- s.add_runtime_dependency('paperclip','= 2.4.5')
18
- s.add_runtime_dependency('delayed_paperclip','2.4.5.1')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.24.0')
16
+ s.add_runtime_dependency('paperclip','~> 3.3.0')
17
+ s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.9.0')
18
+ s.add_runtime_dependency('delayed_paperclip','>= 2.4.5.2')
19
19
  # Development Gem dependencies
20
20
  s.add_development_dependency('sqlite3-ruby')
21
21
  if RUBY_VERSION < '1.9'
@@ -72,10 +72,6 @@ Devise.setup do |config|
72
72
  # If true, extends the user's remember period when remembered via cookie.
73
73
  # config.extend_remember_period = false
74
74
 
75
- # If true, uses the password salt as remember token. This should be turned
76
- # to false if you are not using database authenticatable.
77
- config.use_salt_as_remember_token = true
78
-
79
75
  # ==> Configuration for :validatable
80
76
  # Range for password length. Default is 6..20.
81
77
  # config.password_length = 6..20
@@ -163,6 +159,10 @@ Devise.setup do |config|
163
159
  config.omniauth :linkedin, "ekxfXU8nueVSMQ9fc5KJAryBkyztUlCBYMW3DoQPzbE79WhivvzhQloRNHCHgPeB", "WYiHFT-KKFgjd45W3-pEAficmXRHmN6_6DGwj1C_ZILJlSO1gBvv6VNYXU9tybGY"
164
160
 
165
161
  config.omniauth :facebook, "129571360447856","eef39dce5e20e76f77495c59623bdb38"
162
+
163
+ #re state_less token removal
164
+ #https://github.com/plataformatec/devise/issues/1499
165
+ config.skip_session_storage << :token_auth
166
166
 
167
167
  # ==> Warden configuration
168
168
  # If you want to use other strategies, that are not supported by Devise, or
@@ -1,10 +1,33 @@
1
- # SocialStream migrations live at least 10 minor versions.
2
- # Then they are merged.
3
- # This is a placeholder migration to merge SocialStreamEvents' migrations
4
1
  class CreateSocialStreamEvents < ActiveRecord::Migration
5
- def up
6
- end
2
+ def change
3
+ create_table "events", :force => true do |t|
4
+ t.integer "activity_object_id"
5
+ t.datetime "start_at"
6
+ t.datetime "end_at"
7
+ t.boolean "all_day"
8
+ t.datetime "created_at", :null => false
9
+ t.datetime "updated_at", :null => false
10
+ t.integer "room_id"
11
+ t.date "start_date"
12
+ t.date "end_date"
13
+ t.integer "frequency", :default => 0
14
+ t.integer "interval"
15
+ t.integer "days", :default => 0
16
+ t.integer "interval_flag", :default => 0
17
+ end
18
+
19
+ add_index "events", ["room_id"], :name => "index_events_on_room_id"
20
+
21
+ create_table "rooms", :force => true do |t|
22
+ t.integer "actor_id"
23
+ t.string "name"
24
+ t.datetime "created_at", :null => false
25
+ t.datetime "updated_at", :null => false
26
+ end
27
+
28
+ add_index "rooms", ["actor_id"], :name => "index_rooms_on_actor_id"
7
29
 
8
- def down
30
+ add_foreign_key "events", "activity_objects", :name => "events_on_activity_object_id"
31
+ add_foreign_key "events", "rooms", :name => "index_events_on_room_id"
9
32
  end
10
33
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Events
3
- VERSION = "0.15.0".freeze
3
+ VERSION = "0.16.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.24.0')
16
16
  s.add_runtime_dependency('rails-scheduler', '~> 0.0.8')
17
17
 
18
18
  # Development Gem dependencies
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.29.0".freeze
2
+ VERSION = "0.30.0".freeze
3
3
  end
@@ -1,3 +1,11 @@
1
1
  class LinksController < ApplicationController
2
2
  include SocialStream::Controllers::Objects
3
+
4
+ def create
5
+ super do |format|
6
+ format.json { render :json => resource }
7
+ format.js { render }
8
+ format.all {redirect_to link_path(resource) || home_path}
9
+ end
10
+ end
3
11
  end
@@ -6,13 +6,13 @@ class CreateSocialStreamLinkser < ActiveRecord::Migration
6
6
  t.datetime "updated_at"
7
7
  t.string "url"
8
8
  t.string "callback_url"
9
- t.string "title"
10
9
  t.string "image"
11
- t.text "description"
12
10
  t.integer "width", :default => 470
13
11
  t.integer "height", :default => 353
14
12
  end
15
13
 
16
14
  add_index "links", ["activity_object_id"], :name => "index_links_on_activity_object_id"
15
+
16
+ add_foreign_key "links", "activity_objects", :name => "links_on_activity_object_id"
17
17
  end
18
18
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Linkser
3
- VERSION = "0.14.0".freeze
3
+ VERSION = "0.15.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.24.0')
16
16
  s.add_runtime_dependency('linkser', '~> 0.0.12')
17
17
  # Development Gem dependencies
18
18
  s.add_development_dependency('sqlite3-ruby')
@@ -72,10 +72,6 @@ Devise.setup do |config|
72
72
  # If true, extends the user's remember period when remembered via cookie.
73
73
  # config.extend_remember_period = false
74
74
 
75
- # If true, uses the password salt as remember token. This should be turned
76
- # to false if you are not using database authenticatable.
77
- config.use_salt_as_remember_token = true
78
-
79
75
  # ==> Configuration for :validatable
80
76
  # Range for password length. Default is 6..20.
81
77
  # config.password_length = 6..20
@@ -122,11 +118,7 @@ Devise.setup do |config|
122
118
  # ==> Configuration for :token_authenticatable
123
119
  # Defines name of the authentication token params key
124
120
  # config.token_authentication_key = :auth_token
125
-
126
- # If true, authentication through token does not store user in session and needs
127
- # to be supplied on each request. Useful if you are using the token as API token.
128
- # config.stateless_token = false
129
-
121
+
130
122
  # ==> Scopes configuration
131
123
  # Turn scoped views on. Before rendering "sessions/new", it will first check for
132
124
  # "users/sessions/new". It's turned off by default because it's slower if you
@@ -163,6 +155,10 @@ Devise.setup do |config|
163
155
  config.omniauth :linkedin, "ekxfXU8nueVSMQ9fc5KJAryBkyztUlCBYMW3DoQPzbE79WhivvzhQloRNHCHgPeB", "WYiHFT-KKFgjd45W3-pEAficmXRHmN6_6DGwj1C_ZILJlSO1gBvv6VNYXU9tybGY"
164
156
 
165
157
  config.omniauth :facebook, "129571360447856","eef39dce5e20e76f77495c59623bdb38"
158
+
159
+ #re state_less token removal
160
+ #https://github.com/plataformatec/devise/issues/1499
161
+ config.skip_session_storage << :token_auth
166
162
 
167
163
  # ==> Warden configuration
168
164
  # If you want to use other strategies, that are not supported by Devise, or
@@ -0,0 +1,3 @@
1
+ Contact.class_eval do
2
+ include SocialStream::Ostatus::Models::Contact
3
+ end
@@ -34,6 +34,7 @@ module SocialStream
34
34
  autoload :Activity, 'social_stream/ostatus/models/activity'
35
35
  autoload :Actor, 'social_stream/ostatus/models/actor'
36
36
  autoload :Audience, 'social_stream/ostatus/models/audience'
37
+ autoload :Contact, 'social_stream/ostatus/models/contact'
37
38
  autoload :Tie, 'social_stream/ostatus/models/tie'
38
39
 
39
40
  module Object
@@ -21,8 +21,10 @@ module SocialStream
21
21
  # FIXME: should not use to_sym
22
22
  # https://github.com/shf/proudhon/issues/7
23
23
  case entry.verb.to_sym
24
- when :follow
25
- Tie.from_entry! entry, receiver
24
+ when :follow, :subscribe, :join
25
+ Tie.create_from_entry! entry, receiver
26
+ when :unsubscribe, :leave, 'http://ostatus.org/schema/1.0/unfollow'
27
+ Tie.destroy_from_entry! entry, receiver
26
28
  else
27
29
  # :post is the default verb
28
30
  r = record_from_entry! entry, receiver
@@ -0,0 +1,64 @@
1
+ module SocialStream
2
+ module Ostatus
3
+ module Models
4
+ module Contact
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ # FIXME: hack, this overwrites base definition, see there
9
+ # for the reasons related to after_destroy callbacks
10
+ alias_method_chain :unset_follow_action, :salmon
11
+ end
12
+
13
+ module ClassMethods
14
+ # Find contact from OStatus entry
15
+ def from_entry! entry, receiver
16
+ # Sender must be remote
17
+ sender = RemoteSubject.find_or_create_by_webfinger_uri! entry.author.uri
18
+
19
+ contact = sender.contact_to!(receiver)
20
+
21
+ # FIXME: hack
22
+ contact.user_author = sender
23
+
24
+ contact
25
+ end
26
+ end
27
+
28
+ # Send Salmon notification
29
+ #
30
+ # FIXME DRY with activity.rb
31
+ def unset_follow_action_with_salmon(relation)
32
+ unset_follow_action_without_salmon(relation)
33
+
34
+ return if sender.subject_type == "RemoteSubject" ||
35
+ receiver.subject_type != "RemoteSubject"
36
+
37
+ title = I18n.t "activity.stream.title.unfollow",
38
+ author: sender_subject.name,
39
+ activity_object: receiver_subject.name
40
+
41
+ entry =
42
+ Proudhon::Entry.new id: "tag:#{ SocialStream::Ostatus.activity_feed_host },2005:contact-destroy-#{ id }",
43
+ title: title,
44
+ content: title,
45
+ verb: 'http://ostatus.org/schema/1.0/unfollow',
46
+ author: Proudhon::Author.new(name: sender.name,
47
+ uri: sender.webfinger_uri)
48
+ salmon = entry.to_salmon
49
+
50
+ if SocialStream::Ostatus.debug_requests
51
+ logger.info entry.to_xml
52
+ end
53
+
54
+ # FIXME: Rails 4 queues
55
+ Thread.new do
56
+ salmon.deliver receiver_subject.salmon_url, sender.rsa_key
57
+
58
+ ActiveRecord::Base.connection.close
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -6,16 +6,17 @@ module SocialStream
6
6
 
7
7
  module ClassMethods
8
8
  # Create a new {Tie} from OStatus entry
9
- def from_entry! entry, receiver
10
- # Sender must be remote
11
- sender = RemoteSubject.find_or_create_by_webfinger_uri! entry.author.uri
9
+ def create_from_entry! entry, receiver
10
+ contact = ::Contact.from_entry! entry, receiver
11
+
12
+ contact.relation_ids = [::Relation::Public.instance.id]
13
+ end
12
14
 
13
- contact = sender.contact_to!(receiver)
15
+ # Remove all {Tie} from OStatus entry
16
+ def destroy_from_entry! entry, receiver
17
+ contact = ::Contact.from_entry! entry, receiver
14
18
 
15
- # FIXME: hack
16
- contact.user_author = sender
17
-
18
- contact.relation_ids = [::Relation::Public.instance.id]
19
+ contact.relation_ids = []
19
20
  end
20
21
  end
21
22
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Ostatus
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
5
5
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
16
- s.add_runtime_dependency('proudhon','>= 0.3.5')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.24.0')
16
+ s.add_runtime_dependency('proudhon','>= 0.3.6')
17
17
  s.add_runtime_dependency('nokogiri','> 1.4.4')
18
18
 
19
19
  # Development Gem dependencies
@@ -1,10 +1,9 @@
1
- # SocialStream migrations live at least 10 minor versions.
2
- # Then they are merged.
3
- # This is a placeholder migration to merge SocialStreamPresence' migrations
4
1
  class CreateSocialStreamPresence < ActiveRecord::Migration
5
- def up
6
- end
7
-
8
- def down
2
+ def change
3
+ change_table :users do |t|
4
+ t.boolean :connected, :default => false
5
+ t.string :status, :default => "available"
6
+ t.boolean :chat_enabled, :default => true
7
+ end
9
8
  end
10
9
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Presence
3
- VERSION = "0.16.0"
3
+ VERSION = "0.17.0"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # Gem dependencies
22
- s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
22
+ s.add_runtime_dependency('social_stream-base', '~> 0.24.0')
23
23
 
24
24
  s.add_runtime_dependency "xmpp4r"
25
25
 
@@ -11,12 +11,12 @@ Gem::Specification.new do |s|
11
11
  s.files = `git ls-files`.split("\n")
12
12
 
13
13
  # Gem dependencies
14
- s.add_runtime_dependency('social_stream-base', '~> 0.23.0')
15
- s.add_runtime_dependency('social_stream-documents', '~> 0.17.0')
16
- s.add_runtime_dependency('social_stream-events', '~> 0.15.0')
17
- s.add_runtime_dependency('social_stream-linkser', '~> 0.14.0')
18
- s.add_runtime_dependency('social_stream-presence', '~> 0.16.0')
19
- s.add_runtime_dependency('social_stream-ostatus', '~> 0.1.0')
14
+ s.add_runtime_dependency('social_stream-base', '~> 0.24.0')
15
+ s.add_runtime_dependency('social_stream-documents', '~> 0.18.0')
16
+ s.add_runtime_dependency('social_stream-events', '~> 0.16.0')
17
+ s.add_runtime_dependency('social_stream-linkser', '~> 0.15.0')
18
+ s.add_runtime_dependency('social_stream-presence', '~> 0.17.0')
19
+ s.add_runtime_dependency('social_stream-ostatus', '~> 0.2.0')
20
20
 
21
21
  # Development Gem dependencies
22
22
  #
@@ -21,6 +21,7 @@ test:
21
21
  test_mysql:
22
22
  adapter: mysql2
23
23
  database: social_stream_test
24
+ pool: 8
24
25
  username:
25
26
  encoding: utf8
26
27
 
@@ -28,6 +29,7 @@ test_postgres:
28
29
  adapter: postgresql
29
30
  database: social_stream_test
30
31
  username: postgres
32
+ pool: 8
31
33
 
32
34
  production:
33
35
  adapter: sqlite3