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
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.add_runtime_dependency('omniauth-facebook','~> 1.4.1')
|
48
48
|
s.add_runtime_dependency('omniauth-linkedin','~> 0.0.6')
|
49
49
|
# Messages
|
50
|
-
s.add_runtime_dependency('mailboxer','~> 0.10.
|
50
|
+
s.add_runtime_dependency('mailboxer','~> 0.10.3')
|
51
51
|
# Tagging
|
52
52
|
s.add_runtime_dependency('acts-as-taggable-on','~> 2.2.2')
|
53
53
|
# Background jobs
|
@@ -77,12 +77,6 @@ Gem::Specification.new do |s|
|
|
77
77
|
s.add_development_dependency('capybara', '~> 0.3.9')
|
78
78
|
# Testing database
|
79
79
|
s.add_development_dependency('sqlite3-ruby')
|
80
|
-
# Debugging
|
81
|
-
if RUBY_VERSION < '1.9'
|
82
|
-
s.add_development_dependency('ruby-debug')
|
83
|
-
else
|
84
|
-
s.add_development_dependency('debugger')
|
85
|
-
end
|
86
80
|
# Specs
|
87
81
|
s.add_development_dependency('rspec-rails', '~> 2.6.1')
|
88
82
|
# Fixtures
|
@@ -93,4 +87,7 @@ Gem::Specification.new do |s|
|
|
93
87
|
s.add_development_dependency('ci_reporter', '~> 1.6.4')
|
94
88
|
# Scaffold generator
|
95
89
|
s.add_development_dependency('nifty-generators','~> 0.4.5')
|
90
|
+
# pry
|
91
|
+
s.add_development_dependency('pry-rails','~> 0.4.5')
|
92
|
+
|
96
93
|
end
|
@@ -78,17 +78,17 @@ describe GroupsController do
|
|
78
78
|
@user.senders.should include(group.actor)
|
79
79
|
end
|
80
80
|
|
81
|
-
context "with
|
81
|
+
context "with owners" do
|
82
82
|
before do
|
83
|
-
@
|
84
|
-
@
|
83
|
+
@user_owner = Factory(:user)
|
84
|
+
@group_owner = Factory(:group)
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should allow creating" do
|
88
88
|
count = Group.count
|
89
89
|
post :create,
|
90
90
|
:group => { :name => "Test group",
|
91
|
-
:
|
91
|
+
:owners => [ @user_owner.actor_id, @group_owner.actor_id ].join(',') }
|
92
92
|
|
93
93
|
group = assigns(:group)
|
94
94
|
|
@@ -96,10 +96,10 @@ describe GroupsController do
|
|
96
96
|
Group.count.should eq(count + 1)
|
97
97
|
assigns(:current_subject).should eq(group)
|
98
98
|
|
99
|
-
|
99
|
+
owners = group.contact_subjects(:direction => :sent)
|
100
100
|
|
101
|
-
|
102
|
-
|
101
|
+
owners.should include(@user_owner)
|
102
|
+
owners.should include(@group_owner)
|
103
103
|
|
104
104
|
group.contact_subjects(:direction => :received)
|
105
105
|
response.should redirect_to(:home)
|
@@ -115,7 +115,18 @@ describe GroupsController do
|
|
115
115
|
model_attributes[:user_author_id] = user.actor_id
|
116
116
|
end
|
117
117
|
|
118
|
-
|
118
|
+
it "should create but own" do
|
119
|
+
count = model_count
|
120
|
+
post :create, attributes
|
121
|
+
|
122
|
+
resource = assigns(demodulized_model_sym)
|
123
|
+
|
124
|
+
model_count.should eq(count + 1)
|
125
|
+
resource.should be_valid
|
126
|
+
resource.author.should eq(@user.actor)
|
127
|
+
resource.user_author.should eq(@user.actor)
|
128
|
+
response.should redirect_to(:home)
|
129
|
+
end
|
119
130
|
end
|
120
131
|
|
121
132
|
context "a external group" do
|
@@ -7,144 +7,133 @@ describe PostsController do
|
|
7
7
|
render_views
|
8
8
|
|
9
9
|
describe "authorizing" do
|
10
|
-
before
|
11
|
-
@
|
10
|
+
before do
|
11
|
+
@user = Factory(:user)
|
12
|
+
sign_in @user
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "in follow relation model" do
|
19
|
-
before :all do
|
20
|
-
SocialStream.relation_model = :follow
|
21
|
-
end
|
22
|
-
|
23
|
-
before do
|
24
|
-
@user = Factory(:user)
|
25
|
-
sign_in @user
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "post from other user" do
|
15
|
+
describe "posts to user" do
|
16
|
+
describe "with first relation" do
|
29
17
|
before do
|
30
|
-
|
18
|
+
contact = @user.contact_to!(@user)
|
19
|
+
relation = @user.relation_customs.sort.first
|
20
|
+
model_assigned_to @user.contact_to!(@user), relation
|
21
|
+
@current_model = Factory(:post, :author_id => @user.actor_id,
|
22
|
+
:owner_id => @user.actor_id,
|
23
|
+
:user_author_id => @user.actor_id,
|
24
|
+
:relation_ids => Array(relation.id))
|
31
25
|
end
|
32
26
|
|
27
|
+
it_should_behave_like "Allow Creating"
|
33
28
|
it_should_behave_like "Allow Reading"
|
34
|
-
|
35
|
-
end
|
29
|
+
it_should_behave_like "Allow Destroying"
|
36
30
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
31
|
+
it "should destroy with js" do
|
32
|
+
count = model_count
|
33
|
+
delete :destroy, :id => @current_model.to_param, :format => :js
|
41
34
|
|
42
|
-
|
43
|
-
@user = Factory(:user)
|
44
|
-
sign_in @user
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "posts to user" do
|
48
|
-
describe "with first relation" do
|
49
|
-
before do
|
50
|
-
contact = @user.contact_to!(@user)
|
51
|
-
relation = @user.relation_customs.sort.first
|
52
|
-
model_assigned_to @user.contact_to!(@user), relation
|
53
|
-
@current_model = Factory(:post, :author_id => @user.actor_id,
|
54
|
-
:owner_id => @user.actor_id,
|
55
|
-
:user_author_id => @user.actor_id,
|
56
|
-
:relation_ids => Array(relation.id))
|
57
|
-
end
|
58
|
-
|
59
|
-
it_should_behave_like "Allow Creating"
|
60
|
-
it_should_behave_like "Allow Reading"
|
61
|
-
it_should_behave_like "Allow Destroying"
|
35
|
+
resource = assigns(model_sym)
|
62
36
|
|
63
|
-
|
64
|
-
count = model_count
|
65
|
-
delete :destroy, :id => @current_model.to_param, :format => :js
|
66
|
-
|
67
|
-
resource = assigns(model_sym)
|
68
|
-
|
69
|
-
model_count.should eq(count - 1)
|
70
|
-
end
|
37
|
+
model_count.should eq(count - 1)
|
71
38
|
end
|
39
|
+
end
|
72
40
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
it_should_behave_like "Allow Creating"
|
85
|
-
it_should_behave_like "Allow Reading"
|
86
|
-
it_should_behave_like "Allow Destroying"
|
41
|
+
describe "with last relation" do
|
42
|
+
before do
|
43
|
+
contact = @user.contact_to!(@user)
|
44
|
+
relation = @user.relation_customs.sort.last
|
45
|
+
model_assigned_to @user.contact_to!(@user), relation
|
46
|
+
@current_model = Factory(:post, :author_id => @user.actor_id,
|
47
|
+
:owner_id => @user.actor_id,
|
48
|
+
:user_author_id => @user.actor_id,
|
49
|
+
:relation_ids => Array(relation.id))
|
87
50
|
end
|
88
51
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
relation = Relation::Public.instance
|
93
|
-
model_assigned_to @user.contact_to!(@user), relation
|
94
|
-
@current_model = Factory(:post, :author_id => @user.actor_id,
|
95
|
-
:owner_id => @user.actor_id,
|
96
|
-
:user_author_id => @user.actor_id)
|
97
|
-
end
|
98
|
-
|
99
|
-
it_should_behave_like "Allow Creating"
|
100
|
-
it_should_behave_like "Allow Reading"
|
101
|
-
it_should_behave_like "Allow Destroying"
|
102
|
-
end
|
52
|
+
it_should_behave_like "Allow Creating"
|
53
|
+
it_should_behave_like "Allow Reading"
|
54
|
+
it_should_behave_like "Allow Destroying"
|
103
55
|
end
|
104
56
|
|
105
|
-
describe "
|
57
|
+
describe "with public relation" do
|
106
58
|
before do
|
107
|
-
|
108
|
-
|
109
|
-
model_assigned_to @user.contact_to!(
|
59
|
+
contact = @user.contact_to!(@user)
|
60
|
+
relation = Relation::Public.instance
|
61
|
+
model_assigned_to @user.contact_to!(@user), relation
|
110
62
|
@current_model = Factory(:post, :author_id => @user.actor_id,
|
111
|
-
:owner_id =>
|
63
|
+
:owner_id => @user.actor_id,
|
112
64
|
:user_author_id => @user.actor_id)
|
113
65
|
end
|
114
66
|
|
115
67
|
it_should_behave_like "Allow Creating"
|
116
68
|
it_should_behave_like "Allow Reading"
|
69
|
+
it_should_behave_like "Allow Destroying"
|
117
70
|
end
|
71
|
+
end
|
118
72
|
|
119
|
-
|
120
|
-
|
121
|
-
|
73
|
+
describe "post to friend" do
|
74
|
+
before do
|
75
|
+
friend = Factory(:friend, :contact => Factory(:contact, :receiver => @user.actor)).sender
|
122
76
|
|
123
|
-
|
124
|
-
|
77
|
+
model_assigned_to @user.contact_to!(friend), friend.relation_custom('friend')
|
78
|
+
@current_model = Factory(:post, :author_id => @user.actor_id,
|
79
|
+
:owner_id => friend.id,
|
80
|
+
:user_author_id => @user.actor_id)
|
81
|
+
end
|
125
82
|
|
126
|
-
|
83
|
+
it_should_behave_like "Allow Creating"
|
84
|
+
it_should_behave_like "Allow Reading"
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "post to acquaintance" do
|
88
|
+
before do
|
89
|
+
ac = Factory(:acquaintance, :contact => Factory(:contact, :receiver => @user.actor)).sender
|
90
|
+
|
91
|
+
model_assigned_to @user.contact_to!(ac), ac.relation_custom('acquaintance')
|
127
92
|
end
|
128
93
|
|
129
|
-
|
94
|
+
it_should_behave_like "Deny Creating"
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "post from other user" do
|
98
|
+
before do
|
99
|
+
@current_model = Factory(:post)
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
it_should_behave_like "Deny Reading"
|
104
|
+
end
|
105
|
+
|
106
|
+
describe "posts represented group" do
|
107
|
+
before do
|
108
|
+
@group = Factory(:member, :contact => Factory(:group_contact, :receiver => @user.actor)).sender_subject
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "with member relation" do
|
130
112
|
before do
|
131
|
-
|
113
|
+
contact = @user.contact_to!(@group)
|
114
|
+
relation = @group.relation_custom('member')
|
115
|
+
|
116
|
+
model_assigned_to contact, relation
|
117
|
+
@current_model = Factory(:post, :author_id => contact.sender.id,
|
118
|
+
:owner_id => contact.receiver.id,
|
119
|
+
:user_author_id => contact.sender.id,
|
120
|
+
:relation_ids => Array(relation.id))
|
132
121
|
end
|
133
122
|
|
134
|
-
|
135
|
-
it_should_behave_like "
|
123
|
+
it_should_behave_like "Allow Creating"
|
124
|
+
it_should_behave_like "Allow Reading"
|
125
|
+
it_should_behave_like "Allow Destroying"
|
136
126
|
end
|
137
127
|
|
138
|
-
|
128
|
+
context "representing the group" do
|
139
129
|
before do
|
140
|
-
@group
|
130
|
+
represent(@group)
|
141
131
|
end
|
142
132
|
|
143
|
-
describe "with
|
133
|
+
describe "with first relation" do
|
144
134
|
before do
|
145
|
-
contact = @
|
146
|
-
relation = @group.
|
147
|
-
|
135
|
+
contact = @group.contact_to!(@group)
|
136
|
+
relation = @group.relation_customs.sort.first
|
148
137
|
model_assigned_to contact, relation
|
149
138
|
@current_model = Factory(:post, :author_id => contact.sender.id,
|
150
139
|
:owner_id => contact.receiver.id,
|
@@ -157,58 +146,36 @@ describe PostsController do
|
|
157
146
|
it_should_behave_like "Allow Destroying"
|
158
147
|
end
|
159
148
|
|
160
|
-
|
149
|
+
describe "with last relation" do
|
161
150
|
before do
|
162
|
-
|
151
|
+
contact = @group.contact_to!(@group)
|
152
|
+
relation = @group.relation_customs.sort.last
|
153
|
+
model_assigned_to contact, relation
|
154
|
+
@current_model = Factory(:post, :author_id => contact.sender.id,
|
155
|
+
:owner_id => contact.receiver.id,
|
156
|
+
:user_author_id => contact.sender.id,
|
157
|
+
:relation_ids => Array(relation.id))
|
163
158
|
end
|
164
159
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
model_assigned_to contact, relation
|
170
|
-
@current_model = Factory(:post, :author_id => contact.sender.id,
|
171
|
-
:owner_id => contact.receiver.id,
|
172
|
-
:user_author_id => contact.sender.id,
|
173
|
-
:relation_ids => Array(relation.id))
|
174
|
-
end
|
175
|
-
|
176
|
-
it_should_behave_like "Allow Creating"
|
177
|
-
it_should_behave_like "Allow Reading"
|
178
|
-
it_should_behave_like "Allow Destroying"
|
179
|
-
end
|
160
|
+
it_should_behave_like "Allow Creating"
|
161
|
+
it_should_behave_like "Allow Reading"
|
162
|
+
it_should_behave_like "Allow Destroying"
|
163
|
+
end
|
180
164
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
end
|
191
|
-
|
192
|
-
it_should_behave_like "Allow Creating"
|
193
|
-
it_should_behave_like "Allow Reading"
|
194
|
-
it_should_behave_like "Allow Destroying"
|
165
|
+
describe "with public relation" do
|
166
|
+
before do
|
167
|
+
contact = @group.contact_to!(@group)
|
168
|
+
relation = Relation::Public.instance
|
169
|
+
model_assigned_to contact, relation
|
170
|
+
@current_model = Factory(:post, :author_id => contact.sender.id,
|
171
|
+
:owner_id => contact.receiver.id,
|
172
|
+
:user_author_id => contact.sender.id,
|
173
|
+
:relation_ids => Array(relation.id))
|
195
174
|
end
|
196
175
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
relation = Relation::Public.instance
|
201
|
-
model_assigned_to contact, relation
|
202
|
-
@current_model = Factory(:post, :author_id => contact.sender.id,
|
203
|
-
:owner_id => contact.receiver.id,
|
204
|
-
:user_author_id => contact.sender.id,
|
205
|
-
:relation_ids => Array(relation.id))
|
206
|
-
end
|
207
|
-
|
208
|
-
it_should_behave_like "Allow Creating"
|
209
|
-
it_should_behave_like "Allow Reading"
|
210
|
-
it_should_behave_like "Allow Destroying"
|
211
|
-
end
|
176
|
+
it_should_behave_like "Allow Creating"
|
177
|
+
it_should_behave_like "Allow Reading"
|
178
|
+
it_should_behave_like "Allow Destroying"
|
212
179
|
end
|
213
180
|
end
|
214
181
|
end
|
@@ -73,166 +73,243 @@ describe Post do
|
|
73
73
|
include PostAuthorizationTestHelper
|
74
74
|
|
75
75
|
before :all do
|
76
|
-
@
|
76
|
+
@subject = @user = Factory(:user)
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
|
-
SocialStream.relation_model = @ss_relation_model
|
81
|
-
end
|
82
|
-
|
83
|
-
context "in custom relation model" do
|
84
|
-
before :all do
|
85
|
-
SocialStream.relation_model = :custom
|
86
|
-
end
|
87
|
-
|
79
|
+
context "with friend tie" do
|
88
80
|
before :all do
|
89
|
-
@
|
81
|
+
@tie = create_related_tie(:friend)
|
90
82
|
end
|
91
83
|
|
92
|
-
|
84
|
+
describe "posting for all contacts" do
|
93
85
|
before :all do
|
94
|
-
@
|
86
|
+
@post = Factory(:post,
|
87
|
+
:author => @tie.receiver,
|
88
|
+
:owner => @tie.sender)
|
95
89
|
end
|
96
90
|
|
97
|
-
describe "
|
98
|
-
before
|
99
|
-
@post
|
100
|
-
:author => @tie.receiver,
|
101
|
-
:owner => @tie.sender)
|
91
|
+
describe "accesed by author" do
|
92
|
+
before do
|
93
|
+
create_ability_accessed_by(@post.author_subject)
|
102
94
|
end
|
103
95
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
96
|
+
it_should_behave_like "Allows Creating"
|
97
|
+
it_should_behave_like "Allows Reading"
|
98
|
+
it_should_behave_like "Allows Updating"
|
99
|
+
it_should_behave_like "Allows Destroying"
|
100
|
+
end
|
108
101
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
it_should_behave_like "Allows Destroying"
|
102
|
+
describe "accesed by owner" do
|
103
|
+
before do
|
104
|
+
create_ability_accessed_by(@post.owner_subject)
|
113
105
|
end
|
114
106
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
107
|
+
it_should_behave_like "Denies Creating"
|
108
|
+
it_should_behave_like "Allows Reading"
|
109
|
+
it_should_behave_like "Allows Updating"
|
110
|
+
it_should_behave_like "Allows Destroying"
|
111
|
+
end
|
119
112
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
it_should_behave_like "Allows Destroying"
|
113
|
+
describe "accessed by different friend" do
|
114
|
+
before do
|
115
|
+
create_ability_accessed_by_related :friend
|
124
116
|
end
|
125
117
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
118
|
+
it_should_behave_like "Denies Creating"
|
119
|
+
it_should_behave_like "Allows Reading"
|
120
|
+
it_should_behave_like "Denies Updating"
|
121
|
+
it_should_behave_like "Denies Destroying"
|
122
|
+
end
|
130
123
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
it_should_behave_like "Denies Destroying"
|
124
|
+
describe "accessed by acquaintance" do
|
125
|
+
before do
|
126
|
+
create_ability_accessed_by_related :acquaintance
|
135
127
|
end
|
128
|
+
it_should_behave_like "Denies Creating"
|
129
|
+
it_should_behave_like "Allows Reading"
|
130
|
+
it_should_behave_like "Denies Updating"
|
131
|
+
it_should_behave_like "Denies Destroying"
|
132
|
+
end
|
136
133
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
end
|
141
|
-
it_should_behave_like "Denies Creating"
|
142
|
-
it_should_behave_like "Allows Reading"
|
143
|
-
it_should_behave_like "Denies Updating"
|
144
|
-
it_should_behave_like "Denies Destroying"
|
134
|
+
describe "accessed publicly" do
|
135
|
+
before do
|
136
|
+
create_ability_accessed_publicly
|
145
137
|
end
|
146
138
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
139
|
+
it_should_behave_like "Denies Creating"
|
140
|
+
it_should_behave_like "Denies Reading"
|
141
|
+
it_should_behave_like "Denies Updating"
|
142
|
+
it_should_behave_like "Denies Destroying"
|
143
|
+
end
|
144
|
+
end
|
151
145
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
146
|
+
describe "posting only to friends" do
|
147
|
+
before :all do
|
148
|
+
@post = Factory(:post,
|
149
|
+
:author => @tie.receiver,
|
150
|
+
:owner => @tie.sender,
|
151
|
+
:relation_ids => [@tie.relation_id])
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
describe "accessed by author" do
|
156
|
+
before do
|
157
|
+
create_ability_accessed_by(@post.author_subject)
|
156
158
|
end
|
159
|
+
|
160
|
+
it_should_behave_like "Allows Creating"
|
161
|
+
it_should_behave_like "Allows Reading"
|
162
|
+
it_should_behave_like "Allows Updating"
|
163
|
+
it_should_behave_like "Allows Destroying"
|
157
164
|
end
|
158
165
|
|
159
|
-
describe "
|
160
|
-
before
|
161
|
-
@post
|
162
|
-
|
163
|
-
|
164
|
-
|
166
|
+
describe "accesed by owner" do
|
167
|
+
before do
|
168
|
+
create_ability_accessed_by(@post.owner_subject)
|
169
|
+
end
|
170
|
+
|
171
|
+
it_should_behave_like "Denies Creating"
|
172
|
+
it_should_behave_like "Allows Reading"
|
173
|
+
it_should_behave_like "Allows Updating"
|
174
|
+
it_should_behave_like "Allows Destroying"
|
175
|
+
end
|
165
176
|
|
177
|
+
describe "accessed by a friend" do
|
178
|
+
before do
|
179
|
+
create_ability_accessed_by_related :friend
|
166
180
|
end
|
167
181
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
182
|
+
it_should_behave_like "Denies Creating"
|
183
|
+
it_should_behave_like "Allows Reading"
|
184
|
+
it_should_behave_like "Denies Updating"
|
185
|
+
it_should_behave_like "Denies Destroying"
|
186
|
+
end
|
172
187
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
it_should_behave_like "Allows Destroying"
|
188
|
+
describe "accessed by acquaintance" do
|
189
|
+
before do
|
190
|
+
create_ability_accessed_by_related :acquaintance
|
177
191
|
end
|
178
192
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
193
|
+
it_should_behave_like "Denies Creating"
|
194
|
+
it_should_behave_like "Denies Reading"
|
195
|
+
it_should_behave_like "Denies Updating"
|
196
|
+
it_should_behave_like "Denies Destroying"
|
197
|
+
end
|
183
198
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
it_should_behave_like "Allows Destroying"
|
199
|
+
describe "accessed publicly" do
|
200
|
+
before do
|
201
|
+
create_ability_accessed_publicly
|
188
202
|
end
|
189
203
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
204
|
+
it_should_behave_like "Denies Creating"
|
205
|
+
it_should_behave_like "Denies Reading"
|
206
|
+
it_should_behave_like "Denies Updating"
|
207
|
+
it_should_behave_like "Denies Destroying"
|
208
|
+
end
|
209
|
+
end
|
194
210
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
211
|
+
describe "posting to public relation" do
|
212
|
+
|
213
|
+
before do
|
214
|
+
@post = Factory(:post,
|
215
|
+
:author => @tie.receiver,
|
216
|
+
:owner => @tie.sender,
|
217
|
+
:relation_ids => [Relation::Public.instance.id])
|
218
|
+
end
|
219
|
+
|
220
|
+
describe "accessed by author" do
|
221
|
+
before do
|
222
|
+
create_ability_accessed_by(@post.author_subject)
|
199
223
|
end
|
200
224
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
225
|
+
it_should_behave_like "Allows Creating"
|
226
|
+
it_should_behave_like "Allows Reading"
|
227
|
+
it_should_behave_like "Allows Updating"
|
228
|
+
it_should_behave_like "Allows Destroying"
|
229
|
+
end
|
205
230
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
it_should_behave_like "Denies Destroying"
|
231
|
+
describe "accessed by owner" do
|
232
|
+
before do
|
233
|
+
create_ability_accessed_by(@post.owner_subject)
|
210
234
|
end
|
211
235
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
236
|
+
it_should_behave_like "Denies Creating"
|
237
|
+
it_should_behave_like "Allows Reading"
|
238
|
+
it_should_behave_like "Allows Updating"
|
239
|
+
it_should_behave_like "Allows Destroying"
|
240
|
+
end
|
216
241
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
242
|
+
describe "accessed by a friend" do
|
243
|
+
before do
|
244
|
+
create_ability_accessed_by_related :friend
|
245
|
+
end
|
246
|
+
|
247
|
+
it_should_behave_like "Denies Creating"
|
248
|
+
it_should_behave_like "Allows Reading"
|
249
|
+
it_should_behave_like "Denies Updating"
|
250
|
+
it_should_behave_like "Denies Destroying"
|
251
|
+
end
|
252
|
+
|
253
|
+
describe "accessed by acquaintance" do
|
254
|
+
before do
|
255
|
+
create_ability_accessed_by_related :acquaintance
|
256
|
+
end
|
257
|
+
|
258
|
+
it_should_behave_like "Denies Creating"
|
259
|
+
it_should_behave_like "Allows Reading"
|
260
|
+
it_should_behave_like "Denies Updating"
|
261
|
+
it_should_behave_like "Denies Destroying"
|
262
|
+
end
|
263
|
+
|
264
|
+
describe "accessed publicly" do
|
265
|
+
before do
|
266
|
+
create_ability_accessed_publicly
|
221
267
|
end
|
268
|
+
|
269
|
+
it_should_behave_like "Denies Creating"
|
270
|
+
it_should_behave_like "Allows Reading"
|
271
|
+
it_should_behave_like "Denies Updating"
|
272
|
+
it_should_behave_like "Denies Destroying"
|
222
273
|
end
|
274
|
+
end
|
223
275
|
|
224
|
-
|
276
|
+
describe "posting by not replied" do
|
277
|
+
before :all do
|
278
|
+
@post = Factory(:post,
|
279
|
+
:author => @tie.sender,
|
280
|
+
:owner => @tie.receiver)
|
281
|
+
end
|
225
282
|
|
283
|
+
describe "accessed by author" do
|
226
284
|
before do
|
285
|
+
create_ability_accessed_by(@post.author_subject)
|
286
|
+
end
|
287
|
+
|
288
|
+
it_should_behave_like "Denies Creating"
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
context "group" do
|
294
|
+
before(:all) do
|
295
|
+
@subject = @group = Factory(:group)
|
296
|
+
end
|
297
|
+
|
298
|
+
describe "with member tie" do
|
299
|
+
before :all do
|
300
|
+
@tie = create_related_tie(:member)
|
301
|
+
end
|
302
|
+
|
303
|
+
describe "posting from member all contacts" do
|
304
|
+
before :all do
|
227
305
|
@post = Factory(:post,
|
228
306
|
:author => @tie.receiver,
|
229
|
-
:owner => @tie.sender
|
230
|
-
:relation_ids => [Relation::Public.instance.id])
|
307
|
+
:owner => @tie.sender)
|
231
308
|
end
|
232
309
|
|
233
310
|
describe "accessed by author" do
|
234
311
|
before do
|
235
|
-
create_ability_accessed_by
|
312
|
+
create_ability_accessed_by @post.author_subject
|
236
313
|
end
|
237
314
|
|
238
315
|
it_should_behave_like "Allows Creating"
|
@@ -241,20 +318,9 @@ describe Post do
|
|
241
318
|
it_should_behave_like "Allows Destroying"
|
242
319
|
end
|
243
320
|
|
244
|
-
describe "accessed by
|
245
|
-
before do
|
246
|
-
create_ability_accessed_by(@post.owner_subject)
|
247
|
-
end
|
248
|
-
|
249
|
-
it_should_behave_like "Denies Creating"
|
250
|
-
it_should_behave_like "Allows Reading"
|
251
|
-
it_should_behave_like "Allows Updating"
|
252
|
-
it_should_behave_like "Allows Destroying"
|
253
|
-
end
|
254
|
-
|
255
|
-
describe "accessed by a friend" do
|
321
|
+
describe "accessed by different member" do
|
256
322
|
before do
|
257
|
-
create_ability_accessed_by_related :
|
323
|
+
create_ability_accessed_by_related :member
|
258
324
|
end
|
259
325
|
|
260
326
|
it_should_behave_like "Denies Creating"
|
@@ -263,9 +329,9 @@ describe Post do
|
|
263
329
|
it_should_behave_like "Denies Destroying"
|
264
330
|
end
|
265
331
|
|
266
|
-
describe "accessed by
|
332
|
+
describe "accessed by partner" do
|
267
333
|
before do
|
268
|
-
create_ability_accessed_by_related :
|
334
|
+
create_ability_accessed_by_related :partner
|
269
335
|
end
|
270
336
|
|
271
337
|
it_should_behave_like "Denies Creating"
|
@@ -280,91 +346,11 @@ describe Post do
|
|
280
346
|
end
|
281
347
|
|
282
348
|
it_should_behave_like "Denies Creating"
|
283
|
-
it_should_behave_like "
|
349
|
+
it_should_behave_like "Denies Reading"
|
284
350
|
it_should_behave_like "Denies Updating"
|
285
351
|
it_should_behave_like "Denies Destroying"
|
286
352
|
end
|
287
353
|
end
|
288
|
-
|
289
|
-
describe "posting by not replied" do
|
290
|
-
before :all do
|
291
|
-
@post = Factory(:post,
|
292
|
-
:author => @tie.sender,
|
293
|
-
:owner => @tie.receiver)
|
294
|
-
end
|
295
|
-
|
296
|
-
describe "accessed by author" do
|
297
|
-
before do
|
298
|
-
create_ability_accessed_by(@post.author_subject)
|
299
|
-
end
|
300
|
-
|
301
|
-
it_should_behave_like "Denies Creating"
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
context "group" do
|
307
|
-
before(:all) do
|
308
|
-
@subject = @group = Factory(:group)
|
309
|
-
end
|
310
|
-
|
311
|
-
describe "with member tie" do
|
312
|
-
before :all do
|
313
|
-
@tie = create_related_tie(:member)
|
314
|
-
end
|
315
|
-
|
316
|
-
describe "posting from member all contacts" do
|
317
|
-
before :all do
|
318
|
-
@post = Factory(:post,
|
319
|
-
:author => @tie.receiver,
|
320
|
-
:owner => @tie.sender)
|
321
|
-
end
|
322
|
-
|
323
|
-
describe "accessed by author" do
|
324
|
-
before do
|
325
|
-
create_ability_accessed_by @post.author_subject
|
326
|
-
end
|
327
|
-
|
328
|
-
it_should_behave_like "Allows Creating"
|
329
|
-
it_should_behave_like "Allows Reading"
|
330
|
-
it_should_behave_like "Allows Updating"
|
331
|
-
it_should_behave_like "Allows Destroying"
|
332
|
-
end
|
333
|
-
|
334
|
-
describe "accessed by different member" do
|
335
|
-
before do
|
336
|
-
create_ability_accessed_by_related :member
|
337
|
-
end
|
338
|
-
|
339
|
-
it_should_behave_like "Denies Creating"
|
340
|
-
it_should_behave_like "Allows Reading"
|
341
|
-
it_should_behave_like "Denies Updating"
|
342
|
-
it_should_behave_like "Denies Destroying"
|
343
|
-
end
|
344
|
-
|
345
|
-
describe "accessed by partner" do
|
346
|
-
before do
|
347
|
-
create_ability_accessed_by_related :partner
|
348
|
-
end
|
349
|
-
|
350
|
-
it_should_behave_like "Denies Creating"
|
351
|
-
it_should_behave_like "Allows Reading"
|
352
|
-
it_should_behave_like "Denies Updating"
|
353
|
-
it_should_behave_like "Denies Destroying"
|
354
|
-
end
|
355
|
-
|
356
|
-
describe "accessed publicly" do
|
357
|
-
before do
|
358
|
-
create_ability_accessed_publicly
|
359
|
-
end
|
360
|
-
|
361
|
-
it_should_behave_like "Denies Creating"
|
362
|
-
it_should_behave_like "Denies Reading"
|
363
|
-
it_should_behave_like "Denies Updating"
|
364
|
-
it_should_behave_like "Denies Destroying"
|
365
|
-
end
|
366
|
-
end
|
367
|
-
end
|
368
354
|
end
|
369
355
|
end
|
370
356
|
end
|