social_stream-base 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
data/app/models/actor.rb
CHANGED
@@ -162,6 +162,8 @@ class Actor < ActiveRecord::Base
|
|
162
162
|
receivers = group.contact_actors(:direction => :sent, :relations => relation)
|
163
163
|
emails = Array.new
|
164
164
|
receivers.each do |receiver|
|
165
|
+
next unless Actor.normalize(receiver).subject_type.eql?("User")
|
166
|
+
|
165
167
|
receiver_emails = receiver.mailboxer_email(object)
|
166
168
|
case receiver_emails
|
167
169
|
when String
|
@@ -11,15 +11,21 @@ module SocialStream
|
|
11
11
|
load_and_authorize_resource :except => :index
|
12
12
|
|
13
13
|
respond_to :html, :js
|
14
|
-
end
|
15
14
|
|
16
|
-
|
15
|
+
# destroy method must be before the one provided by inherited_resources
|
16
|
+
include SocialStream::Controllers::Objects::UpperInstanceMethods
|
17
|
+
end
|
17
18
|
|
19
|
+
# Methods that should be included after the included block
|
20
|
+
module UpperInstanceMethods
|
18
21
|
def destroy
|
19
22
|
@post_activity = resource.post_activity
|
20
23
|
|
21
24
|
destroy!
|
22
25
|
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module InstanceMethods
|
23
29
|
|
24
30
|
protected
|
25
31
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GroupsController do
|
4
|
+
include SocialStream::TestHelpers
|
4
5
|
include SocialStream::TestHelpers::Controllers
|
5
6
|
|
6
7
|
render_views
|
@@ -76,14 +77,9 @@ describe GroupsController do
|
|
76
77
|
end
|
77
78
|
|
78
79
|
context "a new own group" do
|
79
|
-
before do
|
80
|
-
model_attributes[:author_id] = @user.actor_id
|
81
|
-
model_attributes[:user_author_id] = @user.actor_id
|
82
|
-
end
|
83
|
-
|
84
80
|
it "should allow creating" do
|
85
81
|
count = Group.count
|
86
|
-
post :create,
|
82
|
+
post :create, :group => { :name => "Test" }
|
87
83
|
|
88
84
|
group = assigns(:group)
|
89
85
|
|
@@ -97,13 +93,13 @@ describe GroupsController do
|
|
97
93
|
before do
|
98
94
|
@user_participant = Factory(:user)
|
99
95
|
@group_participant = Factory(:group)
|
100
|
-
|
101
|
-
model_attributes[:_participants] = [@user_participant.actor_id, @group_participant.actor_id]
|
102
96
|
end
|
103
97
|
|
104
98
|
it "should allow creating" do
|
105
99
|
count = Group.count
|
106
|
-
post :create,
|
100
|
+
post :create,
|
101
|
+
:group => { :name => "Test group",
|
102
|
+
:_participants => [ @user_participant.actor_id, @group_participant.actor_id ] }
|
107
103
|
|
108
104
|
group = assigns(:group)
|
109
105
|
|
@@ -119,7 +115,7 @@ describe GroupsController do
|
|
119
115
|
group.contact_subjects(:direction => :received)
|
120
116
|
response.should redirect_to(:home)
|
121
117
|
end
|
122
|
-
|
118
|
+
end
|
123
119
|
end
|
124
120
|
|
125
121
|
context "a new fake group" do
|
@@ -158,6 +154,25 @@ describe GroupsController do
|
|
158
154
|
# it_should_behave_like "Allow Updating"
|
159
155
|
it_should_behave_like "Allow Destroying"
|
160
156
|
end
|
157
|
+
|
158
|
+
context "representing a group" do
|
159
|
+
before do
|
160
|
+
@group = Factory(:member, :contact => Factory(:group_contact, :receiver => @user.actor)).sender_subject
|
161
|
+
represent(@group)
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should allow creating" do
|
165
|
+
count = Group.count
|
166
|
+
post :create, :group => { :name => "Test" }
|
167
|
+
|
168
|
+
group = assigns(:group)
|
169
|
+
|
170
|
+
group.should be_valid
|
171
|
+
Group.count.should eq(count + 1)
|
172
|
+
assigns(:current_subject).should eq(group)
|
173
|
+
response.should redirect_to(:home)
|
174
|
+
end
|
175
|
+
end
|
161
176
|
end
|
162
177
|
end
|
163
178
|
|
@@ -26,6 +26,15 @@ describe PostsController do
|
|
26
26
|
|
27
27
|
it_should_behave_like "Allow Creating"
|
28
28
|
it_should_behave_like "Allow Destroying"
|
29
|
+
|
30
|
+
it "should destroy with js" do
|
31
|
+
count = model_count
|
32
|
+
delete :destroy, :id => @current_model.to_param, :format => :js
|
33
|
+
|
34
|
+
resource = assigns(model_sym)
|
35
|
+
|
36
|
+
model_count.should eq(count - 1)
|
37
|
+
end
|
29
38
|
end
|
30
39
|
|
31
40
|
describe "with last relation" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 49
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 10
|
9
|
-
-
|
10
|
-
version: 0.10.
|
9
|
+
- 3
|
10
|
+
version: 0.10.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- GING - DIT - UPM
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-12-
|
19
|
+
date: 2011-12-02 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|