social_stream 0.26.2 → 0.27.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.
- data/base/app/assets/images/btn/public.png +0 -0
- data/base/app/assets/images/btn/restricted.png +0 -0
- data/base/app/assets/javascripts/social_stream.timeline.js +2 -0
- data/base/app/assets/javascripts/social_stream.wall.js.erb +10 -1
- data/base/app/assets/stylesheets/activities.css.scss.erb +13 -2
- data/base/app/assets/stylesheets/base.css.scss +1 -1
- data/base/app/controllers/audience_controller.rb +16 -0
- data/base/app/models/activity.rb +111 -39
- data/base/app/models/activity_object.rb +1 -9
- data/base/app/models/actor.rb +42 -53
- data/base/app/models/contact.rb +0 -21
- data/base/app/models/tie.rb +1 -1
- data/base/app/views/activities/_new.html.erb +2 -2
- data/base/app/views/activities/_options.html.erb +7 -1
- data/base/app/views/audience/_list.html.erb +8 -0
- data/base/app/views/audience/index.js.erb +1 -0
- data/base/config/locales/en.yml +1 -0
- data/base/config/locales/es.yml +1 -0
- data/base/config/routes.rb +2 -0
- data/base/db/migrate/20120526171311_remove_activity_channels.rb +35 -0
- data/base/lib/social_stream-base.rb +0 -1
- data/base/lib/social_stream/ability/base.rb +3 -1
- data/base/lib/social_stream/base/engine.rb +0 -1
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/tasks/db/populate.rake +6 -4
- data/base/spec/controllers/audience_controller_spec.rb +40 -0
- data/base/spec/controllers/comments_controller_spec.rb +3 -3
- data/base/spec/factories/activity.rb +12 -6
- data/base/spec/models/tie_spec.rb +7 -4
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/social_stream-documents.gemspec +1 -1
- data/events/app/assets/stylesheets/events.css.scss +3 -8
- data/events/app/views/events/_event.html.erb +5 -2
- data/events/config/locales/en.yml +1 -0
- data/events/config/locales/es.yml +1 -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/linkser/lib/social_stream/linkser/version.rb +1 -1
- 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 +19 -15
- data/base/app/assets/images/btn/btn_security.png +0 -0
- data/base/app/models/channel.rb +0 -64
- data/base/lib/social_stream/models/channeled.rb +0 -56
data/base/app/models/contact.rb
CHANGED
@@ -164,27 +164,6 @@ class Contact < ActiveRecord::Base
|
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
167
|
-
# The related {Channel} to this {Contact}.
|
168
|
-
#
|
169
|
-
# If the sender of this {Contact} is a user, the {Channel} is defined. If it is
|
170
|
-
# other kind of {SocialStream::Models::Subject}, the {Channel#user_author} must
|
171
|
-
# be provided.
|
172
|
-
def channel(user = nil)
|
173
|
-
user_id =
|
174
|
-
if sender.subject_type == "User"
|
175
|
-
sender_id
|
176
|
-
elsif user.present? && Actor.normalize(user).subject_type == "User"
|
177
|
-
Actor.normalize_id(user)
|
178
|
-
else
|
179
|
-
raise "Invalid channel user_author: #{ user.inspect }"
|
180
|
-
end
|
181
|
-
|
182
|
-
Channel.
|
183
|
-
find_or_create_by_author_id_and_user_author_id_and_owner_id sender_id,
|
184
|
-
user_id,
|
185
|
-
receiver_id
|
186
|
-
end
|
187
|
-
|
188
167
|
private
|
189
168
|
|
190
169
|
def build_user_author
|
data/base/app/models/tie.rb
CHANGED
@@ -146,7 +146,7 @@ class Tie < ActiveRecord::Base
|
|
146
146
|
Activity.create! :author => contact.sender,
|
147
147
|
:user_author => contact.user_author,
|
148
148
|
:owner => contact.receiver,
|
149
|
-
:relation_ids => contact.
|
149
|
+
:relation_ids => contact.receiver.activity_relation_ids,
|
150
150
|
:activity_verb => ActivityVerb[contact.verb]
|
151
151
|
end
|
152
152
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<%= javascript_tag do %>
|
22
22
|
var relation_public = <%= Relation::Public.instance.id %>;
|
23
23
|
var public_selected = false;
|
24
|
-
var relation_options = <%= escape_javascript(current_subject.
|
24
|
+
var relation_options = <%= escape_javascript(current_subject.activity_relations_for(receiver).sort.map{ |r| r.id }.to_json) %>;
|
25
25
|
var relation_public_pos = 0;
|
26
26
|
for(id in relation_options){
|
27
27
|
if(relation_options[id]==relation_public){
|
@@ -32,7 +32,7 @@
|
|
32
32
|
}
|
33
33
|
//For security with check "var default_security_width = '100px';" in activities.js.erb
|
34
34
|
<% end %>
|
35
|
-
<%= select_tag :relation_ids, options_for_select(current_subject.
|
35
|
+
<%= select_tag :relation_ids, options_for_select(current_subject.activity_relations_for(receiver).sort.map{ |r| [ r.name, r.id ] }), :id => 'security', :multiple => true, :title => t("activity.privacy.myself.contacts.#{ receiver.class.to_s.underscore }") %>
|
36
36
|
<% else %>
|
37
37
|
<div id="security_chzn" class="chzn-container chzn-container-multi">
|
38
38
|
<ul class="chzn-choices">
|
@@ -8,11 +8,17 @@
|
|
8
8
|
|
9
9
|
<% if user_signed_in? %>
|
10
10
|
·
|
11
|
-
<%= link_to activity.audience_in_words(current_subject, :details => :summary),
|
11
|
+
<%= link_to image_tag("btn/#{ activity.public? ? 'public' : 'restricted' }.png", :class => 'menu_icon') + activity.audience_in_words(current_subject, :details => :summary),
|
12
12
|
'javascript:;',
|
13
13
|
:class => 'activity_audience_summary' %>
|
14
14
|
<div class="activity_audience">
|
15
15
|
<%= activity.audience_in_words(current_subject) %>
|
16
|
+
<% unless activity.public? %>
|
17
|
+
·
|
18
|
+
<%= link_to t('activity.audience.show'), audience_path(:activity_id => activity.id), :remote => true %>
|
19
|
+
<div class="activity-audience-list-<%= activity.id %>">
|
20
|
+
</div>
|
21
|
+
<% end %>
|
16
22
|
</div>
|
17
23
|
<% end %>
|
18
24
|
|
@@ -0,0 +1 @@
|
|
1
|
+
$('.activity-audience-list-<%= @activity.id %>').html('<%= j render(:partial => 'list') %>');
|
data/base/config/locales/en.yml
CHANGED
data/base/config/locales/es.yml
CHANGED
data/base/config/routes.rb
CHANGED
@@ -86,6 +86,8 @@ Rails.application.routes.draw do
|
|
86
86
|
resources :activities do
|
87
87
|
resource :like
|
88
88
|
end
|
89
|
+
|
90
|
+
get 'audience/index', :as => :audience
|
89
91
|
|
90
92
|
match 'cheesecake' => 'cheesecake#index', :as => :cheesecake
|
91
93
|
match 'update_cheesecake' => 'cheesecake#update', :as => :update_cheesecake
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class RemoveActivityChannels < ActiveRecord::Migration
|
2
|
+
class Channel < ActiveRecord::Base; end
|
3
|
+
|
4
|
+
def up
|
5
|
+
change_table :activities do |t|
|
6
|
+
t.references :author
|
7
|
+
t.references :user_author
|
8
|
+
t.references :owner
|
9
|
+
end
|
10
|
+
|
11
|
+
Activity.record_timestamps = false
|
12
|
+
Activity.reset_column_information
|
13
|
+
|
14
|
+
Activity.all.each do |a|
|
15
|
+
c = Channel.find a.channel_id
|
16
|
+
%w{ author_id user_author_id owner_id }.each do |m|
|
17
|
+
a.__send__ "#{ m }=", c.__send__(m) # a.author_id = c.author_id
|
18
|
+
end
|
19
|
+
a.save!
|
20
|
+
end
|
21
|
+
|
22
|
+
Activity.record_timestamps = true
|
23
|
+
|
24
|
+
remove_foreign_key :activities, :name => 'index_activities_on_channel_id'
|
25
|
+
remove_column :activities, :channel_id
|
26
|
+
|
27
|
+
Activity.reset_column_information
|
28
|
+
|
29
|
+
drop_table :channels
|
30
|
+
end
|
31
|
+
|
32
|
+
def down
|
33
|
+
raise ActiveRecord::IrreversibleMigration
|
34
|
+
end
|
35
|
+
end
|
@@ -20,7 +20,6 @@ module SocialStream
|
|
20
20
|
|
21
21
|
initializer "social_stream-base.model.supertypes" do
|
22
22
|
ActiveSupport.on_load(:active_record) do
|
23
|
-
include SocialStream::Models::Channeled::ActiveRecord
|
24
23
|
include SocialStream::Models::Subtype::ActiveRecord
|
25
24
|
include SocialStream::Models::Supertype::ActiveRecord
|
26
25
|
end
|
@@ -112,14 +112,16 @@ namespace :db do
|
|
112
112
|
ties_start = Time.now
|
113
113
|
|
114
114
|
@available_actors.each do |a|
|
115
|
-
actors = @available_actors.dup
|
116
|
-
|
117
|
-
|
115
|
+
actors = @available_actors.dup
|
116
|
+
actors.delete(a)
|
117
|
+
|
118
|
+
relations = a.relation_customs + [ Relation::Reject.instance ]
|
119
|
+
|
118
120
|
Forgery::Basic.number(:at_most => actors.size).times do
|
119
121
|
actor = actors.delete_at((rand * actors.size).to_i)
|
120
122
|
contact = a.contact_to!(actor)
|
121
123
|
contact.user_author = a.user_author if a.subject_type != "User"
|
122
|
-
contact.relation_ids =
|
124
|
+
contact.relation_ids = [ Forgery::Extensions::Array.new(relations).random.id ]
|
123
125
|
end
|
124
126
|
end
|
125
127
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AudienceController do
|
4
|
+
include SocialStream::TestHelpers
|
5
|
+
include SocialStream::TestHelpers::Controllers
|
6
|
+
|
7
|
+
render_views
|
8
|
+
|
9
|
+
context "with activity" do
|
10
|
+
before :all do
|
11
|
+
@activity = Factory(:activity)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should not be redered to public" do
|
15
|
+
get :index, :activity_id => @activity.id, :format => :js
|
16
|
+
|
17
|
+
response.should redirect_to(:new_user_session)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should not be rendered to anyone" do
|
21
|
+
sign_in Factory(:user)
|
22
|
+
|
23
|
+
begin
|
24
|
+
get :index, :activity_id => @activity.id, :format => :js
|
25
|
+
|
26
|
+
assert false
|
27
|
+
rescue CanCan::AccessDenied
|
28
|
+
assert true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should not be rendered to author" do
|
33
|
+
sign_in @activity.author_subject
|
34
|
+
|
35
|
+
get :index, :activity_id => @activity.id, :format => :js
|
36
|
+
|
37
|
+
response.should be_success
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -13,7 +13,7 @@ describe CommentsController do
|
|
13
13
|
|
14
14
|
describe "comment from user" do
|
15
15
|
before do
|
16
|
-
activity = Factory(:self_activity, :
|
16
|
+
activity = Factory(:self_activity, :author => @user.actor)
|
17
17
|
|
18
18
|
model_attributes[:author_id] = @user.actor_id
|
19
19
|
model_attributes[:owner_id] = @user.actor_id
|
@@ -38,7 +38,7 @@ describe CommentsController do
|
|
38
38
|
describe "comment to friend" do
|
39
39
|
before do
|
40
40
|
f = Factory(:friend, :contact => Factory(:contact, :receiver => @user.actor)).sender
|
41
|
-
activity = Factory(:self_activity, :
|
41
|
+
activity = Factory(:self_activity, :author => f)
|
42
42
|
|
43
43
|
model_attributes[:author_id] = @user.actor_id
|
44
44
|
model_attributes[:owner_id] = f.id
|
@@ -52,7 +52,7 @@ describe CommentsController do
|
|
52
52
|
describe "post to acquaintance" do
|
53
53
|
before do
|
54
54
|
a = Factory(:acquaintance, :contact => Factory(:contact, :receiver => @user.actor)).sender
|
55
|
-
activity = Factory(:self_activity, :
|
55
|
+
activity = Factory(:self_activity, :author => a)
|
56
56
|
|
57
57
|
model_attributes[:author_id] = @user.actor_id
|
58
58
|
model_attributes[:owner_id] = a.id
|
@@ -23,9 +23,11 @@ end
|
|
23
23
|
## End of helpers
|
24
24
|
|
25
25
|
Factory.define :activity do |a|
|
26
|
-
a.
|
26
|
+
a.author { Factory(:user).actor }
|
27
|
+
a.user_author { |b| b.author }
|
28
|
+
a.owner { |b| Factory(:friend, :contact => Factory(:contact, :receiver => b.author)).sender }
|
27
29
|
a.activity_verb { ActivityVerb["post"] }
|
28
|
-
a.relation_ids { |b|
|
30
|
+
a.relation_ids { |b| [ b.owner.relation_custom('friend').id ] }
|
29
31
|
a.activity_object_ids { |b|
|
30
32
|
# Create post
|
31
33
|
post = Factory(:post,
|
@@ -40,8 +42,10 @@ Factory.define :activity do |a|
|
|
40
42
|
end
|
41
43
|
|
42
44
|
Factory.define :self_activity, :parent => :activity do |a|
|
43
|
-
a.
|
44
|
-
a.
|
45
|
+
a.author { Factory(:user).actor }
|
46
|
+
a.user_author { |b| b.author }
|
47
|
+
a.owner { |b| b.author }
|
48
|
+
a.relation_ids { |b| [ b.author.relation_custom('friend').id ] }
|
45
49
|
a.activity_object_ids { |b|
|
46
50
|
# Create post
|
47
51
|
post = Factory(:post,
|
@@ -63,10 +67,12 @@ end
|
|
63
67
|
|
64
68
|
Factory.define :like_activity, :class => 'Activity' do |a|
|
65
69
|
a.association :parent, :factory => :activity
|
66
|
-
a.
|
70
|
+
a.author { |b| Factory(:friend, :sender => b.parent.owner).receiver }
|
71
|
+
a.user_author { |b| b.author }
|
72
|
+
a.owner { |b| b.parent.owner }
|
67
73
|
a.activity_verb { ActivityVerb["like"] }
|
68
74
|
a.relation_ids { |b| b.parent.relation_ids }
|
69
|
-
a.after_build{ |b| b.activity_object_ids = b.parent.activity_object_ids }
|
75
|
+
a.after_build { |b| b.activity_object_ids = b.parent.activity_object_ids }
|
70
76
|
end
|
71
77
|
|
72
78
|
|
@@ -41,8 +41,9 @@ describe Tie do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should create activity with follow verb" do
|
44
|
-
@tie.
|
45
|
-
|
44
|
+
activity = Activity.authored_by(@tie.sender).owned_by(@tie.receiver).first
|
45
|
+
activity.should be_present
|
46
|
+
activity.verb.should eq('follow')
|
46
47
|
end
|
47
48
|
|
48
49
|
context "reciprocal" do
|
@@ -51,8 +52,10 @@ describe Tie do
|
|
51
52
|
end
|
52
53
|
|
53
54
|
it "should create activity with make-friend verb" do
|
54
|
-
@reciprocal.
|
55
|
-
|
55
|
+
activity = Activity.authored_by(@reciprocal.sender).owned_by(@reciprocal.receiver).first
|
56
|
+
|
57
|
+
activity.should be_present
|
58
|
+
activity.verb.should eq('make-friend')
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
@@ -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.21.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')
|
@@ -14,20 +14,15 @@
|
|
14
14
|
float: left;
|
15
15
|
font-weight: bold;
|
16
16
|
text-align: center;
|
17
|
-
|
18
|
-
padding: 10px;
|
19
|
-
width: 40px;
|
17
|
+
width: 45px;
|
20
18
|
}
|
21
19
|
|
22
|
-
|
23
20
|
a.event_date {
|
24
21
|
color: $details-color;
|
25
22
|
}
|
26
23
|
|
27
24
|
div.event_date {
|
28
|
-
|
29
|
-
margin-right: 7px;
|
30
|
-
width: 64px;
|
25
|
+
margin-top: 25px;
|
31
26
|
}
|
32
27
|
|
33
28
|
.event_day {
|
@@ -60,7 +55,7 @@ div.event_date {
|
|
60
55
|
.event_poster {
|
61
56
|
width: 80px;
|
62
57
|
height: 113px;
|
63
|
-
margin-
|
58
|
+
margin-left: 5px;
|
64
59
|
float: left;
|
65
60
|
position: relative;
|
66
61
|
}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
<%= div_for event do %>
|
2
2
|
|
3
|
-
|
3
|
+
<div class="timeline-130">
|
4
|
+
<%= render :partial => "events/event_date", :locals => { :event => event } %>
|
4
5
|
|
5
|
-
|
6
|
+
<%= render :partial => "events/event_poster", :locals => { :event => event } %>
|
7
|
+
|
8
|
+
</div>
|
6
9
|
|
7
10
|
<%= render :partial => "events/event_details", :locals => { :event => event } %>
|
8
11
|
<% end %>
|