social_stream 0.12.14 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/base/app/controllers/groups_controller.rb +3 -2
  2. data/base/app/controllers/posts_controller.rb +2 -10
  3. data/base/app/helpers/activities_helper.rb +2 -1
  4. data/base/app/models/activity_object.rb +28 -0
  5. data/base/app/models/actor.rb +10 -0
  6. data/base/app/models/group.rb +7 -3
  7. data/base/app/models/user.rb +7 -2
  8. data/base/app/views/activities/_new.html.erb +0 -1
  9. data/base/app/views/activity_objects/_activity_object.html.erb +3 -3
  10. data/base/app/views/comments/_new.html.erb +2 -3
  11. data/base/app/views/groups/_new.html.erb +0 -3
  12. data/base/app/views/notifications/activities/_like.text.erb +1 -1
  13. data/base/app/views/objects/_new_activity.html.erb +2 -2
  14. data/base/app/views/objects/_show.html.erb +1 -1
  15. data/base/db/migrate/20111124100618_object_actors.rb +50 -0
  16. data/base/lib/social_stream-base.rb +2 -1
  17. data/base/lib/social_stream/ability/base.rb +1 -1
  18. data/base/lib/social_stream/base/version.rb +1 -1
  19. data/base/lib/social_stream/controllers/objects.rb +33 -0
  20. data/base/lib/social_stream/models/object.rb +33 -28
  21. data/base/lib/social_stream/test_helpers/controllers.rb +3 -1
  22. data/base/lib/tasks/db/populate.rake +9 -2
  23. data/base/spec/controllers/comments_controller_spec.rb +9 -6
  24. data/base/spec/controllers/groups_controller_spec.rb +7 -5
  25. data/base/spec/controllers/posts_controller_spec.rb +45 -9
  26. data/base/spec/controllers/users_controller_spec.rb +3 -1
  27. data/base/spec/factories/activity.rb +3 -2
  28. data/base/spec/factories/comment.rb +3 -2
  29. data/base/spec/factories/group.rb +2 -1
  30. data/base/spec/factories/post.rb +5 -4
  31. data/base/spec/models/activity_authorization_spec.rb +5 -4
  32. data/base/spec/models/group_spec.rb +5 -2
  33. data/base/spec/models/post_spec.rb +6 -2
  34. data/documents/app/assets/stylesheets/show.css.scss +4 -0
  35. data/documents/app/controllers/documents_controller.rb +2 -10
  36. data/documents/app/views/audios/_audio_processed.html.erb +1 -1
  37. data/documents/app/views/audios/_audio_processing.html.erb +1 -1
  38. data/documents/app/views/common_documents/_document_info.html.erb +5 -0
  39. data/documents/app/views/documents/_document.html.erb +1 -1
  40. data/documents/app/views/pictures/_picture.html.erb +4 -4
  41. data/documents/app/views/videos/_video_processed.html.erb +1 -1
  42. data/documents/app/views/videos/_video_processing.html.erb +1 -1
  43. data/documents/lib/social_stream/documents/version.rb +1 -1
  44. data/documents/social_stream-documents.gemspec +1 -1
  45. data/documents/spec/factories/document.rb +7 -6
  46. data/documents/spec/factories/picture.rb +7 -6
  47. data/documents/spec/spec_helper.rb +6 -1
  48. data/events/db/migrate/20111102145626_add_more_fields_to_events.rb +0 -4
  49. data/events/db/migrate/20111104182420_add_details_to_events.rb +0 -26
  50. data/events/lib/social_stream/events/version.rb +1 -1
  51. data/events/social_stream-events.gemspec +1 -1
  52. data/lib/social_stream/version.rb +1 -1
  53. data/linkser/.gitignore +14 -0
  54. data/linkser/.rspec +1 -0
  55. data/linkser/Gemfile +5 -0
  56. data/linkser/MIT-LICENSE +20 -0
  57. data/linkser/README.rdoc +6 -0
  58. data/linkser/Rakefile +26 -0
  59. data/{documents/app/views/audios/_mediapreviews.html.erb → linkser/app/assets/javascripts/linkser.js.erb} +0 -0
  60. data/linkser/app/assets/javascripts/social_stream-linkser.js +1 -0
  61. data/linkser/app/assets/stylesheets/linkser.css.scss +1 -0
  62. data/linkser/app/assets/stylesheets/social_stream-linkser.css +3 -0
  63. data/linkser/config/locales/en.yml +3 -0
  64. data/linkser/config/locales/es.yml +3 -0
  65. data/linkser/config/routes.rb +3 -0
  66. data/linkser/lib/generators/social_stream/linkser/install_generator.rb +24 -0
  67. data/linkser/lib/social_stream-linkser.rb +9 -0
  68. data/linkser/lib/social_stream/linkser/engine.rb +7 -0
  69. data/linkser/lib/social_stream/linkser/version.rb +5 -0
  70. data/linkser/lib/social_stream/migrations/linkser.rb +9 -0
  71. data/linkser/social_stream-linkser.gemspec +26 -0
  72. data/linkser/spec/dummy/Rakefile +7 -0
  73. data/linkser/spec/dummy/app/controllers/application_controller.rb +3 -0
  74. data/linkser/spec/dummy/app/helpers/application_helper.rb +2 -0
  75. data/linkser/spec/dummy/app/views/layouts/application.html.erb +14 -0
  76. data/linkser/spec/dummy/config.ru +4 -0
  77. data/linkser/spec/dummy/config/application.rb +45 -0
  78. data/linkser/spec/dummy/config/boot.rb +10 -0
  79. data/linkser/spec/dummy/config/database.yml +22 -0
  80. data/linkser/spec/dummy/config/environment.rb +5 -0
  81. data/linkser/spec/dummy/config/environments/development.rb +25 -0
  82. data/linkser/spec/dummy/config/environments/production.rb +49 -0
  83. data/linkser/spec/dummy/config/environments/test.rb +37 -0
  84. data/linkser/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  85. data/linkser/spec/dummy/config/initializers/devise.rb +176 -0
  86. data/linkser/spec/dummy/config/initializers/inflections.rb +10 -0
  87. data/linkser/spec/dummy/config/initializers/mime_types.rb +5 -0
  88. data/linkser/spec/dummy/config/initializers/secret_token.rb +7 -0
  89. data/linkser/spec/dummy/config/initializers/session_store.rb +8 -0
  90. data/linkser/spec/dummy/config/locales/en.yml +5 -0
  91. data/linkser/spec/dummy/config/navigation.rb +0 -0
  92. data/linkser/spec/dummy/config/relations.yml +39 -0
  93. data/linkser/spec/dummy/config/routes.rb +60 -0
  94. data/linkser/spec/dummy/db/.gitkeep +0 -0
  95. data/linkser/spec/dummy/documents/documents/000/000/001/original.pdf +157 -0
  96. data/linkser/spec/dummy/documents/documents/000/000/002/original.pdf +157 -0
  97. data/linkser/spec/dummy/documents/documents/000/000/003/original.pdf +157 -0
  98. data/linkser/spec/dummy/documents/documents/000/000/004/original.pdf +157 -0
  99. data/linkser/spec/dummy/documents/documents/000/000/005/original.pdf +157 -0
  100. data/linkser/spec/dummy/documents/documents/000/000/006/original.pdf +157 -0
  101. data/linkser/spec/dummy/documents/documents/000/000/007/original.pdf +157 -0
  102. data/linkser/spec/dummy/documents/documents/000/000/008/original.pdf +157 -0
  103. data/linkser/spec/dummy/documents/documents/000/000/009/original.pdf +157 -0
  104. data/linkser/spec/dummy/documents/documents/000/000/010/original.pdf +157 -0
  105. data/linkser/spec/dummy/documents/pictures/000/000/011/original.png +0 -0
  106. data/linkser/spec/dummy/documents/pictures/000/000/011/thumb.png +0 -0
  107. data/linkser/spec/dummy/documents/pictures/000/000/011/thumb0.png +0 -0
  108. data/linkser/spec/dummy/documents/pictures/000/000/012/original.png +0 -0
  109. data/linkser/spec/dummy/documents/pictures/000/000/012/thumb.png +0 -0
  110. data/linkser/spec/dummy/documents/pictures/000/000/012/thumb0.png +0 -0
  111. data/linkser/spec/dummy/documents/pictures/000/000/013/original.png +0 -0
  112. data/linkser/spec/dummy/documents/pictures/000/000/013/thumb.png +0 -0
  113. data/linkser/spec/dummy/documents/pictures/000/000/013/thumb0.png +0 -0
  114. data/linkser/spec/dummy/documents/pictures/000/000/014/original.png +0 -0
  115. data/linkser/spec/dummy/documents/pictures/000/000/014/thumb.png +0 -0
  116. data/linkser/spec/dummy/documents/pictures/000/000/014/thumb0.png +0 -0
  117. data/linkser/spec/dummy/documents/pictures/000/000/015/original.png +0 -0
  118. data/linkser/spec/dummy/documents/pictures/000/000/015/thumb.png +0 -0
  119. data/linkser/spec/dummy/documents/pictures/000/000/015/thumb0.png +0 -0
  120. data/linkser/spec/dummy/documents/pictures/000/000/016/original.png +0 -0
  121. data/linkser/spec/dummy/documents/pictures/000/000/016/thumb.png +0 -0
  122. data/linkser/spec/dummy/documents/pictures/000/000/016/thumb0.png +0 -0
  123. data/linkser/spec/dummy/documents/pictures/000/000/017/original.png +0 -0
  124. data/linkser/spec/dummy/documents/pictures/000/000/017/thumb.png +0 -0
  125. data/linkser/spec/dummy/documents/pictures/000/000/017/thumb0.png +0 -0
  126. data/linkser/spec/dummy/documents/pictures/000/000/018/original.png +0 -0
  127. data/linkser/spec/dummy/documents/pictures/000/000/018/thumb.png +0 -0
  128. data/linkser/spec/dummy/documents/pictures/000/000/018/thumb0.png +0 -0
  129. data/linkser/spec/dummy/documents/pictures/000/000/019/original.png +0 -0
  130. data/linkser/spec/dummy/documents/pictures/000/000/019/thumb.png +0 -0
  131. data/linkser/spec/dummy/documents/pictures/000/000/019/thumb0.png +0 -0
  132. data/linkser/spec/dummy/documents/pictures/000/000/020/original.png +0 -0
  133. data/linkser/spec/dummy/documents/pictures/000/000/020/thumb.png +0 -0
  134. data/linkser/spec/dummy/documents/pictures/000/000/020/thumb0.png +0 -0
  135. data/linkser/spec/dummy/public/404.html +26 -0
  136. data/linkser/spec/dummy/public/422.html +26 -0
  137. data/linkser/spec/dummy/public/500.html +26 -0
  138. data/linkser/spec/dummy/public/favicon.ico +0 -0
  139. data/linkser/spec/dummy/public/javascripts/application.js +2 -0
  140. data/linkser/spec/dummy/public/javascripts/controls.js +965 -0
  141. data/linkser/spec/dummy/public/javascripts/dragdrop.js +974 -0
  142. data/linkser/spec/dummy/public/javascripts/effects.js +1123 -0
  143. data/linkser/spec/dummy/public/javascripts/prototype.js +6001 -0
  144. data/linkser/spec/dummy/public/javascripts/rails.js +191 -0
  145. data/linkser/spec/dummy/public/stylesheets/.gitkeep +0 -0
  146. data/linkser/spec/dummy/script/rails +6 -0
  147. data/linkser/spec/integration/navigation_spec.rb +9 -0
  148. data/linkser/spec/socialstream_linkser_spec.rb +7 -0
  149. data/linkser/spec/spec_helper.rb +48 -0
  150. data/linkser/spec/support/cancan.rb +1 -0
  151. data/linkser/spec/support/db.rb +8 -0
  152. data/linkser/spec/support/devise.rb +4 -0
  153. data/linkser/spec/support/mock.rb +4 -0
  154. data/linkser/vendor/assets/javascripts/jquery.jplayer.js +78 -0
  155. data/linkser/vendor/assets/stylesheets/jplayer.blue.monday.css +448 -0
  156. data/linkser/vendor/assets/stylesheets/jplayer.blue.monday.jpg +0 -0
  157. data/linkser/vendor/assets/stylesheets/jplayer.blue.monday.video.play.hover.png +0 -0
  158. data/linkser/vendor/assets/stylesheets/jplayer.blue.monday.video.play.png +0 -0
  159. data/linkser/vendor/assets/stylesheets/jquery.lightbox.css +101 -0
  160. data/linkser/vendor/assets/stylesheets/pbar-ani.gif +0 -0
  161. data/presence/app/assets/images/status/offline.png +0 -0
  162. data/presence/app/assets/javascripts/chat_interface_manager.js.erb +65 -16
  163. data/presence/app/assets/javascripts/xmpp_client_management.js.erb +13 -3
  164. data/presence/app/controllers/xmpp_controller.rb +2 -5
  165. data/presence/app/views/chat/_contacts.html.erb +10 -9
  166. data/presence/app/views/chat/_settings.html.erb +4 -4
  167. data/presence/app/views/xmpp/active_users.html.erb +10 -10
  168. data/presence/config/locales/en.yml +6 -1
  169. data/presence/config/locales/es.yml +7 -1
  170. data/presence/config/routes.rb +1 -4
  171. data/presence/lib/social_stream/presence/version.rb +1 -1
  172. data/social_stream.gemspec +3 -3
  173. metadata +127 -23
  174. data/documents/app/views/audios/index.js.erb +0 -1
  175. data/documents/app/views/documents/index.js.erb +0 -1
  176. data/documents/app/views/pictures/_mediapreviews.html.erb +0 -8
  177. data/documents/app/views/pictures/index.js.erb +0 -1
  178. data/presence/app/views/xmpp/index.html +0 -18
  179. data/presence/app/views/xmpp/test.html.erb +0 -11
@@ -14,9 +14,10 @@ describe CommentsController do
14
14
  describe "comment from user" do
15
15
  before do
16
16
  activity = Factory(:self_activity, :contact => Factory(:self_contact, :sender => @user.actor))
17
- contact = @user.contact_to!(@user)
18
17
 
19
- model_attributes[:_contact_id] = contact.id
18
+ model_attributes[:author_id] = @user.actor_id
19
+ model_attributes[:owner_id] = @user.actor_id
20
+ model_attributes[:user_author_id] = @user.actor_id
20
21
  model_attributes[:_activity_parent_id] = activity.id
21
22
  end
22
23
 
@@ -38,9 +39,10 @@ describe CommentsController do
38
39
  before do
39
40
  f = Factory(:friend, :contact => Factory(:contact, :receiver => @user.actor)).sender
40
41
  activity = Factory(:self_activity, :contact => f.contact_to!(f))
41
- contact = @user.contact_to!(f)
42
42
 
43
- model_attributes[:_contact_id] = contact.id
43
+ model_attributes[:author_id] = @user.actor_id
44
+ model_attributes[:owner_id] = f.id
45
+ model_attributes[:user_author_id] = @user.actor_id
44
46
  model_attributes[:_activity_parent_id] = activity.id
45
47
  end
46
48
 
@@ -51,9 +53,10 @@ describe CommentsController do
51
53
  before do
52
54
  a = Factory(:acquaintance, :contact => Factory(:contact, :receiver => @user.actor)).sender
53
55
  activity = Factory(:self_activity, :contact => a.contact_to!(a))
54
- contact = @user.contact_to!(a)
55
56
 
56
- model_attributes[:_contact_id] = contact.id
57
+ model_attributes[:author_id] = @user.actor_id
58
+ model_attributes[:owner_id] = a.id
59
+ model_attributes[:user_author_id] = @user.actor_id
57
60
  model_attributes[:_activity_parent_id] = activity.id
58
61
  end
59
62
 
@@ -26,9 +26,7 @@ describe GroupsController do
26
26
 
27
27
  context "faking a new group" do
28
28
  it "should deny creating" do
29
- post :create, :group => { :name => "Test",
30
- :_contact_id => Factory(:user).ego_contact.id
31
- }
29
+ post :create, :group => { :name => "Test" }
32
30
 
33
31
  response.should redirect_to(new_user_session_path)
34
32
  end
@@ -79,7 +77,8 @@ describe GroupsController do
79
77
 
80
78
  context "a new own group" do
81
79
  before do
82
- model_attributes[:_contact_id] = @user.ego_contact.id
80
+ model_attributes[:author_id] = @user.actor_id
81
+ model_attributes[:user_author_id] = @user.actor_id
83
82
  end
84
83
 
85
84
  it "should allow creating" do
@@ -125,7 +124,10 @@ describe GroupsController do
125
124
 
126
125
  context "a new fake group" do
127
126
  before do
128
- model_attributes[:_contact_id] = Factory(:user).ego_contact.id
127
+ user = Factory(:user)
128
+
129
+ model_attributes[:author_id] = user.actor_id
130
+ model_attributes[:user_author_id] = user.actor_id
129
131
  end
130
132
 
131
133
  it_should_behave_like "Deny Creating"
@@ -1,6 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
-
4
3
  describe PostsController do
5
4
  include SocialStream::TestHelpers
6
5
  include SocialStream::TestHelpers::Controllers
@@ -19,7 +18,10 @@ describe PostsController do
19
18
  contact = @user.contact_to!(@user)
20
19
  relation = @user.relation_customs.sort.first
21
20
  model_assigned_to @user.contact_to!(@user), relation
22
- @current_model = Factory(:post, :_contact_id => contact.id, :_relation_ids => Array(relation.id))
21
+ @current_model = Factory(:post, :author_id => @user.actor_id,
22
+ :owner_id => @user.actor_id,
23
+ :user_author_id => @user.actor_id,
24
+ :_relation_ids => Array(relation.id))
23
25
  end
24
26
 
25
27
  it_should_behave_like "Allow Creating"
@@ -31,7 +33,10 @@ describe PostsController do
31
33
  contact = @user.contact_to!(@user)
32
34
  relation = @user.relation_customs.sort.last
33
35
  model_assigned_to @user.contact_to!(@user), relation
34
- @current_model = Factory(:post, :_contact_id => contact.id, :_relation_ids => Array(relation.id))
36
+ @current_model = Factory(:post, :author_id => @user.actor_id,
37
+ :owner_id => @user.actor_id,
38
+ :user_author_id => @user.actor_id,
39
+ :_relation_ids => Array(relation.id))
35
40
  end
36
41
 
37
42
  it_should_behave_like "Allow Creating"
@@ -43,7 +48,9 @@ describe PostsController do
43
48
  contact = @user.contact_to!(@user)
44
49
  relation = @user.relation_public
45
50
  model_assigned_to @user.contact_to!(@user), relation
46
- @current_model = Factory(:post, :_contact_id => contact.id)
51
+ @current_model = Factory(:post, :author_id => @user.actor_id,
52
+ :owner_id => @user.actor_id,
53
+ :user_author_id => @user.actor_id)
47
54
  end
48
55
 
49
56
  it_should_behave_like "Allow Creating"
@@ -82,7 +89,10 @@ describe PostsController do
82
89
  relation = @group.relation_custom('member')
83
90
 
84
91
  model_assigned_to contact, relation
85
- @current_model = Factory(:post, :_contact_id => contact.id, :_relation_ids => Array(relation.id))
92
+ @current_model = Factory(:post, :author_id => contact.sender.id,
93
+ :owner_id => contact.receiver.id,
94
+ :user_author_id => contact.sender.id,
95
+ :_relation_ids => Array(relation.id))
86
96
  end
87
97
 
88
98
  it_should_behave_like "Allow Creating"
@@ -99,7 +109,10 @@ describe PostsController do
99
109
  contact = @group.contact_to!(@group)
100
110
  relation = @group.relation_customs.sort.first
101
111
  model_assigned_to contact, relation
102
- @current_model = Factory(:post, :_contact_id => contact.id, :_relation_ids => Array(relation.id))
112
+ @current_model = Factory(:post, :author_id => contact.sender.id,
113
+ :owner_id => contact.receiver.id,
114
+ :user_author_id => contact.sender.id,
115
+ :_relation_ids => Array(relation.id))
103
116
  end
104
117
 
105
118
  it_should_behave_like "Allow Creating"
@@ -111,7 +124,10 @@ describe PostsController do
111
124
  contact = @group.contact_to!(@group)
112
125
  relation = @group.relation_customs.sort.last
113
126
  model_assigned_to contact, relation
114
- @current_model = Factory(:post, :_contact_id => contact.id, :_relation_ids => Array(relation.id))
127
+ @current_model = Factory(:post, :author_id => contact.sender.id,
128
+ :owner_id => contact.receiver.id,
129
+ :user_author_id => contact.sender.id,
130
+ :_relation_ids => Array(relation.id))
115
131
  end
116
132
 
117
133
  it_should_behave_like "Allow Creating"
@@ -123,7 +139,10 @@ describe PostsController do
123
139
  contact = @group.contact_to!(@group)
124
140
  relation = @group.relation_public
125
141
  model_assigned_to contact, relation
126
- @current_model = Factory(:post, :_contact_id => contact.id, :_relation_ids => Array(relation.id))
142
+ @current_model = Factory(:post, :author_id => contact.sender.id,
143
+ :owner_id => contact.receiver.id,
144
+ :user_author_id => contact.sender.id,
145
+ :_relation_ids => Array(relation.id))
127
146
  end
128
147
 
129
148
  it_should_behave_like "Allow Creating"
@@ -143,7 +162,7 @@ describe PostsController do
143
162
  sign_in @tie.receiver_subject
144
163
 
145
164
  post :create, :post => { :text => "Test",
146
- :_contact_id => @tie.contact.inverse!.id,
165
+ :owner_id => @tie.contact.sender.id
147
166
  }
148
167
 
149
168
  post = assigns(:post)
@@ -151,6 +170,23 @@ describe PostsController do
151
170
  post.should be_valid
152
171
  post.post_activity.relations.should include(@tie.relation)
153
172
  end
173
+
174
+ it "should assign activity to member" do
175
+ sign_in @tie.receiver_subject
176
+
177
+ post :create, :post => { :text => "Test",
178
+ :owner_id => @tie.contact.sender.id
179
+ },
180
+ :format => :js
181
+
182
+
183
+ post = assigns(:post)
184
+
185
+ post.should be_valid
186
+ post.post_activity.relations.should include(@tie.relation)
187
+
188
+ response.should be_success
189
+ end
154
190
  end
155
191
 
156
192
  context "creating public post" do
@@ -74,7 +74,9 @@ describe UsersController do
74
74
  it "should render other's page with activity" do
75
75
  tie = Factory(:friend, :receiver => @user.actor)
76
76
  friend = tie.sender
77
- Factory(:post, :_contact_id => tie.contact_id,
77
+ Factory(:post, :author_id => tie.sender.id,
78
+ :owner_id => tie.receiver.id,
79
+ :user_author_id => tie.sender.id,
78
80
  :_relation_ids => Array(tie.relation_id))
79
81
 
80
82
  get :show, :id => friend.to_param
@@ -38,11 +38,12 @@ Factory.define :public_activity, :parent => :activity do |a|
38
38
  a.relation_ids { |b| Array(b.sender.relation_public.id) }
39
39
  end
40
40
 
41
- Factory.define :like_activity, :parent => :activity do |a|
41
+ Factory.define :like_activity, :class => 'Activity' do |a|
42
42
  a.association :parent, :factory => :activity
43
43
  a.contact { |b| Factory(:friend, :sender => b.parent.sender).receiver.contact_to!(b.parent.sender) }
44
44
  a.activity_verb { ActivityVerb["like"] }
45
- a.relation_ids { |b| Array(b.parent.contact.ties.first.relation.id) }
45
+ a.relation_ids { |b| b.parent.relation_ids }
46
+ a.after_build{ |b| b.activity_object_ids = b.parent.activity_object_ids }
46
47
  end
47
48
 
48
49
 
@@ -1,5 +1,6 @@
1
1
  Factory.define :comment do |p|
2
2
  p.sequence(:text) { |n| "Comment #{ n }" }
3
- p._contact_id { Factory(:friend).contact_id }
4
- p._relation_ids { |q| Array(Contact.find(q._contact_id).sender.relation_customs.sort.first.id) }
3
+ p.author_id { Factory(:friend).receiver.id }
4
+ p.owner_id { |q| Actor.find(q.author_id).received_ties.first.sender.id }
5
+ p.user_author_id { |q| q.author_id }
5
6
  end
@@ -1,4 +1,5 @@
1
1
  Factory.define :group do |g|
2
2
  g.sequence(:name) { |n| "Group #{ n }" }
3
- g._contact_id { |g| Factory(:user).ego_contact.id }
3
+ g.author_id { |h| Factory(:user).actor_id }
4
+ g.user_author_id { |h| h.author_id }
4
5
  end
@@ -1,10 +1,11 @@
1
1
  Factory.define :post do |p|
2
2
  p.sequence(:text) { |n| "Post #{ n }" }
3
- p._contact_id { Factory(:friend).contact_id }
4
- p._relation_ids { |q| Array(Contact.find(q._contact_id).sender.relation_customs.sort.first.id) }
3
+ p.author_id { Factory(:friend).receiver.id }
4
+ p.owner_id { |q| Actor.find(q.author_id).received_ties.first.sender.id }
5
+ p.user_author_id { |q| q.author_id }
5
6
  end
6
7
 
7
8
  Factory.define :public_post, :parent => :post do |p|
8
- p._contact_id { Factory(:self_contact).id }
9
- p._relation_ids { |q| Array(Contact.find(q._contact_id).sender.relation_public.id) }
9
+ p.owner_id { |q| q.author_id }
10
+ p._relation_ids { |q| Array(q.author.relation_public.id) }
10
11
  end
@@ -2,10 +2,11 @@ require 'spec_helper'
2
2
 
3
3
  module ActivityTestHelper
4
4
  def create_activity(contact, relations)
5
- @activity = Factory(:activity,
6
- :contact_id => contact.id,
7
- :relation_ids => Array(Relation.normalize_id(relations)))
8
-
5
+ @activity = Factory(:post,
6
+ :author_id => contact.sender.id,
7
+ :owner_id => contact.receiver.id,
8
+ :user_author_id => contact.sender.id,
9
+ :_relation_ids => Array(Relation.normalize_id(relations))).post_activity
9
10
  end
10
11
 
11
12
  def create_ability_accessed_by(subject)
@@ -2,9 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe Group do
4
4
  it "should save description" do
5
- g = Group.create(:name => "Test",
5
+ user = Factory(:user)
6
+
7
+ g = Group.create :name => "Test",
6
8
  :description => "Testing description",
7
- :_contact_id => Factory(:user).ego_contact.id)
9
+ :author_id => user.actor.id,
10
+ :user_author_id => user.actor.id
8
11
 
9
12
  g.reload.description.should be_present
10
13
  end
@@ -36,7 +36,9 @@ describe Post do
36
36
  tie = Factory(:friend)
37
37
 
38
38
  post = Post.new :text => "testing",
39
- :_contact_id => tie.contact.inverse!.id
39
+ :author_id => tie.receiver.id,
40
+ :owner_id => tie.sender.id,
41
+ :user_author_id => tie.receiver.id
40
42
 
41
43
  assert post.build_post_activity.allow? tie.receiver_subject, 'create'
42
44
 
@@ -49,7 +51,9 @@ describe Post do
49
51
  tie = Factory(:friend)
50
52
 
51
53
  post = Post.new :text => "testing",
52
- :_contact_id => tie.contact.inverse!.id
54
+ :author_id => tie.receiver.id,
55
+ :owner_id => tie.sender.id,
56
+ :user_author_id => tie.receiver.id
53
57
 
54
58
  post.save!
55
59
 
@@ -41,6 +41,10 @@
41
41
  float: left;
42
42
  margin-left: 30px;
43
43
  }
44
+ #document_info #description{
45
+ margin: 15px 40px;
46
+ text-align: justify;
47
+ }
44
48
  #document_info #actions{
45
49
  margin-top: 10px;
46
50
  margin-left: 30px;
@@ -1,13 +1,11 @@
1
- class DocumentsController < InheritedResources::Base
1
+ class DocumentsController < ApplicationController
2
2
  include ActionView::Helpers::SanitizeHelper
3
- respond_to :html, :js
3
+ include SocialStream::Controllers::Objects
4
4
 
5
5
  belongs_to_subjects :optional => true
6
6
 
7
7
  before_filter :profile_subject!, :only => :index
8
8
 
9
- load_and_authorize_resource :except => :index
10
-
11
9
  PER_PAGE=20
12
10
  SEND_FILE_METHOD = :default
13
11
 
@@ -67,12 +65,6 @@ class DocumentsController < InheritedResources::Base
67
65
  send_file(path, send_file_options)
68
66
  end
69
67
 
70
- def destroy
71
- @post_activity = resource.post_activity
72
-
73
- destroy!
74
- end
75
-
76
68
  private
77
69
 
78
70
  def collection
@@ -4,7 +4,7 @@
4
4
  :class => "" %>
5
5
  </div>
6
6
  <div class="attachment_text">
7
- <%= t('audio.msg') %><%= link_to "\""+audio.file_file_name+"\"",
7
+ <%= t('audio.msg') %><%= link_to "\""+audio.title+"\"",
8
8
  audio_path(audio),
9
9
  :class => "attachment_text_link" %>
10
10
  </div>
@@ -2,6 +2,6 @@
2
2
  <%= thumb_for(audio, 16) %>
3
3
  </div>
4
4
  <div class="attachment_text">
5
- <%= t('audio.msg') %><%= "\""+audio.file_file_name+"\"" %>
5
+ <%= t('audio.msg') %><%= "\""+audio.title+"\"" %>
6
6
  <div class="processing_text"><%= t('audio.processing')%></div>
7
7
  </div>
@@ -1,4 +1,9 @@
1
1
  <div id="document_info">
2
+ <% if document.description %>
3
+ <div id="description">
4
+ <%= document.description %>
5
+ </div>
6
+ <% end %>
2
7
  <div id="actions">
3
8
  <%= link_to content_tag(:span,image_tag("btn/btn_write.png") + t('document.actions.details'), :class => :action, :id => :document_details_action), "javascript:toggleDocumentMenu('details');" %>
4
9
  <%= link_to content_tag(:span,image_tag("btn/download.png") + t('document.actions.download'), :class => :action), download_document_path(document) %>
@@ -7,7 +7,7 @@
7
7
  </div>
8
8
 
9
9
  <div class="attachment_text">
10
- <%= t('document.msg') %><%= link_to "\""+document.file_file_name+"\"",
10
+ <%= t('document.msg') %><%= link_to "\""+document.title+"\"",
11
11
  document,
12
12
  :class => "attachment_text_link" %>
13
13
  </div>
@@ -4,15 +4,15 @@
4
4
  <%= link_to thumb_for(picture, 16),
5
5
  picture_path(picture),
6
6
  :type => picture.type,
7
- :title => picture.file_file_name,
7
+ :title => picture.title,
8
8
  :path => document_path(picture) %>
9
9
  </div>
10
10
 
11
11
  <div class="attachment_text picture_summary_class picture_link">
12
12
  <%= t('picture.msg') %>
13
- <%= link_to "\""+picture.file_file_name+"\"",
13
+ <%= link_to "\""+picture.title+"\"",
14
14
  picture_path(picture),
15
- :alt => picture.file_file_name,
15
+ :alt => picture.title,
16
16
  :type => picture.type,
17
17
  :path => document_path(picture),
18
18
  :class => "attachment_text_link" %>
@@ -22,7 +22,7 @@
22
22
  <%= link_to thumb_for(picture, 130),
23
23
  download_document_path(picture),
24
24
  :type => picture.type,
25
- :title => picture.file_file_name,
25
+ :title => picture.title,
26
26
  :path => document_path(picture) %>
27
27
  </div>
28
28
  <% end %>
@@ -5,7 +5,7 @@
5
5
  :class => "" %>
6
6
  </div>
7
7
  <div class="attachment_text">
8
- <%= t('video.msg') %><%= link_to "\""+video.file_file_name+"\"",
8
+ <%= t('video.msg') %><%= link_to "\""+video.title+"\"",
9
9
  video,
10
10
  :class => "attachment_text_link" %>
11
11
  <div id="video_thumbnail_<%= video.id%>" class="video_thumbnail_class">
@@ -2,6 +2,6 @@
2
2
  <%= thumb_for(video, 16) %>
3
3
  </div>
4
4
  <div class="attachment_text">
5
- <%= t('video.msg') %><%= "\""+video.file_file_name+"\"" %>
5
+ <%= t('video.msg') %><%= "\""+video.title+"\"" %>
6
6
  <div class="processing_text"><%= t('video.processing')%></div>
7
7
  </div>
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "0.4.8".freeze
3
+ VERSION = "0.5.0".freeze
4
4
  end
5
5
  end