social_stream 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -2
- data/LICENSE +1 -1
- data/base/Rakefile +3 -17
- data/base/app/assets/images/flags/de.png +0 -0
- data/base/app/assets/images/flags/fr.png +0 -0
- data/base/app/assets/images/flags/hu.png +0 -0
- data/base/app/assets/images/flags/nl.png +0 -0
- data/base/app/assets/javascripts/social_stream/actor.js +34 -0
- data/base/app/assets/javascripts/social_stream/contact.js +40 -5
- data/base/app/assets/javascripts/social_stream/flash.js +6 -1
- data/base/app/assets/javascripts/social_stream/group.js +6 -5
- data/base/app/assets/javascripts/social_stream/relation_customs.js +0 -1
- data/base/app/assets/stylesheets/social_stream/base/adjust/layout/_adjust.css.sass +3 -0
- data/base/app/assets/stylesheets/social_stream/base/buttons/_buttons.scss.sass +0 -2
- data/base/app/assets/stylesheets/social_stream/base/contacts/_contacts.css.sass +1 -11
- data/base/app/assets/stylesheets/social_stream/base/contacts/layouts/_contacts.css.sass +1 -29
- data/base/app/assets/stylesheets/social_stream/base/layouts/_header.css.sass +0 -1
- data/base/app/assets/stylesheets/social_stream/base/mixins/_buttons.css.sass +5 -0
- data/base/app/assets/stylesheets/social_stream/base/mixins/_layout.css.sass +36 -7
- data/base/app/controllers/actors_controller.rb +25 -0
- data/base/app/controllers/contacts_controller.rb +38 -8
- data/base/app/controllers/groups_controller.rb +2 -21
- data/base/app/controllers/profiles_controller.rb +4 -0
- data/base/app/controllers/settings_controller.rb +12 -2
- data/base/app/controllers/users_controller.rb +0 -8
- data/base/app/helpers/contacts_helper.rb +8 -0
- data/base/app/models/activity.rb +19 -6
- data/base/app/models/actor.rb +49 -11
- data/base/app/models/contact.rb +12 -5
- data/base/app/models/group.rb +13 -11
- data/base/app/models/permission.rb +30 -0
- data/base/app/models/relation.rb +17 -7
- data/base/app/models/relation/custom.rb +2 -40
- data/base/app/models/relation/follow.rb +8 -2
- data/base/app/models/relation/owner.rb +10 -0
- data/base/app/models/relation/single.rb +7 -4
- data/base/app/models/site.rb +1 -1
- data/base/app/models/tie.rb +8 -4
- data/base/app/views/contacts/_add_button.html.erb +9 -0
- data/base/app/views/contacts/_button.html.erb +3 -3
- data/base/app/views/contacts/_button_multiple.html.erb +4 -0
- data/base/app/views/contacts/_button_simple.html.erb +17 -0
- data/base/app/views/contacts/_new_modal.html.erb +22 -0
- data/base/app/views/contacts/destroy.js.erb +5 -4
- data/base/app/views/contacts/update.js.erb +5 -4
- data/base/app/views/devise/confirmations/new.html.erb +14 -9
- data/base/app/views/frontpage/_presentation.html.erb +2 -2
- data/base/app/views/groups/_form.html.erb +20 -20
- data/base/app/views/groups/show.html.erb +5 -5
- data/base/app/views/layouts/_header_dropdown_menu.html.erb +3 -5
- data/base/app/views/layouts/_header_signed_in.erb +3 -3
- data/base/app/views/layouts/_logo_in.html.erb +1 -1
- data/base/app/views/layouts/application.html.erb +2 -0
- data/base/app/views/permissions/_list.html.erb +1 -1
- data/base/app/views/profiles/_avatar.html.erb +1 -5
- data/base/app/views/profiles/_avatar_edit.html.erb +5 -0
- data/base/app/views/profiles/_comunication-info.html.erb +2 -36
- data/base/app/views/profiles/_comunication-info_edit.html.erb +27 -0
- data/base/app/views/profiles/_edit_icon.html.erb +0 -1
- data/base/app/views/profiles/_experience.html.erb +1 -6
- data/base/app/views/profiles/_experience_edit.html.erb +5 -0
- data/base/app/views/profiles/_personal.html.erb +1 -39
- data/base/app/views/profiles/_personal_edit.html.erb +31 -0
- data/base/app/views/profiles/_profile_edit.html.erb +7 -0
- data/base/app/views/profiles/_tags.html.erb +1 -4
- data/base/app/views/profiles/_tags_edit.html.erb +4 -0
- data/base/app/views/profiles/edit.html.erb +24 -0
- data/base/app/views/settings/_notifications.html.erb +12 -4
- data/base/app/views/users/show.html.erb +5 -5
- data/base/config/locales/de.yml +654 -0
- data/base/config/locales/en.yml +20 -9
- data/base/config/locales/es.yml +151 -140
- data/base/config/locales/fr.yml +656 -0
- data/base/config/locales/hu.yml +653 -0
- data/base/config/locales/nl.yml +656 -0
- data/base/config/locales/pt.yml +250 -239
- data/base/config/locales/rails.de.yml +203 -0
- data/base/config/locales/rails.fr.yml +222 -0
- data/base/config/locales/rails.hu.yml +199 -0
- data/base/config/locales/rails.nl.yml +199 -0
- data/base/config/locales/zh.yml +214 -202
- data/base/config/routes.rb +22 -30
- data/base/db/migrate/20130708152633_set_group_owners.rb +19 -0
- data/base/db/migrate/20130723133530_actor_notification_settings.rb +10 -0
- data/base/lib/generators/social_stream/base/templates/initializer.rb +13 -7
- data/base/lib/rails/social_stream.rb +2 -0
- data/base/lib/social_stream/base.rb +27 -7
- data/base/lib/social_stream/base/ability.rb +3 -5
- data/base/lib/social_stream/base/autoload.rb +1 -0
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/controllers/authorship.rb +18 -0
- data/base/lib/social_stream/controllers/helpers.rb +18 -4
- data/base/lib/social_stream/controllers/objects.rb +2 -8
- data/base/lib/social_stream/controllers/subjects.rb +9 -2
- data/base/lib/social_stream/models/supertype.rb +2 -0
- data/base/lib/social_stream/population/activity_object.rb +6 -8
- data/base/lib/social_stream/routing/mapper.rb +52 -0
- data/base/social_stream-base.gemspec +4 -7
- data/base/spec/controllers/groups_controller_spec.rb +19 -8
- data/base/spec/controllers/posts_controller_spec.rb +114 -147
- data/base/spec/models/post_authorization_spec.rb +190 -204
- data/base/spec/models/post_spec.rb +17 -63
- data/base/vendor/assets/javascripts/bootstrap-multiselect.js +434 -127
- data/documents/Rakefile +1 -6
- data/documents/config/locales/de.yml +93 -0
- data/documents/config/locales/es.yml +2 -2
- data/documents/config/locales/fr.yml +93 -0
- data/documents/config/locales/hu.yml +93 -0
- data/documents/config/locales/nl.yml +93 -0
- data/documents/config/locales/zh.yml +4 -4
- data/documents/config/routes.rb +7 -9
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +4 -4
- data/events/Rakefile +1 -6
- data/events/config/locales/es.yml +3 -3
- data/events/config/locales/zh.yml +3 -3
- data/events/lib/social_stream/events/models/actor.rb +2 -1
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/generators/social_stream/install_generator.rb +1 -0
- data/lib/social_stream.rb +1 -0
- data/lib/social_stream/version.rb +1 -1
- data/lib/tasks/i18n.rake +22 -2
- data/linkser/Rakefile +1 -6
- data/linkser/config/locales/de.yml +17 -0
- data/linkser/config/locales/es.yml +2 -2
- data/linkser/config/locales/fr.yml +17 -0
- data/linkser/config/locales/hu.yml +17 -0
- data/linkser/config/locales/nl.yml +17 -0
- data/linkser/config/locales/zh.yml +2 -2
- data/linkser/lib/social_stream/linkser/version.rb +1 -1
- data/linkser/social_stream-linkser.gemspec +1 -1
- data/oauth2_server/Rakefile +1 -6
- data/oauth2_server/app/assets/images/step_1.png +0 -0
- data/oauth2_server/app/assets/images/step_2.png +0 -0
- data/oauth2_server/app/assets/images/step_3.png +0 -0
- data/oauth2_server/app/assets/javascripts/social_stream/site_client.js +27 -0
- data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/applications/layout/_applications-oauth2server.css.sass +0 -5
- data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/create/layout/_create-oauth2server.css.sass +3 -5
- data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/show/layout/_show-oauth2server.css.sass +8 -6
- data/oauth2_server/app/controllers/site/clients_controller.rb +17 -41
- data/oauth2_server/app/decorators/social_stream/base/relation_decorator.rb +2 -0
- data/oauth2_server/app/decorators/social_stream/base/user_decorator.rb +1 -20
- data/oauth2_server/app/models/relation/manager.rb +1 -10
- data/oauth2_server/app/models/site/client.rb +4 -2
- data/oauth2_server/app/views/site/clients/_destroy.html.erb +11 -0
- data/oauth2_server/app/views/site/clients/_edit.html.erb +9 -2
- data/oauth2_server/app/views/site/clients/_edit_step_2.html.erb +6 -6
- data/oauth2_server/app/views/site/clients/_edit_step_3.html.erb +8 -6
- data/oauth2_server/app/views/site/clients/_form.html.erb +11 -11
- data/oauth2_server/app/views/site/clients/_list.html.erb +23 -11
- data/oauth2_server/app/views/site/clients/edit.html.erb +1 -1
- data/oauth2_server/app/views/site/clients/index.html.erb +9 -40
- data/oauth2_server/app/views/site/clients/show.html.erb +66 -68
- data/oauth2_server/config/locales/en.yml +19 -0
- data/oauth2_server/config/locales/es.yml +23 -4
- data/oauth2_server/config/locales/zh.yml +32 -13
- data/oauth2_server/config/routes.rb +3 -1
- data/oauth2_server/lib/social_stream/oauth2_server.rb +4 -1
- data/oauth2_server/lib/social_stream/oauth2_server/ability.rb +1 -1
- data/oauth2_server/lib/social_stream/oauth2_server/models/user.rb +18 -0
- data/oauth2_server/lib/social_stream/oauth2_server/version.rb +1 -1
- data/oauth2_server/social_stream-oauth2_server.gemspec +1 -1
- data/oauth2_server/spec/controllers/site_clients_controller_authorization_spec.rb +7 -0
- data/ostatus/Rakefile +1 -6
- data/ostatus/config/locales/zh.yml +8 -8
- data/ostatus/lib/social_stream-ostatus.rb +3 -0
- data/ostatus/lib/social_stream/ostatus/version.rb +1 -1
- data/ostatus/social_stream-ostatus.gemspec +1 -1
- data/places/config/locales/es.yml +51 -51
- data/presence/config/locales/es.yml +48 -48
- data/presence/config/locales/zh.yml +48 -48
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/social_stream.gemspec +8 -7
- metadata +60 -29
- data/base/app/assets/javascripts/social_stream/follow.js +0 -28
- data/base/app/controllers/followers_controller.rb +0 -34
- data/base/app/helpers/followers_helper.rb +0 -5
- data/base/app/views/contacts/_link_follow.html.erb +0 -16
- data/base/app/views/followers/destroy.js.erb +0 -1
- data/base/app/views/followers/index.html.erb +0 -30
- data/base/app/views/followers/update.js.erb +0 -3
- data/base/app/views/frontpage/_characteristics.html.erb +0 -23
- data/base/lib/social_stream/routing/constraints/custom.rb +0 -11
- data/base/lib/social_stream/routing/constraints/follow.rb +0 -11
- data/base/spec/controllers/followers_controller_spec.rb +0 -37
data/base/config/routes.rb
CHANGED
@@ -7,31 +7,31 @@ Rails.application.routes.draw do
|
|
7
7
|
match 'search' => 'search#index', :as => :search
|
8
8
|
|
9
9
|
# Social Stream subjects configured in config/initializers/social_stream.rb
|
10
|
-
|
11
|
-
resources
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
get 'search', :on => :collection
|
23
|
-
end
|
10
|
+
route_subjects do
|
11
|
+
resources :contacts
|
12
|
+
resource :like
|
13
|
+
resource :profile
|
14
|
+
resources :activities
|
15
|
+
|
16
|
+
# Nested Social Stream objects configured in config/initializers/social_stream.rb
|
17
|
+
#
|
18
|
+
# /users/demo/posts
|
19
|
+
(SocialStream.objects - [ :actor ]).each do |object|
|
20
|
+
resources object.to_s.pluralize do
|
21
|
+
get 'search', :on => :collection
|
24
22
|
end
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
25
|
+
# Repository models are configured in config/initializers/social_stream.rb
|
26
|
+
if SocialStream.repository_models.present?
|
27
|
+
resource :repository do
|
28
|
+
get 'search', on: :collection
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
34
32
|
|
33
|
+
resources :actors, only: [ :index ]
|
34
|
+
|
35
35
|
# Get information about current_subject
|
36
36
|
match 'user' => 'users#current', format: :json
|
37
37
|
|
@@ -62,19 +62,11 @@ Rails.application.routes.draw do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
resources :customs
|
68
|
-
end
|
69
|
-
|
70
|
-
resources :permissions
|
65
|
+
namespace "relation" do
|
66
|
+
resources :customs
|
71
67
|
end
|
72
68
|
|
73
|
-
|
74
|
-
match 'followings' => 'followers#index', :as => :followings, :defaults => { :direction => 'sent' }
|
75
|
-
match 'followers' => 'followers#index', :as => :followers, :defaults => { :direction => 'received' }
|
76
|
-
resources :followers
|
77
|
-
end
|
69
|
+
resources :permissions
|
78
70
|
|
79
71
|
resources :activity_actions
|
80
72
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class SetGroupOwners < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
o_id = ::Relation::Owner.instance.id
|
4
|
+
|
5
|
+
Group.all.each do |g|
|
6
|
+
highest_rel = g.relation_customs.sort.last
|
7
|
+
|
8
|
+
highest_rel.contacts.each do |c|
|
9
|
+
unless c.relation_ids.include? o_id
|
10
|
+
c.ties.create! relation_id: o_id
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def down
|
17
|
+
::Relation::Owner.instance.ties.destroy_all
|
18
|
+
end
|
19
|
+
end
|
@@ -5,6 +5,10 @@ SocialStream.setup do |config|
|
|
5
5
|
# Remember you must add an "actor_id" foreign key column to your migration!
|
6
6
|
#
|
7
7
|
# config.subjects = [:user, :group ]
|
8
|
+
|
9
|
+
# List of subjects that can be accessed by the client browser or the API
|
10
|
+
#
|
11
|
+
# config.routed_subjects = [:user, :group ]
|
8
12
|
|
9
13
|
# Include devise modules in User. See devise documentation for details.
|
10
14
|
# Others available are:
|
@@ -13,13 +17,6 @@ SocialStream.setup do |config|
|
|
13
17
|
# :recoverable, :rememberable, :trackable,
|
14
18
|
# :omniauthable, :token_authenticatable
|
15
19
|
|
16
|
-
# Config the relation model of your network
|
17
|
-
#
|
18
|
-
# :custom - users define their own relation types, and post with privacy, like Google+
|
19
|
-
# :follow - user just follow other users, like Twitter
|
20
|
-
#
|
21
|
-
# config.relation_model = :custom
|
22
|
-
|
23
20
|
# Config the default relations that will be created and customized by actors
|
24
21
|
# config.custom_relations = {
|
25
22
|
# user: {
|
@@ -80,4 +77,13 @@ SocialStream.setup do |config|
|
|
80
77
|
|
81
78
|
# Cleditor controls. It is used in new message editor, for example
|
82
79
|
# config.cleditor_controls = "bold italic underline strikethrough subscript superscript | size style | bullets | image link unlink"
|
80
|
+
|
81
|
+
# Default notification email settings for new users
|
82
|
+
# config.default_notification_settings = {
|
83
|
+
# someone_adds_me_as_a_contact: true,
|
84
|
+
# someone_confirms_my_contact_request: true,
|
85
|
+
# someone_likes_my_post: true,
|
86
|
+
# someone_comments_on_my_post: true
|
87
|
+
# }
|
88
|
+
|
83
89
|
end
|
@@ -9,6 +9,8 @@ module SocialStream
|
|
9
9
|
mattr_accessor :subjects
|
10
10
|
@@subjects = [ :user, :group, :site ]
|
11
11
|
|
12
|
+
mattr_writer :routed_subjects
|
13
|
+
|
12
14
|
mattr_accessor :devise_modules
|
13
15
|
@@devise_modules = [ :database_authenticatable, :registerable, :recoverable,
|
14
16
|
:rememberable, :trackable, :omniauthable, :token_authenticatable]
|
@@ -19,9 +21,6 @@ module SocialStream
|
|
19
21
|
mattr_accessor :activity_forms
|
20
22
|
@@activity_forms = []
|
21
23
|
|
22
|
-
mattr_accessor :relation_model
|
23
|
-
@@relation_model = :custom
|
24
|
-
|
25
24
|
mattr_accessor :single_relations
|
26
25
|
@@single_relations = [ :public, :follow, :reject ]
|
27
26
|
|
@@ -71,10 +70,10 @@ module SocialStream
|
|
71
70
|
'site/current' => {}
|
72
71
|
}
|
73
72
|
|
74
|
-
mattr_accessor :
|
75
|
-
@@
|
73
|
+
mattr_accessor :system_relations
|
74
|
+
@@system_relations = {
|
76
75
|
user: [],
|
77
|
-
group: []
|
76
|
+
group: [ :owner ]
|
78
77
|
}
|
79
78
|
|
80
79
|
mattr_accessor :available_permissions
|
@@ -115,12 +114,33 @@ module SocialStream
|
|
115
114
|
|
116
115
|
mattr_accessor :cleditor_controls
|
117
116
|
@@cleditor_controls = "bold italic underline strikethrough subscript superscript | size style | bullets | image link unlink"
|
118
|
-
|
117
|
+
|
118
|
+
mattr_accessor :default_notification_settings
|
119
|
+
@@default_notification_settings = {
|
120
|
+
someone_adds_me_as_a_contact: true,
|
121
|
+
someone_confirms_my_contact_request: true,
|
122
|
+
someone_likes_my_post: true,
|
123
|
+
someone_comments_on_my_post: true
|
124
|
+
}
|
125
|
+
|
119
126
|
class << self
|
120
127
|
def setup
|
121
128
|
yield self
|
122
129
|
end
|
123
130
|
|
131
|
+
# All the subjects that appear in routes and can be accessed
|
132
|
+
# through the browser / API
|
133
|
+
def routed_subjects
|
134
|
+
@@routed_subjects ||= subjects.dup
|
135
|
+
end
|
136
|
+
|
137
|
+
# An array of the keys that must be tried when searching for a
|
138
|
+
# profile subject
|
139
|
+
def profile_subject_keys
|
140
|
+
@profile_subject_keys ||=
|
141
|
+
routed_subjects.map{ |s| s.to_s.split('/').last }
|
142
|
+
end
|
143
|
+
|
124
144
|
def objects
|
125
145
|
@@objects.push(:actor) unless @@objects.include?(:actor)
|
126
146
|
@@objects
|
@@ -81,11 +81,7 @@ module SocialStream
|
|
81
81
|
g.author_id == Actor.normalize_id(subject)
|
82
82
|
end
|
83
83
|
|
84
|
-
can :update, Group do |g|
|
85
|
-
g.represented_by?(subject)
|
86
|
-
end
|
87
|
-
|
88
|
-
can :destroy, Group do |g|
|
84
|
+
can [ :update, :destroy, :represent ], Group do |g|
|
89
85
|
g.represented_by?(subject)
|
90
86
|
end
|
91
87
|
|
@@ -97,6 +93,8 @@ module SocialStream
|
|
97
93
|
end
|
98
94
|
|
99
95
|
# Privacy
|
96
|
+
can :read, Relation::Owner
|
97
|
+
|
100
98
|
can :manage, ::Relation::Custom do |r|
|
101
99
|
subject.present? && (
|
102
100
|
r.actor_id == subject.actor_id ||
|
@@ -14,6 +14,7 @@ module SocialStream
|
|
14
14
|
autoload :TestHelpers, 'social_stream/test_helpers'
|
15
15
|
|
16
16
|
module Controllers
|
17
|
+
autoload :Authorship, 'social_stream/controllers/authorship'
|
17
18
|
autoload :MarkNotificationsRead, 'social_stream/controllers/mark_notifications_read'
|
18
19
|
autoload :I18nIntegration, 'social_stream/controllers/i18n_integration'
|
19
20
|
autoload :CancanDeviseIntegration, 'social_stream/controllers/cancan_devise_integration'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Controllers
|
3
|
+
module Authorship
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
before_filter :set_author_ids, only: [ :new, :create ]
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def set_author_ids
|
13
|
+
resource_params.first[:author_id] = current_subject.try(:actor_id)
|
14
|
+
resource_params.first[:user_author_id] = current_user.try(:actor_id)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -17,7 +17,7 @@ module SocialStream
|
|
17
17
|
# Post #=> in PostsController
|
18
18
|
#
|
19
19
|
def model_class
|
20
|
-
|
20
|
+
self.name.sub(/Controller/, '').singularize.constantize
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -122,13 +122,27 @@ module SocialStream
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def find_profile_subject
|
125
|
-
SocialStream.
|
125
|
+
SocialStream.profile_subject_keys.each do |type|
|
126
126
|
id = params["#{ type }_id"]
|
127
127
|
|
128
128
|
next if id.blank?
|
129
129
|
|
130
|
-
subject_class =
|
131
|
-
|
130
|
+
subject_class =
|
131
|
+
begin
|
132
|
+
type.to_s.classify.constantize
|
133
|
+
rescue NameError => e
|
134
|
+
# Try with namespace
|
135
|
+
ns = params[:controller].split('/')
|
136
|
+
ns.pop
|
137
|
+
|
138
|
+
if ns.blank?
|
139
|
+
raise e
|
140
|
+
end
|
141
|
+
|
142
|
+
ns.push(type)
|
143
|
+
ns.join('/').classify.constantize
|
144
|
+
end
|
145
|
+
|
132
146
|
return subject_class.find_by_slug! id
|
133
147
|
end
|
134
148
|
|
@@ -17,9 +17,9 @@ module SocialStream
|
|
17
17
|
extend ActiveSupport::Concern
|
18
18
|
|
19
19
|
included do
|
20
|
-
|
20
|
+
include SocialStream::Controllers::Authorship
|
21
21
|
|
22
|
-
|
22
|
+
inherit_resources
|
23
23
|
|
24
24
|
before_filter :authenticate_user!, :only => [:new, :edit, :create, :update, :destroy]
|
25
25
|
|
@@ -75,12 +75,6 @@ module SocialStream
|
|
75
75
|
resource.activity_object.increment!(:visit_count) if request.format == 'html'
|
76
76
|
end
|
77
77
|
|
78
|
-
def set_author_ids
|
79
|
-
resource_params.first[:author_id] = current_subject.try(:actor_id)
|
80
|
-
resource_params.first[:user_author_id] = current_user.try(:actor_id)
|
81
|
-
resource_params.first[:owner_id] ||= current_subject.try(:actor_id)
|
82
|
-
end
|
83
|
-
|
84
78
|
def collection_variable_get
|
85
79
|
instance_variable_get "@#{ controller_name }"
|
86
80
|
end
|
@@ -4,15 +4,22 @@ module SocialStream
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
include SocialStream::Controllers::Helpers
|
8
|
-
|
9
7
|
inherit_resources
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
# Overwrite resource method to support slug
|
12
|
+
# See InheritedResources::BaseHelpers#resource
|
13
|
+
def method_for_find
|
14
|
+
:find_by_slug!
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
18
|
# Overwrite {SocialStream::Controllers::Helpers::InstanceMethods#profile_subject}
|
13
19
|
def profile_subject
|
14
20
|
self.class.model_class.find_by_slug(params[:id])
|
15
21
|
end
|
22
|
+
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -13,16 +13,14 @@ module SocialStream
|
|
13
13
|
populate klass, author, owner, relation_ids, &block
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
PowerLaw.new ties.sample(ties.count / 3) do |t|
|
16
|
+
ties = Tie.allowing('create', 'activity').all
|
17
|
+
PowerLaw.new ties.sample(ties.count / 3) do |t|
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
author = t.receiver
|
20
|
+
owner = t.sender
|
21
|
+
relation_ids = Array(t.relation_id)
|
23
22
|
|
24
|
-
|
25
|
-
end
|
23
|
+
populate klass, author, owner, relation_ids, &block
|
26
24
|
end
|
27
25
|
|
28
26
|
end_time = Time.now
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module SocialStream
|
2
|
+
module Routing
|
3
|
+
module Mapper
|
4
|
+
|
5
|
+
# Route subjects configured as SocialStream.routed_subjects in
|
6
|
+
# config/initializers/social_stream.rb
|
7
|
+
#
|
8
|
+
# It supports namespaces, so setting
|
9
|
+
#
|
10
|
+
# SocialStream.routed_subjects = [ ':site/clients' ]
|
11
|
+
#
|
12
|
+
# and using
|
13
|
+
#
|
14
|
+
# route_subjects do
|
15
|
+
# resources :posts
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# is equivalent to
|
19
|
+
#
|
20
|
+
# namespace :site
|
21
|
+
# resources :clients
|
22
|
+
# resources :posts
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
def route_subjects
|
27
|
+
SocialStream.routed_subjects.each do |name|
|
28
|
+
ns = name.to_s.split('/')
|
29
|
+
actor = ns.pop
|
30
|
+
|
31
|
+
rts = -> {
|
32
|
+
resources actor.pluralize do
|
33
|
+
yield
|
34
|
+
end
|
35
|
+
}
|
36
|
+
|
37
|
+
if ns.present?
|
38
|
+
ns.reverse.inject(rts) { |lmda, n|
|
39
|
+
proc do
|
40
|
+
namespace n, &lmda
|
41
|
+
end
|
42
|
+
}.call
|
43
|
+
else
|
44
|
+
rts.call
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
ActionDispatch::Routing::Mapper.send :include, SocialStream::Routing::Mapper
|