social_stream-base 2.0.4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.rdoc +2 -0
- data/app/assets/javascripts/social_stream/relation_customs.js +8 -3
- data/app/assets/javascripts/social_stream/timeline.js +1 -2
- data/app/assets/javascripts/social_stream/wall.js +11 -0
- data/app/assets/stylesheets/social_stream/base/contacts/_contacts.css.sass +1 -0
- data/app/assets/stylesheets/social_stream/base/contacts/layouts/_contacts.css.sass +1 -42
- data/app/assets/stylesheets/social_stream/base/footer/layout/_footer.css.sass +3 -2
- data/app/assets/stylesheets/social_stream/base/layouts/_layout.css.sass +4 -1
- data/app/assets/stylesheets/social_stream/base/mixins/_layout.css.sass +48 -0
- data/app/assets/stylesheets/social_stream/base/profile/_profile.css.sass +21 -25
- data/app/assets/stylesheets/social_stream/base/sidebar/_sidebar.css.sass +1 -27
- data/app/assets/stylesheets/social_stream/base/sidebar/layout/_sidebar.css.sass +1 -24
- data/app/assets/stylesheets/social_stream/base/toolbar/_toolbar.css.sass +2 -11
- data/app/assets/stylesheets/social_stream/base/toolbar/layout/_toolbar.css.sass +18 -5
- data/app/controllers/contacts_controller.rb +17 -22
- data/app/controllers/permissions_controller.rb +3 -1
- data/app/helpers/contacts_helper.rb +9 -14
- data/app/models/actor.rb +28 -2
- data/app/models/contact.rb +18 -1
- data/app/models/permission.rb +21 -1
- data/app/models/relation.rb +14 -15
- data/app/models/relation/custom.rb +27 -24
- data/app/views/activities/_new.html.erb +1 -1
- data/app/views/contacts/{_link_custom.html.erb → _button.html.erb} +0 -0
- data/app/views/contacts/_contact.html.erb +1 -1
- data/app/views/contacts/index.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +6 -8
- data/app/views/devise/registrations/new.html.erb +5 -7
- data/app/views/layouts/application.html.erb +7 -8
- data/app/views/permissions/_index.html.erb +12 -12
- data/app/views/permissions/_list.html.erb +10 -0
- data/app/views/permissions/index.js.erb +1 -15
- data/app/views/posts/create.js.erb +5 -4
- data/app/views/profiles/_personal.html.erb +2 -2
- data/app/views/relation/customs/_custom.html.erb +2 -27
- data/app/views/relation/customs/_form.html.erb +1 -1
- data/app/views/relation/customs/_index.html.erb +1 -1
- data/app/views/relation/customs/_list.html.erb +5 -4
- data/app/views/relation/customs/index.html.erb +1 -1
- data/app/views/relations/_relation.html.erb +33 -0
- data/config/locales/en.yml +10 -5
- data/config/locales/es.yml +20 -40
- data/config/locales/pt.yml +5 -1
- data/config/locales/zh.yml +17 -9
- data/lib/generators/social_stream/base/install_generator.rb +0 -4
- data/lib/generators/social_stream/base/templates/initializer.rb +24 -0
- data/lib/social_stream/base.rb +70 -0
- data/lib/social_stream/base/ability.rb +13 -1
- data/lib/social_stream/base/version.rb +1 -1
- data/lib/social_stream/test_helpers/controllers.rb +12 -6
- data/social_stream-base.gemspec +1 -1
- data/spec/controllers/permissions_controller_spec.rb +2 -6
- metadata +7 -7
- data/app/helpers/permissions_helper.rb +0 -21
- data/lib/generators/social_stream/base/templates/relations.yml +0 -39
data/lib/social_stream/base.rb
CHANGED
@@ -25,6 +25,76 @@ module SocialStream
|
|
25
25
|
mattr_accessor :single_relations
|
26
26
|
@@single_relations = [ :public, :follow, :reject ]
|
27
27
|
|
28
|
+
mattr_accessor :custom_relations
|
29
|
+
@@custom_relations = {
|
30
|
+
'user' => {
|
31
|
+
'friend' => {
|
32
|
+
'name' => 'friend',
|
33
|
+
'permissions' => [
|
34
|
+
[ 'follow' ],
|
35
|
+
[ 'create', 'activity' ],
|
36
|
+
[ 'read', 'activity' ]
|
37
|
+
]
|
38
|
+
},
|
39
|
+
'acquaintance' => {
|
40
|
+
'name' => 'acquaintance',
|
41
|
+
'permissions' => [
|
42
|
+
[ 'read', 'activity' ]
|
43
|
+
]
|
44
|
+
},
|
45
|
+
'colleague' => {
|
46
|
+
'name' => 'colleague',
|
47
|
+
'permissions' => [
|
48
|
+
[ 'follow' ],
|
49
|
+
[ 'create', 'activity' ],
|
50
|
+
[ 'read', 'activity' ]
|
51
|
+
]
|
52
|
+
}
|
53
|
+
},
|
54
|
+
'group' => {
|
55
|
+
'member' => {
|
56
|
+
'name' => 'member',
|
57
|
+
'permissions' => [
|
58
|
+
[ 'represent' ],
|
59
|
+
[ 'create', 'activity' ],
|
60
|
+
[ 'read', 'activity' ],
|
61
|
+
[ 'read', 'tie' ]
|
62
|
+
]
|
63
|
+
},
|
64
|
+
'partner' => {
|
65
|
+
'name' => 'partner',
|
66
|
+
'permissions' => [
|
67
|
+
[ 'read', 'activity' ]
|
68
|
+
]
|
69
|
+
}
|
70
|
+
},
|
71
|
+
'site/current' => {}
|
72
|
+
}
|
73
|
+
|
74
|
+
mattr_accessor :list_relations
|
75
|
+
@@list_relations = {
|
76
|
+
user: [],
|
77
|
+
group: []
|
78
|
+
}
|
79
|
+
|
80
|
+
mattr_accessor :available_permissions
|
81
|
+
@@available_permissions = {
|
82
|
+
'user' => [
|
83
|
+
[ "read", "activity" ],
|
84
|
+
[ "create", "activity" ],
|
85
|
+
[ "follow", nil ],
|
86
|
+
[ "represent", nil ],
|
87
|
+
[ "notify", nil ]
|
88
|
+
],
|
89
|
+
'group' => [
|
90
|
+
[ "read", "activity" ],
|
91
|
+
[ "create", "activity" ],
|
92
|
+
[ "follow", nil ],
|
93
|
+
[ "represent", nil ],
|
94
|
+
[ "notify", nil ]
|
95
|
+
]
|
96
|
+
}
|
97
|
+
|
28
98
|
mattr_accessor :suggested_models
|
29
99
|
@@suggested_models = [ :user, :group ]
|
30
100
|
|
@@ -59,6 +59,13 @@ module SocialStream
|
|
59
59
|
a.audience.include?(subject.actor)
|
60
60
|
end
|
61
61
|
|
62
|
+
can :read, Contact
|
63
|
+
|
64
|
+
can :manage, Contact do |c|
|
65
|
+
c.sender == subject.actor ||
|
66
|
+
c.sender.allow?(subject, 'manage', 'contact')
|
67
|
+
end
|
68
|
+
|
62
69
|
# Users
|
63
70
|
can :read, User
|
64
71
|
|
@@ -90,7 +97,12 @@ module SocialStream
|
|
90
97
|
end
|
91
98
|
|
92
99
|
# Privacy
|
93
|
-
can
|
100
|
+
can :manage, ::Relation::Custom do |r|
|
101
|
+
subject.present? && (
|
102
|
+
r.actor_id == subject.actor_id ||
|
103
|
+
r.actor.allow?(subject, 'manage', 'relation/custom')
|
104
|
+
)
|
105
|
+
end
|
94
106
|
end
|
95
107
|
end
|
96
108
|
end
|
@@ -13,6 +13,12 @@ module SocialStream
|
|
13
13
|
model_class.to_s.underscore.to_sym
|
14
14
|
end
|
15
15
|
|
16
|
+
# :client for Site::ClientsController
|
17
|
+
def demodulized_model_sym
|
18
|
+
@demodulized_model_sym ||=
|
19
|
+
model_class.to_s.demodulize.underscore.to_sym
|
20
|
+
end
|
21
|
+
|
16
22
|
# Factory.attributes_for(:post) for PostsController
|
17
23
|
def model_attributes
|
18
24
|
@model_attributes ||=
|
@@ -42,7 +48,7 @@ module SocialStream
|
|
42
48
|
count = model_count
|
43
49
|
post :create, attributes
|
44
50
|
|
45
|
-
resource = assigns(
|
51
|
+
resource = assigns(demodulized_model_sym)
|
46
52
|
|
47
53
|
model_count.should eq(count + 1)
|
48
54
|
resource.should be_valid
|
@@ -58,7 +64,7 @@ module SocialStream
|
|
58
64
|
rescue CanCan::AccessDenied
|
59
65
|
end
|
60
66
|
|
61
|
-
resource = assigns(
|
67
|
+
resource = assigns(demodulized_model_sym)
|
62
68
|
|
63
69
|
model_count.should eq(count)
|
64
70
|
resource.should be_new_record
|
@@ -88,7 +94,7 @@ module SocialStream
|
|
88
94
|
it "should update" do
|
89
95
|
put :update, updating_attributes
|
90
96
|
|
91
|
-
resource = assigns(
|
97
|
+
resource = assigns(demodulized_model_sym)
|
92
98
|
|
93
99
|
resource.should_receive(:update_attributes).with(attributes)
|
94
100
|
assert resource.valid?
|
@@ -103,7 +109,7 @@ module SocialStream
|
|
103
109
|
rescue CanCan::AccessDenied
|
104
110
|
end
|
105
111
|
|
106
|
-
resource = assigns(
|
112
|
+
resource = assigns(demodulized_model_sym)
|
107
113
|
|
108
114
|
resource.should_not_receive(:update_attributes)
|
109
115
|
end
|
@@ -114,7 +120,7 @@ module SocialStream
|
|
114
120
|
count = model_count
|
115
121
|
delete :destroy, :id => @current_model.to_param
|
116
122
|
|
117
|
-
resource = assigns(
|
123
|
+
resource = assigns(demodulized_model_sym)
|
118
124
|
|
119
125
|
model_count.should eq(count - 1)
|
120
126
|
end
|
@@ -128,7 +134,7 @@ module SocialStream
|
|
128
134
|
rescue CanCan::AccessDenied
|
129
135
|
end
|
130
136
|
|
131
|
-
resource = assigns(
|
137
|
+
resource = assigns(demodulized_model_sym)
|
132
138
|
|
133
139
|
model_count.should eq(count)
|
134
140
|
end
|
data/social_stream-base.gemspec
CHANGED
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
# Syntactically Awesome Stylesheets
|
60
60
|
s.add_runtime_dependency('sass-rails', '>= 3.1.0')
|
61
61
|
# Bootstrap for Sass
|
62
|
-
s.add_runtime_dependency('bootstrap-sass', '~> 2.3.
|
62
|
+
s.add_runtime_dependency('bootstrap-sass', '~> 2.3.2.0')
|
63
63
|
# Customize ERB views
|
64
64
|
s.add_runtime_dependency('deface', '~> 0.9.1')
|
65
65
|
# Autolink text blocks
|
@@ -30,13 +30,9 @@ describe PermissionsController do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should not render index" do
|
33
|
-
|
33
|
+
expect {
|
34
34
|
get :index, :relation_id => @relation.id, :format => "html"
|
35
|
-
|
36
|
-
assert false
|
37
|
-
rescue ActiveRecord::RecordNotFound
|
38
|
-
assigns(:permissions).should be_nil
|
39
|
-
end
|
35
|
+
}.to raise_error(CanCan::AccessDenied)
|
40
36
|
end
|
41
37
|
end
|
42
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GING - DIT - UPM
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|
@@ -338,14 +338,14 @@ dependencies:
|
|
338
338
|
requirements:
|
339
339
|
- - ~>
|
340
340
|
- !ruby/object:Gem::Version
|
341
|
-
version: 2.3.
|
341
|
+
version: 2.3.2.0
|
342
342
|
type: :runtime
|
343
343
|
prerelease: false
|
344
344
|
version_requirements: !ruby/object:Gem::Requirement
|
345
345
|
requirements:
|
346
346
|
- - ~>
|
347
347
|
- !ruby/object:Gem::Version
|
348
|
-
version: 2.3.
|
348
|
+
version: 2.3.2.0
|
349
349
|
- !ruby/object:Gem::Dependency
|
350
350
|
name: deface
|
351
351
|
requirement: !ruby/object:Gem::Requirement
|
@@ -780,7 +780,6 @@ files:
|
|
780
780
|
- app/helpers/layouts_helper.rb
|
781
781
|
- app/helpers/location_helper.rb
|
782
782
|
- app/helpers/notifications_helper.rb
|
783
|
-
- app/helpers/permissions_helper.rb
|
784
783
|
- app/helpers/posts_helper.rb
|
785
784
|
- app/helpers/profiles_helper.rb
|
786
785
|
- app/helpers/search_helper.rb
|
@@ -853,9 +852,9 @@ files:
|
|
853
852
|
- app/views/comments/_search_result.html.erb
|
854
853
|
- app/views/comments/create.js.erb
|
855
854
|
- app/views/comments/destroy.js.erb
|
855
|
+
- app/views/contacts/_button.html.erb
|
856
856
|
- app/views/contacts/_contact.html.erb
|
857
857
|
- app/views/contacts/_form.html.erb
|
858
|
-
- app/views/contacts/_link_custom.html.erb
|
859
858
|
- app/views/contacts/_link_follow.html.erb
|
860
859
|
- app/views/contacts/_pendings.html.erb
|
861
860
|
- app/views/contacts/_suggestions.html.erb
|
@@ -978,6 +977,7 @@ files:
|
|
978
977
|
- app/views/objects/_show.html.erb
|
979
978
|
- app/views/objects/_timeline_description.html.erb
|
980
979
|
- app/views/permissions/_index.html.erb
|
980
|
+
- app/views/permissions/_list.html.erb
|
981
981
|
- app/views/permissions/index.js.erb
|
982
982
|
- app/views/posts/_post.html.erb
|
983
983
|
- app/views/posts/_quick_search_result.html.erb
|
@@ -1004,6 +1004,7 @@ files:
|
|
1004
1004
|
- app/views/relation/customs/destroy.js.erb
|
1005
1005
|
- app/views/relation/customs/index.html.erb
|
1006
1006
|
- app/views/relation/customs/update.js.erb
|
1007
|
+
- app/views/relations/_relation.html.erb
|
1007
1008
|
- app/views/repositories/_filter.html.erb
|
1008
1009
|
- app/views/repositories/show.html.erb
|
1009
1010
|
- app/views/search/_extended_search.html.erb
|
@@ -1062,7 +1063,6 @@ files:
|
|
1062
1063
|
- lib/acts_as_taggable_on/social_stream.rb
|
1063
1064
|
- lib/generators/social_stream/base/install_generator.rb
|
1064
1065
|
- lib/generators/social_stream/base/templates/initializer.rb
|
1065
|
-
- lib/generators/social_stream/base/templates/relations.yml
|
1066
1066
|
- lib/generators/social_stream/base/templates/social_stream.css.sass
|
1067
1067
|
- lib/generators/social_stream/base/templates/sphinx.yml
|
1068
1068
|
- lib/i18n-js/social_stream-base.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module PermissionsHelper
|
2
|
-
DEFAULT_PERMISSIONS =
|
3
|
-
[
|
4
|
-
[ "read", "activity" ],
|
5
|
-
[ "create", "activity" ],
|
6
|
-
[ "follow", nil ],
|
7
|
-
[ "represent", nil ],
|
8
|
-
[ "notify", nil ]
|
9
|
-
]
|
10
|
-
|
11
|
-
def default_permissions
|
12
|
-
@default_permissions ||=
|
13
|
-
DEFAULT_PERMISSIONS.map{ |p|
|
14
|
-
Permission.find_or_create_by_action_and_object *p
|
15
|
-
}
|
16
|
-
end
|
17
|
-
|
18
|
-
def disable_permission_edit? perm
|
19
|
-
(perm.action == 'represent') and (@relation.ties.size > 0) and perm.relations.include?(@relation) and (perm.relations.where(:actor_id => @relation.actor_id).find_all{|r| r.ties.size > 0}.size <= 1)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# Default relations for Social Stream
|
2
|
-
#
|
3
|
-
# Define the default relations and permissions offered by your application
|
4
|
-
# Though subjects (user, groups, etc.) can customize their own relations,
|
5
|
-
# these are the defaults to start up with
|
6
|
-
#
|
7
|
-
# Detailed information on permissions is available at:
|
8
|
-
# http://rdoc.info/gems/social_stream-base/Permission
|
9
|
-
#
|
10
|
-
user:
|
11
|
-
friend:
|
12
|
-
name: friend
|
13
|
-
permissions:
|
14
|
-
- [ follow ]
|
15
|
-
- [ create, activity ]
|
16
|
-
- [ read, activity ]
|
17
|
-
acquaintance:
|
18
|
-
name: acquaintance
|
19
|
-
permissions:
|
20
|
-
- [ read, activity ]
|
21
|
-
colleague:
|
22
|
-
name: colleague
|
23
|
-
permissions:
|
24
|
-
- [ follow ]
|
25
|
-
- [ create, activity ]
|
26
|
-
- [ read, activity ]
|
27
|
-
|
28
|
-
group:
|
29
|
-
member:
|
30
|
-
name: member
|
31
|
-
permissions:
|
32
|
-
- [ represent ]
|
33
|
-
- [ create, activity ]
|
34
|
-
- [ read, activity ]
|
35
|
-
- [ read, tie ]
|
36
|
-
partner:
|
37
|
-
name: partner
|
38
|
-
permissions:
|
39
|
-
- [ read, activity ]
|