social_stream 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +5 -1
  3. data/README.rdoc +2 -2
  4. data/app/controllers/api_controller.rb +2 -1
  5. data/app/controllers/contacts_controller.rb +25 -2
  6. data/app/controllers/groups_controller.rb +12 -2
  7. data/app/controllers/notifications_controller.rb +72 -0
  8. data/app/controllers/permissions_controller.rb +10 -0
  9. data/app/controllers/relation/customs_controller.rb +8 -0
  10. data/app/controllers/spheres_controller.rb +12 -0
  11. data/app/helpers/contacts_helper.rb +24 -0
  12. data/app/helpers/location_helper.rb +26 -12
  13. data/app/helpers/notifications_helper.rb +23 -0
  14. data/app/helpers/permissions_helper.rb +16 -0
  15. data/app/helpers/profiles_helper.rb +31 -0
  16. data/app/helpers/subjects_helper.rb +0 -83
  17. data/app/helpers/toolbar_helper.rb +83 -0
  18. data/app/models/activity.rb +43 -36
  19. data/app/models/actor.rb +71 -14
  20. data/app/models/contact.rb +121 -0
  21. data/app/models/group.rb +3 -3
  22. data/app/models/permission.rb +33 -2
  23. data/app/models/relation.rb +1 -1
  24. data/app/models/relation/custom.rb +12 -1
  25. data/app/models/relation/public.rb +1 -1
  26. data/app/models/sphere.rb +3 -1
  27. data/app/models/tie.rb +35 -18
  28. data/app/views/activities/_walls.html.erb +2 -2
  29. data/app/views/api/activity_atom_feed.atom.builder +38 -38
  30. data/app/views/avatars/index.html.erb +12 -40
  31. data/app/views/comments/_new.html.erb +9 -8
  32. data/app/views/contacts/_contact.html.erb +20 -0
  33. data/app/views/contacts/_edit.html.erb +76 -0
  34. data/app/views/contacts/_form.html.erb +72 -0
  35. data/app/views/contacts/_index.html.erb +1 -1
  36. data/app/views/{ties → contacts}/_pendings.html.erb +3 -3
  37. data/app/views/{ties → contacts}/_suggestions.html.erb +5 -5
  38. data/app/views/contacts/_suggestions_and_pendings.html.erb +6 -0
  39. data/app/views/contacts/edit.html.erb +5 -0
  40. data/app/views/contacts/index.html.erb +1 -1
  41. data/app/views/contacts/new.html.erb +5 -0
  42. data/app/views/conversations/_conversation.html.erb +1 -1
  43. data/app/views/conversations/_index.html.erb +0 -5
  44. data/app/views/conversations/_show.html.erb +1 -2
  45. data/app/views/conversations/index.html.erb +4 -0
  46. data/app/views/conversations/index.js.erb +1 -0
  47. data/app/views/frontpage/index.html.erb +2 -3
  48. data/app/views/groups/_index.html.erb +5 -1
  49. data/app/views/groups/_new.html.erb +4 -3
  50. data/app/views/groups/_sidebar_index.html.erb +3 -10
  51. data/app/views/groups/_sidebar_show.html.erb +1 -9
  52. data/app/views/groups/index.html.erb +6 -8
  53. data/app/views/groups/show.html.erb +11 -4
  54. data/app/views/home/_sidebar.html.erb +1 -15
  55. data/app/views/home/index.html.erb +3 -2
  56. data/app/views/layouts/_account.html.erb +1 -1
  57. data/app/views/layouts/_flash.html.erb +5 -0
  58. data/app/views/layouts/_footer.html.erb +5 -4
  59. data/app/views/layouts/_representation.html.erb +5 -12
  60. data/app/views/layouts/application.html.erb +23 -20
  61. data/app/views/layouts/frontpage.html.erb +22 -10
  62. data/app/views/location/_location.html.erb +1 -1
  63. data/app/views/messages/_new.html.erb +0 -2
  64. data/app/views/notification_mailer/new_notification_email.html.erb +21 -0
  65. data/app/views/notification_mailer/new_notification_email.text.erb +11 -0
  66. data/app/views/notifications/_index.html.erb +21 -0
  67. data/app/views/notifications/_notification.html.erb +47 -0
  68. data/app/views/notifications/_show.html.erb +3 -0
  69. data/app/views/notifications/activities/_follow_body.html.erb +2 -0
  70. data/app/views/notifications/activities/_follow_subject.html.erb +2 -0
  71. data/app/views/notifications/activities/_like_body.html.erb +5 -0
  72. data/app/views/notifications/activities/_like_object_body.html.erb +2 -0
  73. data/app/views/notifications/activities/_like_object_subject.html.erb +2 -0
  74. data/app/views/notifications/activities/_like_subject.html.erb +5 -0
  75. data/app/views/notifications/activities/_like_subject_body.html.erb +1 -0
  76. data/app/views/notifications/activities/_like_subject_subject.html.erb +2 -0
  77. data/app/views/notifications/activities/_make-friend_body.html.erb +3 -0
  78. data/app/views/notifications/activities/_make-friend_subject.html.erb +2 -0
  79. data/app/views/notifications/activities/_post_body.html.erb +2 -0
  80. data/app/views/notifications/activities/_post_subject.html.erb +1 -0
  81. data/app/views/notifications/activities/_update_body.html.erb +1 -0
  82. data/app/views/notifications/activities/_update_subject.html.erb +1 -0
  83. data/app/views/notifications/index.html.erb +19 -0
  84. data/app/views/notifications/index.js.erb +8 -0
  85. data/app/views/notifications/show.html.erb +5 -0
  86. data/app/views/permissions/_index.html.erb +39 -0
  87. data/app/views/permissions/index.js.erb +10 -0
  88. data/app/views/profiles/_contact.html.erb +81 -0
  89. data/app/views/profiles/_experience.html.erb +22 -0
  90. data/app/views/profiles/_personal.html.erb +74 -0
  91. data/app/views/profiles/_profile.html.erb +12 -181
  92. data/app/views/profiles/_tags.html.erb +22 -0
  93. data/app/views/profiles/edit.html.erb +0 -14
  94. data/app/views/profiles/show.html.erb +14 -0
  95. data/app/views/profiles/update.js.erb +2 -28
  96. data/app/views/relation/customs/_form.html.erb +29 -0
  97. data/app/views/relation/customs/_index.html.erb +30 -0
  98. data/app/views/relation/customs/_list.html.erb +36 -0
  99. data/app/views/relation/customs/create.js.erb +20 -0
  100. data/app/views/relation/customs/index.js.erb +2 -0
  101. data/app/views/relation/customs/update.js.erb +6 -0
  102. data/app/views/spheres/_form.html.erb +28 -0
  103. data/app/views/spheres/_jquery.erb +130 -0
  104. data/app/views/spheres/_list.html.erb +19 -0
  105. data/app/views/spheres/create.js.erb +20 -0
  106. data/app/views/spheres/index.html.erb +74 -0
  107. data/app/views/ties/_edit.html.erb +1 -33
  108. data/app/views/toolbar/_home.html.erb +9 -0
  109. data/app/views/{subjects/_toolbar_home_menu.html.erb → toolbar/_home_menu.html.erb} +1 -1
  110. data/app/views/{subjects/_toolbar_home_menu_options.html.erb → toolbar/_home_menu_options.html.erb} +7 -3
  111. data/app/views/{subjects/_toolbar_home_menu_options_subjects.html.erb → toolbar/_home_menu_options_subjects.html.erb} +0 -0
  112. data/app/views/{subjects/_toolbar_logo.html.erb → toolbar/_logo.html.erb} +1 -1
  113. data/app/views/{subjects/_toolbar_message_menu.html.erb → toolbar/_message_menu.html.erb} +0 -0
  114. data/app/views/toolbar/_notifications_menu.html.erb +3 -0
  115. data/app/views/{subjects/_toolbar_profile.html.erb → toolbar/_profile.html.erb} +2 -2
  116. data/app/views/toolbar/_profile_menu.html.erb +15 -0
  117. data/app/views/toolbar/_profile_menu_basic_options.html.erb +5 -0
  118. data/app/views/toolbar/_profile_menu_tie_options.html.erb +35 -0
  119. data/app/views/users/_index.html.erb +1 -1
  120. data/app/views/users/_sidebar_index.html.erb +1 -6
  121. data/app/views/users/index.html.erb +3 -3
  122. data/app/views/users/show.html.erb +12 -2
  123. data/config/locales/en.yml +106 -79
  124. data/config/routes.rb +19 -5
  125. data/lib/generators/social_stream/templates/initializer.rb +2 -2
  126. data/lib/generators/social_stream/templates/migration.rb +3 -1
  127. data/lib/generators/social_stream/templates/public/images/HTML5.png +0 -0
  128. data/lib/generators/social_stream/templates/public/images/HTML5_Semantics.png +0 -0
  129. data/lib/generators/social_stream/templates/public/images/HTML5_Styling.png +0 -0
  130. data/lib/generators/social_stream/templates/public/images/Jcrop.gif +0 -0
  131. data/lib/generators/social_stream/templates/public/images/btn/btn_notification.png +0 -0
  132. data/lib/generators/social_stream/templates/public/images/btn/btn_notification_delete.png +0 -0
  133. data/lib/generators/social_stream/templates/public/images/btn/error.png +0 -0
  134. data/lib/generators/social_stream/templates/public/images/btn/info.png +0 -0
  135. data/lib/generators/social_stream/templates/public/images/btn/success.png +0 -0
  136. data/lib/generators/social_stream/templates/public/images/btn/warning.png +0 -0
  137. data/lib/generators/social_stream/templates/public/images/cancel.png +0 -0
  138. data/lib/generators/social_stream/templates/public/images/html5-badge-h-css3-semantics.png +0 -0
  139. data/lib/generators/social_stream/templates/public/images/icon_checkbox.png +0 -0
  140. data/lib/generators/social_stream/templates/public/images/logos/actor/remote_subject.png +0 -0
  141. data/lib/generators/social_stream/templates/public/images/logos/actor/remote_user.png +0 -0
  142. data/lib/generators/social_stream/templates/public/images/logos/representation/group.png +0 -0
  143. data/lib/generators/social_stream/templates/public/images/logos/representation/user.png +0 -0
  144. data/lib/generators/social_stream/templates/public/images/pbar-ani.gif +0 -0
  145. data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload-ui.js +259 -0
  146. data/lib/generators/social_stream/templates/public/javascripts/jquery.fileupload.js +475 -0
  147. data/lib/generators/social_stream/templates/public/javascripts/jquery.form.js +815 -0
  148. data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.mouse.js +156 -0
  149. data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.slider.js +684 -0
  150. data/lib/generators/social_stream/templates/public/javascripts/jquery.ui.widget.js +236 -0
  151. data/lib/generators/social_stream/templates/public/javascripts/ui.checkbox.js +309 -0
  152. data/lib/generators/social_stream/templates/public/stylesheets/default/base.css +13 -12
  153. data/lib/generators/social_stream/templates/public/stylesheets/default/contacts.css +88 -0
  154. data/lib/generators/social_stream/templates/public/stylesheets/default/footer.css +1 -0
  155. data/lib/generators/social_stream/templates/public/stylesheets/default/header.css +5 -3
  156. data/lib/generators/social_stream/templates/public/stylesheets/default/home.css +1 -1
  157. data/lib/generators/social_stream/templates/public/stylesheets/default/images/loading.gif +0 -0
  158. data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.fileupload-ui.css +73 -0
  159. data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slider.css +24 -0
  160. data/lib/generators/social_stream/templates/public/stylesheets/default/jquery.ui.slidertheme.css +32 -0
  161. data/lib/generators/social_stream/templates/public/stylesheets/default/messages.css +4 -0
  162. data/lib/generators/social_stream/templates/public/stylesheets/default/spheres.css +226 -0
  163. data/lib/generators/social_stream/templates/relations.yml +12 -12
  164. data/lib/social_stream.rb +2 -1
  165. data/lib/social_stream/ability.rb +5 -4
  166. data/lib/social_stream/controllers/helpers.rb +19 -0
  167. data/lib/social_stream/models/object.rb +3 -1
  168. data/lib/social_stream/models/subject.rb +19 -6
  169. data/lib/social_stream/rails.rb +23 -1
  170. data/lib/social_stream/test_helpers/controllers.rb +1 -1
  171. data/lib/social_stream/version.rb +1 -1
  172. data/lib/tasks/db/populate.rake +6 -9
  173. data/social_stream.gemspec +7 -4
  174. data/spec/controllers/comments_controller_spec.rb +1 -1
  175. data/spec/controllers/contacts_controller_spec.rb +23 -0
  176. data/spec/controllers/groups_controller_spec.rb +12 -1
  177. data/spec/controllers/permissions_controller_spec.rb +48 -0
  178. data/spec/controllers/posts_controller_spec.rb +4 -4
  179. data/spec/controllers/relation_customs_controller_spec.rb +130 -0
  180. data/spec/controllers/representations_spec.rb +74 -0
  181. data/spec/controllers/spheres_controller_spec.rb +108 -0
  182. data/spec/dummy/config/initializers/mailboxer.rb +8 -0
  183. data/spec/dummy/config/initializers/social_stream.rb +2 -2
  184. data/spec/dummy/config/relations.yml +12 -12
  185. data/spec/factories/relation_custom.rb +4 -0
  186. data/spec/factories/sphere.rb +5 -0
  187. data/spec/factories/tie.rb +4 -4
  188. data/spec/models/activity_spec.rb +58 -38
  189. data/spec/models/actor_spec.rb +1 -1
  190. data/spec/models/group_spec.rb +12 -0
  191. data/spec/models/like_spec.rb +68 -0
  192. data/spec/models/profile_spec.rb +2 -1
  193. data/spec/models/relation_custom_spec.rb +14 -0
  194. data/spec/models/tie_spec.rb +26 -2
  195. metadata +195 -94
  196. data/app/controllers/avatars_controller.rb +0 -51
  197. data/app/controllers/representations_controller.rb +0 -19
  198. data/app/controllers/ties_controller.rb +0 -22
  199. data/app/helpers/ties_helper.rb +0 -37
  200. data/app/models/avatar.rb +0 -91
  201. data/app/models/representation.rb +0 -35
  202. data/app/views/avatars/_form.html.erb +0 -12
  203. data/app/views/avatars/_precrop.html.erb +0 -66
  204. data/app/views/avatars/edit.html.erb +0 -6
  205. data/app/views/avatars/new.html.erb +0 -32
  206. data/app/views/avatars/show.html.erb +0 -5
  207. data/app/views/groups/_location.html.erb +0 -3
  208. data/app/views/groups/_logo.html.erb +0 -5
  209. data/app/views/home/_location.html.erb +0 -3
  210. data/app/views/subjects/_toolbar_home.html.erb +0 -9
  211. data/app/views/subjects/_toolbar_profile_menu.html.erb +0 -12
  212. data/app/views/subjects/_toolbar_profile_menu_basic_options.html.erb +0 -13
  213. data/app/views/subjects/_toolbar_profile_menu_tie_options.html.erb +0 -41
  214. data/app/views/ties/_new.html.erb +0 -64
  215. data/app/views/ties/_tie.html.erb +0 -23
  216. data/app/views/ties/new.html.erb +0 -1
  217. data/app/views/users/_location.html.erb +0 -3
  218. data/lib/generators/social_stream/templates/public/images/w3c_css.png +0 -0
  219. data/lib/generators/social_stream/templates/public/images/w3c_xhtml.png +0 -0
  220. data/lib/generators/social_stream/templates/public/javascripts/addContact.js +0 -100
  221. data/lib/generators/social_stream/templates/public/stylesheets/default/addContact.css +0 -29
  222. data/spec/controllers/representations_controller_spec.rb +0 -51
  223. data/spec/controllers/ties_controller_spec.rb +0 -19
  224. data/spec/models/representation_spec.rb +0 -16
@@ -0,0 +1,130 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Relation::CustomsController do
4
+ include SocialStream::TestHelpers::Controllers
5
+
6
+ render_views
7
+
8
+ describe "when authenticated" do
9
+ before do
10
+ @user = Factory(:user)
11
+
12
+ sign_in @user
13
+ end
14
+
15
+ context "with an existing sphere" do
16
+ before do
17
+ @sphere = Factory(:sphere, :actor_id => @user.actor_id)
18
+ end
19
+
20
+ it "should render index" do
21
+ get :index, :sphere_id => @sphere.id, :format => "js"
22
+
23
+ response.should be_success
24
+ end
25
+
26
+ context "a new relation" do
27
+ it "should be created" do
28
+ count = Relation::Custom.count
29
+
30
+ post :create, :custom => { :name => "Test create", :sphere_id => @sphere.id }, :format => 'js'
31
+
32
+ relation = assigns(:custom)
33
+
34
+ Relation::Custom.count.should eq(count + 1)
35
+ relation.should be_valid
36
+ response.should be_success
37
+ end
38
+
39
+ end
40
+
41
+ context "a existing own relation" do
42
+ before do
43
+ @relation = Factory(:relation_custom, :sphere_id => @sphere.id)
44
+ @relation.reload
45
+ end
46
+
47
+ it "should allow updating" do
48
+ attrs = { :name => "Updating own" }
49
+
50
+ put :update, :id => @relation.to_param, :relation_custom => attrs, :format => 'js'
51
+
52
+ relation = assigns(:custom)
53
+
54
+ # relation.should_receive(:update_attributes).with(attrs)
55
+ relation.should be_valid
56
+ response.should be_success
57
+ end
58
+
59
+ it "should allow destroying" do
60
+ pending "Delete relations"
61
+
62
+ count = Relation::Custom.count
63
+
64
+ delete :destroy, :id => @relation.to_param, :format => :js
65
+
66
+ Relation::Custom.count.should eq(count - 1)
67
+ end
68
+ end
69
+
70
+ end
71
+
72
+ context "with a fake sphere" do
73
+ before do
74
+ @sphere = Factory(:sphere)
75
+ end
76
+
77
+ it "should not render index" do
78
+ pending
79
+
80
+ get :index, :sphere_id => @sphere.id, :format => "js"
81
+
82
+ assert false
83
+ end
84
+
85
+ context "a new relation" do
86
+ it "should belong to user" do
87
+ count = Relation::Custom.count
88
+
89
+ begin
90
+ post :create, :relation_custom => { :name => "Test create", :sphere_id => @sphere.id }, :format => 'js'
91
+
92
+ assert false
93
+ rescue CanCan::AccessDenied
94
+
95
+ Relation::Custom.count.should eq(count)
96
+ end
97
+ end
98
+ end
99
+ end
100
+
101
+ context "a external relation" do
102
+ before do
103
+ @relation = Factory(:relation_custom)
104
+ end
105
+
106
+ it "should not allow updating" do
107
+ begin
108
+ put :update, :id => @relation.to_param, :relation_custom => { :name => "Updating external" }, :format => 'js'
109
+
110
+ assert false
111
+ rescue CanCan::AccessDenied
112
+ assigns(:relation).should be_nil
113
+ end
114
+ end
115
+
116
+ it "should not allow destroying" do
117
+ begin
118
+ delete :destroy, :id => @relation.to_param
119
+
120
+ assert false
121
+ rescue CanCan::AccessDenied
122
+ assigns(:relation).should be_nil
123
+ end
124
+ end
125
+ end
126
+
127
+
128
+ end
129
+ end
130
+
@@ -0,0 +1,74 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe HomeController do
4
+ include ActionController::RecordIdentifier
5
+ include SocialStream::TestHelpers
6
+
7
+ render_views
8
+
9
+ describe "create" do
10
+ context "with logged user" do
11
+ before do
12
+ @user = Factory(:user)
13
+ sign_in @user
14
+ end
15
+
16
+ context "to represent herself" do
17
+ it "should redirect_to root" do
18
+ get :index, :s => @user.slug
19
+
20
+ assigns(:current_subject).should == @user
21
+ response.should be_success
22
+ end
23
+ end
24
+
25
+ context "to represent own group" do
26
+ before do
27
+ @group = Factory(:member, :receiver => @user.actor).sender_subject
28
+ end
29
+
30
+ it "should redirect_to root" do
31
+ get :index, :s => @group.slug
32
+
33
+ assigns(:current_subject).should == @group
34
+ response.should be_success
35
+ end
36
+ end
37
+
38
+ context "representing own group" do
39
+ before do
40
+ @group = Factory(:member, :receiver => @user.actor).sender_subject
41
+ represent @group
42
+ end
43
+
44
+ context "to represent herself" do
45
+ it "should redirect_to root" do
46
+ get :index, :s => @user.slug
47
+
48
+ assigns(:current_subject).should == @user
49
+ response.should be_success
50
+ end
51
+ end
52
+ end
53
+
54
+ context "to represent other group" do
55
+ before do
56
+ @group = Factory(:group)
57
+ end
58
+
59
+ it "should deny access" do
60
+ begin
61
+ get :index, :s => @group.slug
62
+
63
+ assert false
64
+ rescue ActionView::Template::Error => e
65
+ assert e.message == "Not authorized!"
66
+ rescue CanCan::AccessDenied
67
+ assert true
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+
@@ -0,0 +1,108 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe SpheresController do
4
+ include SocialStream::TestHelpers::Controllers
5
+
6
+ render_views
7
+
8
+ describe "when Anonymous" do
9
+ context "faking a new sphere" do
10
+ before do
11
+ model_attributes[:actor_id] = Factory(:user).actor_id
12
+ end
13
+
14
+ it "should not create" do
15
+ post :create, attributes
16
+
17
+ response.should redirect_to(:new_user_session)
18
+ end
19
+ end
20
+
21
+ context "an existing sphere" do
22
+ before do
23
+ @current_model = Factory(:sphere)
24
+ end
25
+
26
+ it_should_behave_like "Deny Updating"
27
+ it_should_behave_like "Deny Destroying"
28
+ end
29
+ end
30
+
31
+ describe "when authenticated" do
32
+ before do
33
+ @user = Factory(:user)
34
+
35
+ sign_in @user
36
+ end
37
+
38
+ it "should render index" do
39
+ get :index
40
+
41
+ assert_response :success
42
+ end
43
+
44
+ context "a new own sphere" do
45
+ before do
46
+ model_attributes[:actor_id] = @user.actor_id
47
+ end
48
+
49
+ it_should_behave_like "Allow Creating"
50
+ end
51
+
52
+ context "a new fake sphere" do
53
+ before do
54
+ model_attributes[:actor_id] = Factory(:user).actor_id
55
+ end
56
+
57
+ it "should belong to user" do
58
+ count = Sphere.count
59
+ post :create, attributes
60
+
61
+ resource = assigns(:sphere)
62
+
63
+ Sphere.count.should eq(count + 1)
64
+ resource.should be_valid
65
+ resource.actor.should eq(@user.actor)
66
+ end
67
+ end
68
+
69
+ context "a external sphere" do
70
+ before do
71
+ @current_model = Factory(:sphere)
72
+ end
73
+
74
+ it "should not be found on update" do
75
+ begin
76
+ put :update, updating_attributes
77
+
78
+ assert false
79
+ rescue ActiveRecord::RecordNotFound
80
+ assigns(:sphere).should be_nil
81
+ end
82
+ end
83
+
84
+ it "should not be found on destroy" do
85
+ begin
86
+ delete :destroy, :id => @current_model.to_param
87
+
88
+ assert false
89
+ rescue ActiveRecord::RecordNotFound
90
+ assigns(:sphere).should be_nil
91
+ end
92
+ end
93
+ end
94
+
95
+
96
+ context "a existing own sphere" do
97
+ before do
98
+ @current_model = Factory(:sphere, :actor_id => @user.actor_id)
99
+ end
100
+
101
+ # This is not working, because of updating attributes. Do not know why
102
+ # it_should_behave_like "Allow Updating"
103
+ it_should_behave_like "Allow Destroying"
104
+ end
105
+
106
+ end
107
+ end
108
+
@@ -0,0 +1,8 @@
1
+ Mailboxer.setup do |config|
2
+
3
+ #Configures if you applications uses or no the email sending for Notifications and Messages
4
+ config.uses_emails = true
5
+
6
+ #Configures the default from for the email sent for Messages and Notifications of Mailboxer
7
+ config.default_from = "no-reply@mailboxer.com"
8
+ end
@@ -2,7 +2,7 @@ SocialStream.setup do |config|
2
2
  # List the models that are social entities. These will have ties between them.
3
3
  # Remember you must add an "actor_id" foreign key column to your migration!
4
4
  #
5
- # config.actors = [:user, :group ]
5
+ # config.subjects = [:user, :group ]
6
6
 
7
7
  # Include devise modules in User. See devise documentation for details.
8
8
  # Others available are:
@@ -13,5 +13,5 @@ SocialStream.setup do |config|
13
13
  # Type of activities managed by actors
14
14
  # Remember you must add an "activity_object_id" foreign key column to your migration!
15
15
  #
16
- # config.activity_objects = [ :post, :comment, :messages ]
16
+ # config.objects = [ :post, :comment ]
17
17
  end
@@ -11,17 +11,17 @@ user:
11
11
  friend:
12
12
  name: friend
13
13
  permissions:
14
- - [ follow ] # follow the activities of the friend
15
- - [ create, activity ] # let the friend create activities
16
- - [ read, activity, star_ties ] # friend can read activities from the other friends
17
- - [ update, activity ] # update her activities
18
- - [ destroy, activity ] # destroy her activities
14
+ - [ follow ] # follow the activities of the friend
15
+ - [ create, activity ] # let the friend create activities
16
+ - [ read, activity, weak_star_ties ] # friend can read activities from the other friends and below
17
+ - [ update, activity ] # update her activities
18
+ - [ destroy, activity ] # delete her activities
19
19
  sphere: personal
20
20
  acquaintance:
21
21
  name: acquaintance
22
22
  parent: friend # friend relation is stronger than acquaintance
23
23
  permissions:
24
- - [ read, activity, star_ties ]
24
+ - [ read, activity, weak_star_ties ]
25
25
  sphere: personal
26
26
 
27
27
  group:
@@ -29,15 +29,15 @@ group:
29
29
  name: member
30
30
  permissions:
31
31
  - [ represent ] # let the member act as the group
32
- - [ create, activity, weak_ties ] # let them member create activities at the level of member, partner and public
33
- - [ read, activity, star_ties ] # read activities from other members
34
- - [ update, activity, weak_star_ties ] # update and destroy activities to members,
35
- - [ destroy, activity, weak_star_ties ] # acquaintance and public
32
+ - [ create, activity ] # let them member create activities
33
+ - [ read, activity, weak_star_ties ] # read activities from other members
34
+ - [ update, activity ] # update her activities
35
+ - [ destroy, activity ] # delete her activities
36
36
  - [ read, tie, weak_star_ties ]
37
37
  sphere: organization
38
38
  partner:
39
39
  name: partner
40
40
  parent: member # member is stronger than partner
41
41
  permissions:
42
- - [ read, activity, star_ties ]
43
- sphere: organization
42
+ - [ read, activity, weak_star_ties ]
43
+ sphere: external_relations
@@ -0,0 +1,4 @@
1
+ Factory.define(:relation_custom, :class => Relation::Custom) do |c|
2
+ c.sequence(:name) { |n| "Relation custom #{ n }" }
3
+ c.association :sphere
4
+ end
@@ -0,0 +1,5 @@
1
+ Factory.define :sphere do |s|
2
+ s.sequence(:name) { |n| "Sphere #{ n }" }
3
+ s.association :actor
4
+ end
5
+
@@ -6,11 +6,11 @@ end
6
6
  # User ties
7
7
 
8
8
  Factory.define :friend, :parent => :tie do |t|
9
- t.after_build { |u| u.relation = u.sender.relation('friend') }
9
+ t.after_build { |u| u.relation = u.sender.relation_custom('friend') }
10
10
  end
11
11
 
12
12
  Factory.define :acquaintance, :parent => :tie do |t|
13
- t.after_build { |u| u.relation = u.sender.relation('acquaintance') }
13
+ t.after_build { |u| u.relation = u.sender.relation_custom('acquaintance') }
14
14
  end
15
15
 
16
16
  Factory.define :public, :parent => :tie do |t|
@@ -23,7 +23,7 @@ Factory.define :g2u_tie, :parent => :tie do |t|
23
23
  end
24
24
 
25
25
  Factory.define :member, :parent => :g2u_tie do |t|
26
- t.after_build { |u| u.relation = u.sender.relation('member') }
26
+ t.after_build { |u| u.relation = u.sender.relation_custom('member') }
27
27
  end
28
28
 
29
29
  Factory.define :g2g_tie, :parent => :tie do |t|
@@ -32,6 +32,6 @@ Factory.define :g2g_tie, :parent => :tie do |t|
32
32
  end
33
33
 
34
34
  Factory.define :partner, :parent => :g2g_tie do |t|
35
- t.after_build { |u| u.relation = u.sender.relation('partner') }
35
+ t.after_build { |u| u.relation = u.sender.relation_custom('partner') }
36
36
  end
37
37
 
@@ -18,7 +18,8 @@ module ActivityTestHelper
18
18
  end
19
19
 
20
20
  def create_ability_accessed_publicly
21
- @ability = Ability.new(Factory(:user))
21
+ u = Factory(:user)
22
+ @ability = Ability.new(u)
22
23
  end
23
24
 
24
25
  shared_examples_for "Allows Creating" do
@@ -74,55 +75,74 @@ end
74
75
  describe Activity do
75
76
  include ActivityTestHelper
76
77
 
77
- describe "like" do
78
-
79
- describe "activity" do
78
+ describe "wall" do
79
+ context "with a friend activity" do
80
80
  before do
81
- @like_activity = Factory(:like_activity)
82
- @activity = @like_activity.parent
81
+ @activity = Factory(:activity)
83
82
  end
84
83
 
85
- it "should recognize the user who likes it" do
86
- assert @activity.liked_by?(@like_activity.sender)
84
+ describe "sender home" do
85
+ it "should include activity" do
86
+ @activity.sender.wall(:home).should include(@activity)
87
+ end
87
88
  end
88
89
 
89
- it "should not recognize the user who does not like it" do
90
- assert ! @activity.liked_by?(Factory(:user))
90
+ describe "receiver home" do
91
+ it "should include activity" do
92
+ @activity.receiver.wall(:home).should include(@activity)
93
+ end
91
94
  end
92
- end
93
95
 
94
- describe "actor" do
95
- before do
96
- @tie = Factory(:friend)
97
- @like = Like.build(@tie.sender, @tie.receiver).save
96
+ describe "alien home" do
97
+ it "should not include activity" do
98
+ Factory(:user).wall(:home).should_not include(@activity)
99
+ end
98
100
  end
99
101
 
100
- it "should recognize the user who likes it" do
101
- assert @tie.receiver.liked_by?(@tie.sender)
102
+ describe "sender profile" do
103
+ context "for sender" do
104
+ it "should include activity" do
105
+ @activity.sender.wall(:profile, :for => @activity.sender).should include(@activity)
106
+ end
107
+ end
108
+
109
+ context "for receiver" do
110
+ it "should include activity" do
111
+ @activity.sender.wall(:profile, :for => @activity.receiver).should include(@activity)
112
+ @activity.sender.wall(:profile,
113
+ :for => @activity.receiver,
114
+ :relation => @activity.tie.relation).should include(@activity)
115
+ end
116
+ end
102
117
  end
103
118
  end
104
- end
105
119
 
106
- describe "wall" do
107
- before do
108
- @activity = Factory(:activity)
109
- end
110
-
111
- describe "type home" do
112
- it "should include activity" do
113
- @activity.sender.wall(:home).should include(@activity)
114
- @activity.receiver.wall(:home).should include(@activity)
120
+ context "with public activity" do
121
+ before do
122
+ tie = Factory(:user).public_tie
123
+ @activity = Factory(:activity, :_tie => tie)
115
124
  end
116
- end
117
125
 
118
- describe "type profile" do
119
- it "should include activity" do
120
- @activity.sender.wall(:profile, :for => @activity.sender).should include(@activity)
121
- @activity.sender.wall(:profile, :for => @activity.receiver).should include(@activity)
122
- @activity.sender.wall(:profile,
123
- :for => @activity.receiver,
124
- :relation => @activity.tie.relation).should include(@activity)
126
+ describe "sender home" do
127
+ it "should include activity" do
128
+ @activity.sender.wall(:home).should include(@activity)
129
+ end
130
+ end
125
131
 
132
+ describe "sender profile" do
133
+ context "accessed by alien" do
134
+ it "should include activity" do
135
+ @activity.sender.wall(:profile,
136
+ :for => Factory(:user)).should include(@activity)
137
+ end
138
+ end
139
+
140
+ context "accessed by anonymous" do
141
+ it "should include activity" do
142
+ @activity.sender.wall(:profile,
143
+ :for => nil).should include(@activity)
144
+ end
145
+ end
126
146
  end
127
147
  end
128
148
  end
@@ -181,7 +201,7 @@ describe Activity do
181
201
  describe "belonging to friend self tie" do
182
202
  before do
183
203
  user = Factory(:user)
184
- tie = user.ties.where(:relation_id => user.relation('friend')).first
204
+ tie = user.ties.where(:relation_id => user.relation_custom('friend')).first
185
205
  create_activity_assigned_to(tie)
186
206
  end
187
207
 
@@ -316,8 +336,8 @@ describe Activity do
316
336
 
317
337
  it_should_behave_like "Denies Creating"
318
338
  it_should_behave_like "Allows Reading"
319
- it_should_behave_like "Allows Updating"
320
- it_should_behave_like "Allows Destroying"
339
+ it_should_behave_like "Denies Updating"
340
+ it_should_behave_like "Denies Destroying"
321
341
  end
322
342
 
323
343
  describe "accessed by partner" do