social_stream 0.25.2 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- data/base/app/assets/javascripts/social_stream.follow.js +23 -0
- data/base/app/assets/javascripts/social_stream.wall.js.erb +3 -3
- data/base/app/controllers/search_controller.rb +30 -16
- data/base/app/helpers/location_helper.rb +1 -44
- data/base/app/helpers/search_helper.rb +7 -7
- data/base/app/models/activity.rb +0 -21
- data/base/app/models/activity_action.rb +8 -0
- data/base/app/models/activity_object.rb +55 -25
- data/base/app/models/activity_object_audience.rb +8 -0
- data/base/app/models/actor.rb +9 -0
- data/base/app/models/comment.rb +1 -3
- data/base/app/models/group.rb +3 -0
- data/base/app/models/post.rb +1 -3
- data/base/app/models/relation.rb +5 -0
- data/base/app/models/relation/follow.rb +6 -7
- data/base/app/models/relation/public.rb +5 -0
- data/base/app/models/relation/single.rb +11 -1
- data/base/app/views/activities/_new.html.erb +1 -1
- data/base/app/views/contacts/_link_follow.html.erb +8 -4
- data/base/app/views/followers/update.js.erb +2 -0
- data/base/app/views/layouts/_search.html.erb +2 -2
- data/base/app/views/search/_extended_search.html.erb +17 -17
- data/base/app/views/search/_form.html.erb +4 -4
- data/base/app/views/search/_header_search.html.erb +2 -2
- data/base/app/views/search/index.html.erb +1 -1
- data/base/app/views/search/index.js.erb +4 -4
- data/base/db/migrate/20120403175913_create_activity_object_audiences.rb +34 -0
- data/base/db/migrate/20120411132550_add_visit_count_to_activity_object.rb +9 -0
- data/base/db/migrate/20120411151413_relation_public_permissions.rb +8 -0
- data/base/lib/generators/social_stream/base/templates/initializer.rb +3 -0
- data/base/lib/social_stream-base.rb +2 -1
- data/base/lib/social_stream/ability/base.rb +14 -8
- data/base/lib/social_stream/base/dependencies.rb +1 -0
- data/base/lib/social_stream/base/thinking-sphinx.rb +18 -0
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/controllers/objects.rb +6 -0
- data/base/lib/social_stream/test_helpers/controllers.rb +1 -1
- data/base/lib/social_stream/views/location.rb +48 -0
- data/base/lib/tasks/db/populate.rake +1 -1
- data/base/lib/thinking-sphinx/social_stream.rb +3 -0
- data/base/spec/controllers/groups_controller_spec.rb +6 -6
- data/base/spec/controllers/posts_controller_spec.rb +6 -6
- data/base/spec/controllers/users_controller_spec.rb +4 -4
- data/base/spec/dummy/config/initializers/social_stream.rb +3 -0
- data/base/spec/factories/activity.rb +24 -1
- data/base/spec/factories/post.rb +1 -1
- data/base/spec/models/activity_authorization_spec.rb +1 -1
- data/base/spec/models/post_spec.rb +0 -4
- data/base/spec/models/relation_follow_spec.rb +8 -0
- data/documents/app/controllers/documents_controller.rb +1 -1
- data/documents/app/models/audio.rb +2 -5
- data/documents/app/models/document.rb +5 -8
- data/documents/app/models/picture.rb +2 -5
- data/documents/app/models/video.rb +6 -8
- data/documents/app/views/audios/_audio_processing.html.erb +3 -1
- data/documents/app/views/documents/_document.html.erb +12 -3
- data/documents/app/views/pictures/_picture.html.erb +2 -2
- data/documents/app/views/videos/_video_processed.html.erb +2 -2
- data/documents/app/views/videos/_video_processing.html.erb +3 -1
- data/documents/config/locales/en.yml +2 -5
- data/documents/config/locales/es.yml +2 -5
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/lib/tasks/db/populate_documents.rake +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/documents/spec/factories/document.rb +2 -2
- data/documents/spec/factories/picture.rb +2 -2
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/social_stream-events.gemspec +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/linkser/app/models/link.rb +2 -4
- data/linkser/lib/social_stream/linkser/version.rb +1 -1
- data/linkser/lib/tasks/db/populate_links.rake +35 -0
- data/linkser/social_stream-linkser.gemspec +1 -1
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/social_stream.gemspec +5 -5
- metadata +41 -31
@@ -176,7 +176,7 @@ namespace :db do
|
|
176
176
|
:author_id => author.id,
|
177
177
|
:owner_id => owner.id,
|
178
178
|
:user_author_id => user_author.id,
|
179
|
-
:
|
179
|
+
:relation_ids => Array(t.relation_id)
|
180
180
|
|
181
181
|
p.post_activity.update_attributes(:created_at => p.created_at,
|
182
182
|
:updated_at => p.updated_at)
|
@@ -170,16 +170,16 @@ describe GroupsController do
|
|
170
170
|
|
171
171
|
it "should allow creating" do
|
172
172
|
count = Group.count
|
173
|
-
post :create, :group => { :name => "Test" }
|
173
|
+
post :create, :group => { :name => "Test new group" }
|
174
174
|
|
175
|
-
|
175
|
+
new_group = assigns(:group)
|
176
176
|
|
177
|
-
|
177
|
+
new_group.should be_valid
|
178
178
|
Group.count.should eq(count + 1)
|
179
|
-
assigns(:current_subject).should eq(
|
179
|
+
assigns(:current_subject).should eq(new_group)
|
180
180
|
response.should redirect_to(:home)
|
181
|
-
@user.
|
182
|
-
@group.
|
181
|
+
@user.senders.should include(new_group.actor)
|
182
|
+
@group.senders.should include(new_group.actor)
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
@@ -53,7 +53,7 @@ describe PostsController do
|
|
53
53
|
@current_model = Factory(:post, :author_id => @user.actor_id,
|
54
54
|
:owner_id => @user.actor_id,
|
55
55
|
:user_author_id => @user.actor_id,
|
56
|
-
:
|
56
|
+
:relation_ids => Array(relation.id))
|
57
57
|
end
|
58
58
|
|
59
59
|
it_should_behave_like "Allow Creating"
|
@@ -78,7 +78,7 @@ describe PostsController do
|
|
78
78
|
@current_model = Factory(:post, :author_id => @user.actor_id,
|
79
79
|
:owner_id => @user.actor_id,
|
80
80
|
:user_author_id => @user.actor_id,
|
81
|
-
:
|
81
|
+
:relation_ids => Array(relation.id))
|
82
82
|
end
|
83
83
|
|
84
84
|
it_should_behave_like "Allow Creating"
|
@@ -149,7 +149,7 @@ describe PostsController do
|
|
149
149
|
@current_model = Factory(:post, :author_id => contact.sender.id,
|
150
150
|
:owner_id => contact.receiver.id,
|
151
151
|
:user_author_id => contact.sender.id,
|
152
|
-
:
|
152
|
+
:relation_ids => Array(relation.id))
|
153
153
|
end
|
154
154
|
|
155
155
|
it_should_behave_like "Allow Creating"
|
@@ -170,7 +170,7 @@ describe PostsController do
|
|
170
170
|
@current_model = Factory(:post, :author_id => contact.sender.id,
|
171
171
|
:owner_id => contact.receiver.id,
|
172
172
|
:user_author_id => contact.sender.id,
|
173
|
-
:
|
173
|
+
:relation_ids => Array(relation.id))
|
174
174
|
end
|
175
175
|
|
176
176
|
it_should_behave_like "Allow Creating"
|
@@ -186,7 +186,7 @@ describe PostsController do
|
|
186
186
|
@current_model = Factory(:post, :author_id => contact.sender.id,
|
187
187
|
:owner_id => contact.receiver.id,
|
188
188
|
:user_author_id => contact.sender.id,
|
189
|
-
:
|
189
|
+
:relation_ids => Array(relation.id))
|
190
190
|
end
|
191
191
|
|
192
192
|
it_should_behave_like "Allow Creating"
|
@@ -202,7 +202,7 @@ describe PostsController do
|
|
202
202
|
@current_model = Factory(:post, :author_id => contact.sender.id,
|
203
203
|
:owner_id => contact.receiver.id,
|
204
204
|
:user_author_id => contact.sender.id,
|
205
|
-
:
|
205
|
+
:relation_ids => Array(relation.id))
|
206
206
|
end
|
207
207
|
|
208
208
|
it_should_behave_like "Allow Creating"
|
@@ -74,10 +74,10 @@ describe UsersController do
|
|
74
74
|
it "should render other's page with activity" do
|
75
75
|
tie = Factory(:friend, :receiver => @user.actor)
|
76
76
|
friend = tie.sender
|
77
|
-
Factory(:post, :author_id =>
|
78
|
-
:owner_id =>
|
79
|
-
:user_author_id =>
|
80
|
-
:
|
77
|
+
Factory(:post, :author_id => @user.actor_id,
|
78
|
+
:owner_id => friend.id,
|
79
|
+
:user_author_id => @user.actor_id,
|
80
|
+
:relation_ids => Array(tie.relation_id))
|
81
81
|
|
82
82
|
get :show, :id => friend.to_param
|
83
83
|
|
@@ -41,3 +41,6 @@ SocialStream.setup do |config|
|
|
41
41
|
# Cleditor controls. It is used in new message editor, for example
|
42
42
|
# config.cleditor_controls = "bold italic underline strikethrough subscript superscript | size style | bullets | image link unlink"
|
43
43
|
end
|
44
|
+
|
45
|
+
# You can customize toolbar, sidebar and location bar from here
|
46
|
+
# See https://github.com/ging/social_stream/wiki/How-to-customize-the-toolbar,-sidebar-and-location
|
@@ -26,12 +26,35 @@ Factory.define :activity do |a|
|
|
26
26
|
a.channel { Factory(:friend).contact.channel }
|
27
27
|
a.activity_verb { ActivityVerb["post"] }
|
28
28
|
a.relation_ids { |b| Array(b.sender.relation_custom('friend').id) }
|
29
|
-
a.activity_object_ids {
|
29
|
+
a.activity_object_ids { |b|
|
30
|
+
# Create post
|
31
|
+
post = Factory(:post,
|
32
|
+
:author_id => b.author_id,
|
33
|
+
:owner_id => b.owner_id,
|
34
|
+
:user_author => b.user_author_id)
|
35
|
+
|
36
|
+
post.activities.delete_all
|
37
|
+
|
38
|
+
[post.activity_object_id]
|
39
|
+
}
|
30
40
|
end
|
31
41
|
|
32
42
|
Factory.define :self_activity, :parent => :activity do |a|
|
33
43
|
a.channel { Factory(:self_contact).channel }
|
34
44
|
a.relation_ids { |b| Array(b.sender.relation_custom('friend').id) }
|
45
|
+
a.activity_object_ids { |b|
|
46
|
+
# Create post
|
47
|
+
post = Factory(:post,
|
48
|
+
:author_id => b.author_id,
|
49
|
+
:owner_id => b.owner_id,
|
50
|
+
:user_author => b.user_author_id,
|
51
|
+
:relation_ids => b.relation_ids)
|
52
|
+
|
53
|
+
post.activities.delete_all
|
54
|
+
|
55
|
+
[post.activity_object_id]
|
56
|
+
}
|
57
|
+
|
35
58
|
end
|
36
59
|
|
37
60
|
Factory.define :public_activity, :parent => :activity do |a|
|
data/base/spec/factories/post.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
|
8
8
|
Factory.define :public_post, :parent => :post do |p|
|
9
9
|
p.owner_id { |q| q.author_id }
|
10
|
-
p.
|
10
|
+
p.relation_ids { |q| Array(Relation::Public.instance.id) }
|
11
11
|
end
|
12
12
|
|
13
13
|
Factory.define :self_post, :parent => :post do |p|
|
@@ -6,7 +6,7 @@ module ActivityTestHelper
|
|
6
6
|
:author_id => contact.sender.id,
|
7
7
|
:owner_id => contact.receiver.id,
|
8
8
|
:user_author_id => contact.sender.id,
|
9
|
-
:
|
9
|
+
:relation_ids => Array(Relation.normalize_id(relations))).post_activity
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_ability_accessed_by(subject)
|
@@ -53,8 +53,6 @@ describe Post do
|
|
53
53
|
:owner_id => tie.sender.id,
|
54
54
|
:user_author_id => tie.receiver.id
|
55
55
|
|
56
|
-
assert post.build_post_activity.allow? tie.receiver_subject, 'create'
|
57
|
-
|
58
56
|
ability = Ability.new(tie.receiver_subject)
|
59
57
|
|
60
58
|
ability.should be_able_to(:create, post)
|
@@ -88,8 +86,6 @@ describe Post do
|
|
88
86
|
:owner_id => tie.sender.id,
|
89
87
|
:user_author_id => tie.receiver.id
|
90
88
|
|
91
|
-
assert post.build_post_activity.allow? tie.receiver_subject, 'create'
|
92
|
-
|
93
89
|
ability = Ability.new(tie.receiver_subject)
|
94
90
|
|
95
91
|
ability.should be_able_to(:create, post)
|
@@ -10,7 +10,7 @@ class DocumentsController < ApplicationController
|
|
10
10
|
|
11
11
|
def index
|
12
12
|
super do |format|
|
13
|
-
format.json { render :json => collection.map{|a| a.activity_objects.first.document
|
13
|
+
format.json { render :json => collection.map{|a| a.activity_objects.first.document} }
|
14
14
|
if params[:no_layout].present?
|
15
15
|
format.html { render :action => :index, :layout => false }
|
16
16
|
else
|
@@ -8,12 +8,9 @@ class Audio < Document
|
|
8
8
|
process_in_background :file
|
9
9
|
|
10
10
|
define_index do
|
11
|
-
|
11
|
+
activity_object_index
|
12
|
+
|
12
13
|
indexes file_file_name, :as => :file_name
|
13
|
-
indexes activity_object.description
|
14
|
-
indexes activity_object.tags.name, :as => :tags
|
15
|
-
|
16
|
-
has created_at
|
17
14
|
end
|
18
15
|
|
19
16
|
# Thumbnail file
|
@@ -15,14 +15,11 @@ class Document < ActiveRecord::Base
|
|
15
15
|
end
|
16
16
|
|
17
17
|
define_index do
|
18
|
-
|
18
|
+
activity_object_index
|
19
|
+
|
19
20
|
indexes file_file_name, :as => :file_name
|
20
|
-
indexes activity_object.description
|
21
|
-
indexes activity_object.tags.name, :as => :tags
|
22
21
|
|
23
22
|
where "type IS NULL"
|
24
|
-
|
25
|
-
has created_at
|
26
23
|
end
|
27
24
|
|
28
25
|
class << self
|
@@ -70,13 +67,13 @@ class Document < ActiveRecord::Base
|
|
70
67
|
end
|
71
68
|
|
72
69
|
# JSON, generic version for most documents
|
73
|
-
def
|
74
|
-
{:id =>
|
70
|
+
def as_json(options = nil)
|
71
|
+
{:id => id,
|
75
72
|
:title => title,
|
76
73
|
:description => description,
|
77
74
|
:author => author.name,
|
78
75
|
:src => file.to_s
|
79
|
-
}
|
76
|
+
}
|
80
77
|
end
|
81
78
|
|
82
79
|
protected
|
@@ -10,12 +10,9 @@ class Picture < Document
|
|
10
10
|
}
|
11
11
|
|
12
12
|
define_index do
|
13
|
-
|
13
|
+
activity_object_index
|
14
|
+
|
14
15
|
indexes file_file_name, :as => :file_name
|
15
|
-
indexes activity_object.description
|
16
|
-
indexes activity_object.tags.name, :as => :tags
|
17
|
-
|
18
|
-
has created_at
|
19
16
|
end
|
20
17
|
|
21
18
|
# Thumbnail file
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Video < Document
|
2
2
|
has_attached_file :file,
|
3
3
|
:url => '/:class/:id.:extension',
|
4
|
+
:default_url => 'missing_:style.png',
|
4
5
|
:path => ':rails_root/documents/:class/:id_partition/:style',
|
5
6
|
:styles => {
|
6
7
|
:webm => {:format => 'webm'},
|
@@ -15,12 +16,9 @@ class Video < Document
|
|
15
16
|
process_in_background :file
|
16
17
|
|
17
18
|
define_index do
|
18
|
-
|
19
|
+
activity_object_index
|
20
|
+
|
19
21
|
indexes file_file_name, :as => :file_name
|
20
|
-
indexes activity_object.description
|
21
|
-
indexes activity_object.tags.name, :as => :tags
|
22
|
-
|
23
|
-
has created_at
|
24
22
|
end
|
25
23
|
|
26
24
|
# Thumbnail file
|
@@ -29,8 +27,8 @@ class Video < Document
|
|
29
27
|
end
|
30
28
|
|
31
29
|
# JSON, special edition for video files
|
32
|
-
def
|
33
|
-
{:id =>
|
30
|
+
def as_json(options = nil)
|
31
|
+
{:id => id,
|
34
32
|
:title => title,
|
35
33
|
:description => description,
|
36
34
|
:author => author.name,
|
@@ -39,7 +37,7 @@ class Video < Document
|
|
39
37
|
{ :type => Mime::MP4.to_s, :src => file(:mp4).to_s },
|
40
38
|
{ :type => Mime::FLV.to_s, :src => file(:flv).to_s }
|
41
39
|
]
|
42
|
-
}
|
40
|
+
}
|
43
41
|
end
|
44
42
|
|
45
43
|
end
|
@@ -7,9 +7,18 @@
|
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<div class="attachment_text">
|
10
|
-
|
11
|
-
document
|
12
|
-
|
10
|
+
<div class="title">
|
11
|
+
<%= document.title %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<%= simple_format auto_link(document.description) %>
|
15
|
+
|
16
|
+
<%= link_to t('details.msg'),
|
17
|
+
document_path(document),
|
18
|
+
:alt => t('details.msg'),
|
19
|
+
:type => document.type,
|
20
|
+
:path => document_path(document),
|
21
|
+
:class => "attachment_text_link document_link" %>
|
13
22
|
</div>
|
14
23
|
|
15
24
|
<% end %>
|
@@ -15,9 +15,9 @@
|
|
15
15
|
|
16
16
|
<%= simple_format auto_link(picture.description) %>
|
17
17
|
|
18
|
-
<%= link_to t('
|
18
|
+
<%= link_to t('details.msg'),
|
19
19
|
picture_path(picture),
|
20
|
-
:alt => t('
|
20
|
+
:alt => t('details.msg'),
|
21
21
|
:type => picture.type,
|
22
22
|
:path => document_path(picture),
|
23
23
|
:class => "attachment_text_link picture_link" %>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
<%= simple_format auto_link(video.description) %>
|
12
12
|
|
13
|
-
<%= link_to t('
|
13
|
+
<%= link_to t('details.msg'),
|
14
14
|
video,
|
15
|
-
:alt => t('
|
15
|
+
:alt => t('details.msg'),
|
16
16
|
:type => video.type,
|
17
17
|
:path => document_path(video),
|
18
18
|
:class => "attachment_text_link video_link" %>
|
@@ -7,7 +7,6 @@ en:
|
|
7
7
|
confirm_delete: "Delete audio?"
|
8
8
|
title: "Audios"
|
9
9
|
mine: "My audios"
|
10
|
-
msg: "Uploaded an audio:"
|
11
10
|
name: "audio"
|
12
11
|
not_mine: "Audios"
|
13
12
|
one: "an audio"
|
@@ -15,6 +14,8 @@ en:
|
|
15
14
|
title:
|
16
15
|
one: "Audio"
|
17
16
|
other: "Audios"
|
17
|
+
details:
|
18
|
+
msg: "See details..."
|
18
19
|
document:
|
19
20
|
actions:
|
20
21
|
delete: "Delete"
|
@@ -36,7 +37,6 @@ en:
|
|
36
37
|
title:
|
37
38
|
title: "Title"
|
38
39
|
mine: "My files"
|
39
|
-
msg: "Uploaded a file:"
|
40
40
|
name: "file"
|
41
41
|
not_mine: "Files"
|
42
42
|
one: "a file"
|
@@ -47,7 +47,6 @@ en:
|
|
47
47
|
picture:
|
48
48
|
confirm_delete: "Delete picture?"
|
49
49
|
mine: "My pictures"
|
50
|
-
msg: "See details..."
|
51
50
|
name: "picture"
|
52
51
|
not_mine: "Pictures"
|
53
52
|
one: "a picture"
|
@@ -65,12 +64,10 @@ en:
|
|
65
64
|
confirm_delete: "Delete resource?"
|
66
65
|
title: "Resources"
|
67
66
|
mine: "My resources"
|
68
|
-
msg: "Uploaded a resource:"
|
69
67
|
not_mine: "Resources"
|
70
68
|
video:
|
71
69
|
confirm_delete: "Delete video?"
|
72
70
|
mine: "My videos"
|
73
|
-
msg: "See details..."
|
74
71
|
name: "video"
|
75
72
|
not_mine: "Videos"
|
76
73
|
one: "a video"
|
@@ -6,7 +6,6 @@ es:
|
|
6
6
|
audio:
|
7
7
|
confirm_delete: "¿Borrar audios?"
|
8
8
|
mine: "Mis audios"
|
9
|
-
msg: "Subió un audio:"
|
10
9
|
name: "archivo de audio"
|
11
10
|
not_mine: "Audios"
|
12
11
|
one: "un archivo de audio"
|
@@ -14,6 +13,8 @@ es:
|
|
14
13
|
title:
|
15
14
|
one: "Audio"
|
16
15
|
other: "Audios"
|
16
|
+
details:
|
17
|
+
msg: "Ver detalles..."
|
17
18
|
document:
|
18
19
|
actions:
|
19
20
|
delete: "Borrar"
|
@@ -35,7 +36,6 @@ es:
|
|
35
36
|
title:
|
36
37
|
title: "Título"
|
37
38
|
mine: "Mis ficheros"
|
38
|
-
msg: "Subió un fichero:"
|
39
39
|
name: "fichero"
|
40
40
|
not_mine: "Ficheros"
|
41
41
|
one: "un fichero"
|
@@ -46,7 +46,6 @@ es:
|
|
46
46
|
picture:
|
47
47
|
confirm_delete: "¿Borrar imagen?"
|
48
48
|
mine: "Mis imágenes"
|
49
|
-
msg: "Ver detalles..."
|
50
49
|
name: "imagen"
|
51
50
|
not_mine: "Imágenes"
|
52
51
|
one: "una imagen"
|
@@ -64,12 +63,10 @@ es:
|
|
64
63
|
confirm_delete: "¿Borrar recursos?"
|
65
64
|
title: "Recursos"
|
66
65
|
mine: "Mis recursos"
|
67
|
-
msg: "Subió un recurso:"
|
68
66
|
not_mine: "Recursos"
|
69
67
|
video:
|
70
68
|
confirm_delete: "¿Borrar vídeo?"
|
71
69
|
mine: "Mis vídeos"
|
72
|
-
msg: "Ver detalles..."
|
73
70
|
name: "vídeo"
|
74
71
|
not_mine: "Vídeos"
|
75
72
|
one: "un vídeo"
|