social_stream 0.24.1 → 0.25.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.action.js +40 -0
- data/base/app/assets/javascripts/social_stream.comments.js +26 -1
- data/base/app/assets/javascripts/social_stream.timeline.js +15 -7
- data/base/app/assets/javascripts/social_stream.wall.js.erb +1 -0
- data/base/app/assets/stylesheets/social_stream-base.css.scss +13 -0
- data/base/app/models/activity.rb +5 -1
- data/base/app/models/activity_action.rb +6 -0
- data/base/app/models/activity_object.rb +131 -9
- data/base/app/models/actor.rb +2 -0
- data/base/app/models/channel.rb +0 -1
- data/base/app/models/comment.rb +0 -6
- data/base/app/views/activity_actions/_update.js.erb +11 -0
- data/base/app/views/activity_actions/create.js.erb +1 -1
- data/base/app/views/activity_actions/update.js.erb +1 -1
- data/base/app/views/comments/create.js.erb +1 -1
- data/base/app/views/posts/create.js.erb +1 -1
- data/base/db/migrate/20120111141717_create_social_stream.rb +265 -0
- data/base/db/migrate/20120326083509_object_channels_to_actions.rb +45 -0
- data/base/lib/social_stream/ability/base.rb +2 -2
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/controllers/cancan_devise_integration.rb +9 -5
- data/base/lib/social_stream/models/object.rb +0 -72
- data/base/lib/social_stream/models/subject.rb +2 -1
- data/base/lib/social_stream/models/subtype.rb +6 -1
- data/base/spec/controllers/groups_controller_spec.rb +6 -0
- data/base/spec/factories/post.rb +6 -0
- data/base/spec/models/activity_action_spec.rb +35 -0
- data/documents/app/assets/javascripts/social_stream.video.js.erb +2 -1
- data/documents/app/controllers/documents_controller.rb +4 -1
- data/documents/app/models/document.rb +10 -0
- data/documents/app/models/video.rb +17 -1
- data/documents/app/views/videos/_video_processed.html.erb +1 -0
- data/documents/app/views/videos/_video_show.html.erb +2 -1
- data/documents/db/migrate/{20110615143707_create_social_stream_documents.rb → 20120109155431_create_social_stream_documents.rb} +9 -11
- data/documents/lib/social_stream/documents/engine.rb +1 -0
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/events/app/assets/javascripts/social_stream.calendar.js.erb +15 -9
- data/events/app/assets/javascripts/social_stream.events.action.js +31 -0
- data/events/db/migrate/20111218203314_create_events.rb +33 -0
- data/events/db/migrate/20120330131859_create_social_stream_events.rb +10 -0
- 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/lib/tasks/migrations.rake +2 -0
- data/linkser/app/views/links/create.js.erb +1 -1
- data/linkser/db/migrate/{20111129100618_create_social_stream_linkser.rb → 20111219122952_create_social_stream_linkser.rb} +4 -7
- data/linkser/lib/social_stream/linkser/version.rb +1 -1
- data/linkser/social_stream-linkser.gemspec +1 -1
- data/presence/db/migrate/20120330132148_create_social_stream_presence.rb +10 -0
- 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 +42 -54
- data/base/app/assets/stylesheets/social_stream-base.css +0 -5
- data/base/app/views/activity_actions/_update_form.js.erb +0 -2
- data/base/db/migrate/20110610112023_create_social_stream.rb +0 -319
- data/base/db/migrate/20110705103202_empty_ties_count.rb +0 -17
- data/base/db/migrate/20110712090343_remove_spheres.rb +0 -30
- data/base/db/migrate/20110712142140_remove_permission_function.rb +0 -26
- data/base/db/migrate/20110912074426_add_reject_relation.rb +0 -29
- data/base/db/migrate/20111124100618_object_actors.rb +0 -52
- data/base/db/migrate/20111221103509_add_language_field.rb +0 -13
- data/base/db/migrate/20120103103125_add_channels.rb +0 -88
- data/base/db/migrate/20120109081509_update_notify_permissions.rb +0 -15
- data/base/db/migrate/20120111120920_remove_language_default.rb +0 -9
- data/base/db/migrate/20120111141717_activity_channels.rb +0 -74
- data/documents/db/migrate/20110922173707_add_file_processing_to_document.rb +0 -9
- data/documents/db/migrate/20111005112707_add_title_and_description_to_document.rb +0 -11
- data/documents/db/migrate/20120109155431_document_object_type.rb +0 -16
- data/events/db/migrate/20111101193523_create_events.rb +0 -13
- data/events/db/migrate/20111120104349_create_rooms.rb +0 -26
- data/events/db/migrate/20111204155637_add_scheduler.rb +0 -33
- data/events/db/migrate/20111218203314_change_scheduler.rb +0 -11
- data/linkser/db/migrate/20111219122952_add_width_height_to_link.rb +0 -15
@@ -22,6 +22,7 @@ module SocialStream
|
|
22
22
|
subtype_of :actor,
|
23
23
|
:build => { :subject_type => to_s }
|
24
24
|
|
25
|
+
has_one :activity_object, :through => :actor
|
25
26
|
has_one :profile, :through => :actor
|
26
27
|
|
27
28
|
validates_presence_of :name
|
@@ -48,7 +49,7 @@ module SocialStream
|
|
48
49
|
|
49
50
|
scope :followed, lambda {
|
50
51
|
joins(:actor).
|
51
|
-
|
52
|
+
merge(Actor.followed)
|
52
53
|
}
|
53
54
|
|
54
55
|
scope :liked, lambda {
|
@@ -53,7 +53,12 @@ module SocialStream #:nodoc:
|
|
53
53
|
# the subtype. Example: user.foo should raise "foo is not defined in user"
|
54
54
|
# and not "in actor"
|
55
55
|
rescue NameError => supertype_error
|
56
|
-
|
56
|
+
if supertype_error.name == subtype_error.name &&
|
57
|
+
supertype_error.message =~ /#{ self.class.supertype_name.to_s.classify }/
|
58
|
+
raise subtype_error
|
59
|
+
else
|
60
|
+
raise supertype_error
|
61
|
+
end
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
@@ -13,6 +13,12 @@ describe GroupsController do
|
|
13
13
|
assert_response :success
|
14
14
|
end
|
15
15
|
|
16
|
+
it "should render index with most followed" do
|
17
|
+
get :index, :most => 'followed'
|
18
|
+
|
19
|
+
response.should be_success
|
20
|
+
end
|
21
|
+
|
16
22
|
it "should render show" do
|
17
23
|
get :show, :id => Factory(:group).to_param
|
18
24
|
|
data/base/spec/factories/post.rb
CHANGED
@@ -9,3 +9,9 @@ Factory.define :public_post, :parent => :post do |p|
|
|
9
9
|
p.owner_id { |q| q.author_id }
|
10
10
|
p._relation_ids { |q| Array(Relation::Public.instance.id) }
|
11
11
|
end
|
12
|
+
|
13
|
+
Factory.define :self_post, :parent => :post do |p|
|
14
|
+
p.author_id { Factory(:user).actor_id }
|
15
|
+
p.owner_id { |q| q.author_id }
|
16
|
+
p.user_author_id { |q| q.author_id }
|
17
|
+
end
|
@@ -22,5 +22,40 @@ describe ActivityAction do
|
|
22
22
|
|
23
23
|
action.reload.should_not be_follow
|
24
24
|
end
|
25
|
+
|
26
|
+
describe "where posting to other owner" do
|
27
|
+
before do
|
28
|
+
@post = Factory(:post)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should not be duplicated" do
|
32
|
+
@post.received_actions.count.should == 2
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "where posting to self" do
|
37
|
+
before do
|
38
|
+
@post = Factory(:self_post)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should not be duplicated" do
|
42
|
+
@post.received_actions.count.should == 1
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "where building the post" do
|
47
|
+
before do
|
48
|
+
user = Factory(:user)
|
49
|
+
@post = Post.new :text => "Testing",
|
50
|
+
:author => user,
|
51
|
+
:owner => user,
|
52
|
+
:user_author => user
|
53
|
+
@post.save!
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should not be duplicated" do
|
57
|
+
@post.received_actions.count.should == 1
|
58
|
+
end
|
59
|
+
end
|
25
60
|
end
|
26
61
|
end
|
@@ -8,11 +8,12 @@ SocialStream.Video = (function(SS, $, undefined){
|
|
8
8
|
$(this).jPlayer("setMedia", {
|
9
9
|
webmv: $(this).closest(".video").find(".video-webm").attr("href"), // Defines the webm url
|
10
10
|
flv: $(this).closest(".video").find(".video-flv").attr("href") // Defines the flv url
|
11
|
+
mp4: $(this).closest(".video").find(".video-mp4").attr("href") // Defines the mp4 url
|
11
12
|
});
|
12
13
|
},
|
13
14
|
solution:"flash, html",
|
14
15
|
preload: "none",
|
15
|
-
supplied: "webmv, flv",
|
16
|
+
supplied: "webmv, flv, mp4",
|
16
17
|
swfPath: "<%= asset_path "" %>",
|
17
18
|
cssSelectorAncestor: "#" + $(this).closest(".video-full").attr("id")
|
18
19
|
})
|
@@ -11,6 +11,7 @@ class DocumentsController < ApplicationController
|
|
11
11
|
|
12
12
|
def index
|
13
13
|
super do |format|
|
14
|
+
format.json { render :json => collection.map{|a| a.activity_objects.first.document.to_json} }
|
14
15
|
if params[:no_layout].present?
|
15
16
|
format.html { render :action => :index, :layout => false }
|
16
17
|
else
|
@@ -21,6 +22,7 @@ class DocumentsController < ApplicationController
|
|
21
22
|
|
22
23
|
def create
|
23
24
|
super do |format|
|
25
|
+
format.json { render :json => resource }
|
24
26
|
format.all {redirect_to request.referer || home_path}
|
25
27
|
end
|
26
28
|
end
|
@@ -34,8 +36,9 @@ class DocumentsController < ApplicationController
|
|
34
36
|
|
35
37
|
def show
|
36
38
|
respond_to do |format|
|
39
|
+
format.json {render :json => resource }
|
37
40
|
format.html {render :action => :show}
|
38
|
-
format.
|
41
|
+
format.any {
|
39
42
|
path = resource.file.path(params[:style] || params[:format])
|
40
43
|
|
41
44
|
send_file path,
|
@@ -68,6 +68,16 @@ class Document < ActiveRecord::Base
|
|
68
68
|
"#{ size.to_s }/default.png"
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
# JSON, generic version for most documents
|
73
|
+
def to_json me=self
|
74
|
+
{:id => activity_object_id,
|
75
|
+
:title => title,
|
76
|
+
:description => description,
|
77
|
+
:author => author.name,
|
78
|
+
:src => file.to_s
|
79
|
+
}.to_json
|
80
|
+
end
|
71
81
|
|
72
82
|
protected
|
73
83
|
|
@@ -4,7 +4,9 @@ class Video < Document
|
|
4
4
|
:path => ':rails_root/documents/:class/:id_partition/:style',
|
5
5
|
:styles => {
|
6
6
|
:webm => {:format => 'webm'},
|
7
|
-
:flv => {
|
7
|
+
:flv => {:format => 'flv'},
|
8
|
+
:mp4 => {:format => 'mp4'},
|
9
|
+
:poster => {:format => 'png', :time => 5},
|
8
10
|
:thumb48sq => {:geometry => "48x48" , :format => 'png', :time => 5},
|
9
11
|
:thumbwall => {:geometry => "130x97#", :format => 'png', :time => 5}
|
10
12
|
},
|
@@ -25,5 +27,19 @@ class Video < Document
|
|
25
27
|
def thumb(size, helper)
|
26
28
|
"#{ size.to_s }/video.png"
|
27
29
|
end
|
30
|
+
|
31
|
+
# JSON, special edition for video files
|
32
|
+
def to_json me=self
|
33
|
+
{:id => activity_object_id,
|
34
|
+
:title => title,
|
35
|
+
:description => description,
|
36
|
+
:author => author.name,
|
37
|
+
:poster => file(:poster).to_s,
|
38
|
+
:sources => [ { :type => Mime::WEBM.to_s, :src => file(:webm).to_s },
|
39
|
+
{ :type => Mime::MP4.to_s, :src => file(:mp4).to_s },
|
40
|
+
{ :type => Mime::FLV.to_s, :src => file(:flv).to_s }
|
41
|
+
]
|
42
|
+
}.to_json
|
43
|
+
end
|
28
44
|
|
29
45
|
end
|
@@ -20,6 +20,7 @@
|
|
20
20
|
<div class="video-format-links">
|
21
21
|
<%= link_to "WebM", video_path(video, :format => :webm), :class => "video-webm" %>
|
22
22
|
<%= link_to "FLV", video_path(video, :format => :flv), :class => "video-flv" %>
|
23
|
+
<%= link_to "MP4", video_path(video, :format => :mp4), :class => "video-mp4" %>
|
23
24
|
</div>
|
24
25
|
</div>
|
25
26
|
|
@@ -54,11 +54,12 @@
|
|
54
54
|
$(this).jPlayer("setMedia", {
|
55
55
|
webmv: "<%= video_url(video, :format => 'webm' ) %>", // Defines the webm url
|
56
56
|
flv: "<%= video_url(video, :format => 'flv') %>"
|
57
|
+
mp4: "<%= video_url(video, :format => 'mp4') %>"
|
57
58
|
});
|
58
59
|
},
|
59
60
|
solution:"flash, html",
|
60
61
|
preload: "none",
|
61
|
-
supplied: "webmv, flv",
|
62
|
+
supplied: "webmv, flv, mp4",
|
62
63
|
swfPath: "assets",
|
63
64
|
cssSelectorAncestor: "#jp_interface_<%=video.id%>"
|
64
65
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class CreateSocialStreamDocuments < ActiveRecord::Migration
|
2
|
-
|
3
|
-
def
|
2
|
+
|
3
|
+
def change
|
4
4
|
create_table "documents", :force => true do |t|
|
5
5
|
t.string "type"
|
6
6
|
t.integer "activity_object_id"
|
@@ -9,16 +9,14 @@ class CreateSocialStreamDocuments < ActiveRecord::Migration
|
|
9
9
|
t.string "file_file_name"
|
10
10
|
t.string "file_content_type"
|
11
11
|
t.string "file_file_size"
|
12
|
+
t.boolean "file_processing"
|
13
|
+
t.string "title"
|
14
|
+
t.text "description"
|
12
15
|
end
|
13
|
-
|
14
|
-
add_index "documents", "activity_object_id"
|
16
|
+
|
17
|
+
add_index "documents", ["activity_object_id"], :name => "index_documents_on_activity_object_id"
|
18
|
+
|
15
19
|
add_foreign_key "documents", "activity_objects", :name => "documents_on_activity_object_id"
|
16
|
-
|
20
|
+
|
17
21
|
end
|
18
|
-
|
19
|
-
def self.down
|
20
|
-
remove_foreign_key "documents", :name => "documents_on_activity_object_id"
|
21
|
-
drop_table :documents
|
22
|
-
end
|
23
|
-
|
24
22
|
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.19.0')
|
16
16
|
s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
|
17
17
|
s.add_runtime_dependency('paperclip','= 2.4.5')
|
18
18
|
s.add_runtime_dependency('delayed_paperclip','2.4.5.1')
|
@@ -1,15 +1,19 @@
|
|
1
1
|
//= require jquery.tipsy
|
2
2
|
|
3
3
|
SocialStream.Calendar = (function(SS, $, undefined){
|
4
|
-
var elementRegExp = new RegExp('sidebar_day_(..?)_(..?)_(..?.?.?)');
|
5
4
|
var eventsPath;
|
6
5
|
|
7
|
-
var
|
8
|
-
return
|
6
|
+
var element = function(){
|
7
|
+
return $("#sidebar_calendar");
|
9
8
|
}
|
9
|
+
var eventElementRegExp = new RegExp('sidebar_day_(..?)_(..?)_(..?.?.?)');
|
10
10
|
|
11
|
-
var
|
12
|
-
|
11
|
+
var eventElementMatch = function(el){
|
12
|
+
return eventElementRegExp.exec(el.id);
|
13
|
+
}
|
14
|
+
|
15
|
+
var eventElementDate = function(el) {
|
16
|
+
var m = eventElementMatch(el);
|
13
17
|
|
14
18
|
if(m == null) return;
|
15
19
|
|
@@ -29,7 +33,7 @@ SocialStream.Calendar = (function(SS, $, undefined){
|
|
29
33
|
|
30
34
|
|
31
35
|
$('#sidebar_calendar td').each(function(index, domEl){
|
32
|
-
var d =
|
36
|
+
var d = eventElementDate(domEl)
|
33
37
|
|
34
38
|
if(d < now) $(domEl).addClass('past');
|
35
39
|
if(d.getMonth() != now.getMonth() && d > now) $(domEl).addClass('next_month');
|
@@ -71,11 +75,11 @@ SocialStream.Calendar = (function(SS, $, undefined){
|
|
71
75
|
}
|
72
76
|
|
73
77
|
var busyTipsy = function(){
|
74
|
-
var startDate =
|
78
|
+
var startDate = eventElementDate(this)
|
75
79
|
startDate.setHours(0);
|
76
80
|
startDate.setMinutes(0);
|
77
81
|
startDate.setSeconds(0);
|
78
|
-
var endDate =
|
82
|
+
var endDate = eventElementDate(this)
|
79
83
|
|
80
84
|
$.ajax({
|
81
85
|
dataType: "script",
|
@@ -92,7 +96,9 @@ SocialStream.Calendar = (function(SS, $, undefined){
|
|
92
96
|
}
|
93
97
|
|
94
98
|
return {
|
95
|
-
init: init
|
99
|
+
init: init,
|
100
|
+
element: element,
|
101
|
+
eventElement: eventElement
|
96
102
|
}
|
97
103
|
|
98
104
|
})(SocialStream, jQuery);
|
@@ -0,0 +1,31 @@
|
|
1
|
+
//= require social_stream.action
|
2
|
+
|
3
|
+
SocialStream.Events.Action = (function(SS, $, undefined){
|
4
|
+
var animateCalendar = function(action) {
|
5
|
+
if (action.activity_object.type != "Event") {
|
6
|
+
return;
|
7
|
+
}
|
8
|
+
|
9
|
+
if (!action.follow) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
|
13
|
+
var fromEl = SS.Action.followForms(action).closest(".event").find("time");
|
14
|
+
var fromDate = new Date(fromEl.attr('datetime'));
|
15
|
+
|
16
|
+
var toEl = SS.Calendar.eventElement(fromDate) || SS.Calendar.element;
|
17
|
+
|
18
|
+
if (action.follow.following) {
|
19
|
+
fromEl.effect("transfer", {to: toEl}, 1000);
|
20
|
+
toEl.addClass("busy");
|
21
|
+
} else {
|
22
|
+
toEl.effect("pulsate");
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
// SocialStream.Action.addUpdateCallback(animateCalendar);
|
27
|
+
|
28
|
+
return {
|
29
|
+
}
|
30
|
+
|
31
|
+
})(SocialStream, jQuery);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class CreateEvents < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table "events", :force => true do |t|
|
4
|
+
t.integer "activity_object_id"
|
5
|
+
t.string "title"
|
6
|
+
t.datetime "start_at"
|
7
|
+
t.datetime "end_at"
|
8
|
+
t.boolean "all_day"
|
9
|
+
t.datetime "created_at", :null => false
|
10
|
+
t.datetime "updated_at", :null => false
|
11
|
+
t.integer "room_id"
|
12
|
+
t.date "start_date"
|
13
|
+
t.date "end_date"
|
14
|
+
t.integer "frequency", :default => 0
|
15
|
+
t.integer "interval"
|
16
|
+
t.integer "days", :default => 0
|
17
|
+
t.integer "interval_flag", :default => 0
|
18
|
+
end
|
19
|
+
|
20
|
+
add_index "events", ["room_id"], :name => "index_events_on_room_id"
|
21
|
+
|
22
|
+
create_table "rooms", :force => true do |t|
|
23
|
+
t.integer "actor_id"
|
24
|
+
t.string "name"
|
25
|
+
t.datetime "created_at", :null => false
|
26
|
+
t.datetime "updated_at", :null => false
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index "rooms", ["actor_id"], :name => "index_rooms_on_actor_id"
|
30
|
+
|
31
|
+
add_foreign_key "events", "rooms", :name => "index_events_on_room_id"
|
32
|
+
end
|
33
|
+
end
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
|
14
14
|
# Gem dependencies
|
15
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.19.0')
|
16
16
|
s.add_runtime_dependency('rails-scheduler', '~> 0.0.8')
|
17
17
|
s.add_runtime_dependency('coffee-rails', '>= 3.1.0')
|
18
18
|
|
data/lib/tasks/migrations.rake
CHANGED
@@ -2,6 +2,8 @@ namespace :social_stream do
|
|
2
2
|
namespace :migrations do
|
3
3
|
desc "Copy pending migrations from all the social_stream components"
|
4
4
|
task "update" do
|
5
|
+
Rake::Task['railties:install:migrations'].reenable
|
6
|
+
Rake::Task['mailboxer_engine:install:migrations'].invoke
|
5
7
|
File.read(File.expand_path("../../../social_stream.gemspec", __FILE__)).
|
6
8
|
scan(/dependency.*social_stream-(\w*)/).
|
7
9
|
flatten.
|