Commit 4d39d7f97266813f2a5ccfbca6fa9ed565c9913b
1 parent
c15a029c
Exists in
master
and in
29 other branches
ActionItem616: added explanation and allowed friends
added a table explaining the effects of being a private or public profile and allowed friend to see private profiles git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2399 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
62 additions
and
13 deletions
Show diff stats
app/models/article.rb
... | ... | @@ -150,7 +150,7 @@ class Article < ActiveRecord::Base |
150 | 150 | if user.nil? |
151 | 151 | false |
152 | 152 | else |
153 | - (user == self.profile) || user.memberships.include?(self.profile) | |
153 | + (user == self.profile) || user.memberships.include?(self.profile) || (profile.kind_of?(Person) && profile.friends.include?(user)) | |
154 | 154 | end |
155 | 155 | end |
156 | 156 | end | ... | ... |
app/models/person.rb
app/views/profile_editor/edit.rhtml
... | ... | @@ -24,17 +24,40 @@ |
24 | 24 | <%= _('Private') %> |
25 | 25 | </div> |
26 | 26 | </p> |
27 | - <p> | |
28 | - <%= _("This profile's content is:") %> | |
29 | - <div> | |
30 | - <%= radio_button 'profile_data', 'public_content', 'true' %> | |
31 | - <%= _('Public') %> | |
32 | - </div> | |
33 | - <div> | |
34 | - <%= radio_button 'profile_data', 'public_content', 'false' %> | |
35 | - <%= _('Private') %> | |
36 | - </div> | |
37 | - </p> | |
27 | + | |
28 | + <% if profile.kind_of?(Person) %> | |
29 | + <table> | |
30 | + <tr><th></th><th><%= _('Public') %></th><th><%= _('Private') %></th></tr> | |
31 | + <tr> | |
32 | + <td> <%= _('Activate Intranet access (restricted area only for me)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td> | |
33 | + </tr> | |
34 | + <tr> | |
35 | + <td> <%= _('Show my website to all internet users') %> </td><td><%= _('Yes') %></td><td><%= _('No') %></td> | |
36 | + </tr> | |
37 | + <tr> | |
38 | + <td> <%= _('Show my website to my contacts (persons)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td> | |
39 | + </tr> | |
40 | + <tr> | |
41 | + <td> <%= _('Include my contact in directory of people') %> </td><td><%= _('Yes') %></td><td><%= _('No') %></td> | |
42 | + </tr> | |
43 | + </table> | |
44 | + <% else %> | |
45 | + <table> | |
46 | + <tr><th></th><th><%= _('Public') %></th><th><%= _('Private') %></th></tr> | |
47 | + <tr> | |
48 | + <td> <%= _('Activate Intranet access (restricted area only for members)') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td> | |
49 | + </tr> | |
50 | + <tr> | |
51 | + <td> <%= _('Show website of this group to all internet users') %> </td><td><%= _('Yes') %></td><td><%= _('No') %></td> | |
52 | + </tr> | |
53 | + <tr> | |
54 | + <td> <%= _('Show my website to members') %> </td><td><%= _('Yes') %></td><td><%= _('Yes') %></td> | |
55 | + </tr> | |
56 | + <tr> | |
57 | + <td> <%= _('Include this group directory of groups') %> </td><td><%= _('Yes') %></td><td><%= _('No') %></td> | |
58 | + </tr> | |
59 | + </table> | |
60 | + <% end %> | |
38 | 61 | |
39 | 62 | <%= select_categories(:profile_data, _('Select the categories of your interest'), 1) %> |
40 | 63 | ... | ... |
test/unit/article_test.rb
... | ... | @@ -401,8 +401,17 @@ class ArticleTest < Test::Unit::TestCase |
401 | 401 | article.reload |
402 | 402 | |
403 | 403 | assert !article.public_article |
404 | + end | |
404 | 405 | |
406 | + should 'allow friends of private person see the article' do | |
407 | + person = create_user('test_user').person | |
408 | + article = Article.create!(:name => 'test article', :profile => person, :public_article => false) | |
409 | + friend = create_user('test_friend').person | |
410 | + person.add_friend(friend) | |
411 | + person.save! | |
412 | + friend.save! | |
405 | 413 | |
414 | + assert article.display_to?(friend) | |
406 | 415 | end |
407 | 416 | |
408 | 417 | end | ... | ... |
test/unit/person_test.rb
... | ... | @@ -268,5 +268,15 @@ class PersonTest < Test::Unit::TestCase |
268 | 268 | |
269 | 269 | assert_equal ['testuser@somedomain.com'], person.email_addresses |
270 | 270 | end |
271 | + | |
272 | + should 'show profile info to friend' do | |
273 | + person = create_user('test_user').person | |
274 | + person.public_profile = false | |
275 | + person.save! | |
276 | + friend = create_user('test_friend').person | |
277 | + person.add_friend(friend) | |
278 | + | |
279 | + assert person.display_info_to?(friend) | |
280 | + end | |
271 | 281 | |
272 | 282 | end | ... | ... |