social_stream-base 0.21.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
data/app/models/activity.rb
CHANGED
@@ -70,59 +70,6 @@ class Activity < ActiveRecord::Base
|
|
70
70
|
merge(Audience.where(:relation_id => Relation.ids_shared_with(subject)))
|
71
71
|
}
|
72
72
|
|
73
|
-
scope :wall, lambda { |args|
|
74
|
-
q =
|
75
|
-
select("DISTINCT activities.*").
|
76
|
-
joins(:audiences).
|
77
|
-
joins(:relations).
|
78
|
-
roots
|
79
|
-
|
80
|
-
if args[:object_type].present?
|
81
|
-
q = q.joins(:activity_objects).
|
82
|
-
where('activity_objects.object_type' => args[:object_type])
|
83
|
-
end
|
84
|
-
|
85
|
-
audiences = Audience.arel_table
|
86
|
-
relations = Relation.arel_table
|
87
|
-
|
88
|
-
owner_conditions =
|
89
|
-
arel_table[:author_id].eq(Actor.normalize_id(args[:owner])).
|
90
|
-
or(arel_table[:user_author_id].eq(Actor.normalize_id(args[:owner]))).
|
91
|
-
or(arel_table[:owner_id].eq(Actor.normalize_id(args[:owner])))
|
92
|
-
|
93
|
-
audience_conditions =
|
94
|
-
audiences[:relation_id].in(args[:relation_ids]).
|
95
|
-
or(relations[:type].eq('Relation::Public'))
|
96
|
-
|
97
|
-
conds =
|
98
|
-
case args[:type]
|
99
|
-
when :home
|
100
|
-
followed_conditions =
|
101
|
-
arel_table[:author_id].in(args[:followed]).
|
102
|
-
or(arel_table[:owner_id].in(args[:followed]))
|
103
|
-
|
104
|
-
owner_conditions.
|
105
|
-
or(followed_conditions.and(audience_conditions))
|
106
|
-
when :profile
|
107
|
-
if args[:for].present?
|
108
|
-
visitor_conditions =
|
109
|
-
arel_table[:author_id].eq(Actor.normalize_id(args[:for])).
|
110
|
-
or(arel_table[:owner_id].eq(Actor.normalize_id(args[:for])))
|
111
|
-
|
112
|
-
owner_conditions.
|
113
|
-
and(visitor_conditions.or(audience_conditions))
|
114
|
-
else
|
115
|
-
owner_conditions.
|
116
|
-
and(audience_conditions)
|
117
|
-
end
|
118
|
-
else
|
119
|
-
raise "Unknown wall type: #{ args[:type] }"
|
120
|
-
end
|
121
|
-
|
122
|
-
q.where(conds).
|
123
|
-
order("created_at desc")
|
124
|
-
}
|
125
|
-
|
126
73
|
after_create :increment_like_count
|
127
74
|
after_destroy :decrement_like_count, :delete_notifications
|
128
75
|
|
data/app/models/relation.rb
CHANGED
@@ -55,6 +55,8 @@ class Relation < ActiveRecord::Base
|
|
55
55
|
has_many :audiences, :dependent => :destroy
|
56
56
|
has_many :activities, :through => :audiences
|
57
57
|
|
58
|
+
has_many :activity_object_audiences, :dependent => :destroy
|
59
|
+
|
58
60
|
scope :actor, lambda { |a|
|
59
61
|
where(:actor_id => Actor.normalize_id(a))
|
60
62
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @profile.valid? %>
|
2
2
|
<% flash[:notice] = t('profile.update.success') %>
|
3
|
-
document.location.href="<%=
|
3
|
+
document.location.href="<%= polymorphic_path([ current_subject, :profile ]) %>";
|
4
4
|
<% else %>
|
5
5
|
if ($("#profile_notice").length == 0){
|
6
6
|
$("#profile_form").prepend('<div id="profile_notice" class="notice"></div>');
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -38,6 +38,13 @@ describe ProfilesController do
|
|
38
38
|
response.should redirect_to([@user, :profile])
|
39
39
|
end
|
40
40
|
|
41
|
+
it "should update via AJAX" do
|
42
|
+
put :update, :user_id => @user.to_param, :profile => { :organization => "Social Stream" }, :format => :js
|
43
|
+
|
44
|
+
response.should be_success
|
45
|
+
end
|
46
|
+
|
47
|
+
|
41
48
|
it "should not update other's" do
|
42
49
|
begin
|
43
50
|
put :update, :user_id => Factory(:user).to_param, :profile => { :organization => "Social Stream" }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.21.
|
4
|
+
version: 0.21.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-06-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: deep_merge
|