Commit 0ddfa8c335623aa758d87210c41d52c879f68c80

Authored by Leandro Santos
2 parents 0dce439f de194b8c

Merge branch 'master' into stable

app/controllers/public/content_viewer_controller.rb
... ... @@ -221,7 +221,7 @@ class ContentViewerController < ApplicationController
221 221 # relation.
222 222 posts = posts.native_translations if blog_with_translation?(@page)
223 223  
224   - @posts = posts.paginate({ :page => params[:npage], :per_page => @page.posts_per_page }.merge(Article.display_filter(user, profile))).to_a
  224 + @posts = posts.display_filter(user, profile).paginate({ :page => params[:npage], :per_page => @page.posts_per_page }).to_a
225 225  
226 226 if blog_with_translation?(@page)
227 227 @posts.replace @posts.map{ |p| p.get_translation_to(FastGettext.locale) }.compact
... ...
app/models/article.rb
... ... @@ -496,15 +496,17 @@ class Article < ActiveRecord::Base
496 496 scope :more_comments, :order => "comments_count DESC"
497 497 scope :more_recent, :order => "created_at DESC"
498 498  
499   - def self.display_filter(user, profile)
500   - return {:conditions => ['articles.published = ?', true]} if !user
  499 + scope :display_filter, lambda {|user, profile|
  500 + user.nil? ?
  501 + {:conditions => ['articles.published = ?', true]} :
501 502 {:conditions => [" articles.published = ? OR
502 503 articles.last_changed_by_id = ? OR
503 504 articles.profile_id = ? OR
504   - ? OR articles.show_to_followers = ? AND ?",
  505 + ? OR articles.show_to_followers = ? AND ? ",
505 506 true, user.id, user.id, user.has_permission?(:view_private_content, profile),
506   - true, user.follows?(profile)]}
507   - end
  507 + true, user.follows?(profile)]
  508 + }
  509 + }
508 510  
509 511  
510 512 def display_unpublished_article_to?(user)
... ...
plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb
... ... @@ -9,7 +9,7 @@ class CustomFormsPluginProfileController < ProfileController
9 9 @submission = CustomFormsPlugin::Submission.find_by_form_id_and_profile_id(@form.id,user.id)
10 10 @submission ||= CustomFormsPlugin::Submission.new(:form => @form, :profile => user)
11 11 else
12   - @submission = CustomFormsPlugin::Submission.new(:form => @for)
  12 + @submission = CustomFormsPlugin::Submission.new(:form => @form)
13 13 end
14 14  
15 15 # build the answers
... ...
plugins/custom_forms/test/functional/custom_forms_plugin_profile_controller_test.rb
... ... @@ -29,6 +29,17 @@ class CustomFormsPluginProfileControllerTest < ActionController::TestCase
29 29 assert_redirected_to :action => 'show'
30 30 end
31 31  
  32 + should 'save submission if fields are ok and user is not logged in' do
  33 + logout
  34 + form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software')
  35 + field = CustomFormsPlugin::TextField.create(:name => 'Name', :form => form)
  36 +
  37 + assert_difference 'CustomFormsPlugin::Submission.count', 1 do
  38 + post :show, :profile => profile.identifier, :id => form.id, :author_name => "john", :author_email => 'john@example.com', :submission => {field.id.to_s => 'Noosfero'}
  39 + end
  40 + assert_redirected_to :action => 'show'
  41 + end
  42 +
32 43 should 'disable fields if form expired' do
33 44 form = CustomFormsPlugin::Form.create!(:profile => profile, :name => 'Free Software', :begining => Time.now + 1.day)
34 45 form.fields << CustomFormsPlugin::TextField.create(:name => 'Field Name', :form => form, :default_value => "First Field")
... ...
plugins/metadata/lib/ext/profile.rb
... ... @@ -5,7 +5,7 @@ class Profile
5 5 metadata_spec namespace: :og, tags: {
6 6 type: MetadataPlugin.og_types[:profile] || :profile,
7 7 image: proc{ |p, plugin| "#{p.environment.top_url}#{p.image.public_filename}" if p.image },
8   - title: proc{ |p, plugin| p.nickname || p.name },
  8 + title: proc{ |p, plugin| if p.nickname.present? then p.nickname else p.name end },
9 9 url: proc do |p, plugin|
10 10 #force profile identifier for custom domains and fixed host. see og_url_for
11 11 plugin.og_url_for p.url.merge(profile: p.identifier)
... ...
po/fr/noosfero.po
... ... @@ -7,8 +7,8 @@ msgstr &quot;&quot;
7 7 "Project-Id-Version: 1.0-690-gcb6e853\n"
8 8 "Report-Msgid-Bugs-To: \n"
9 9 "POT-Creation-Date: 2015-03-05 12:10-0300\n"
10   -"PO-Revision-Date: 2015-03-08 20:40+0200\n"
11   -"Last-Translator: M for Momo <mo@rtnp.org>\n"
  10 +"PO-Revision-Date: 2015-03-12 16:11+0200\n"
  11 +"Last-Translator: Tuux <tuxa@galaxie.eu.org>\n"
12 12 "Language-Team: French "
13 13 "<https://hosted.weblate.org/projects/noosfero/noosfero/fr/>\n"
14 14 "Language: fr\n"
... ... @@ -61,16 +61,12 @@ msgid &quot;&quot;
61 61 msgstr ""
62 62  
63 63 #: app/models/approve_comment.rb:96
64   -#, fuzzy
65 64 msgid "Your request for comment the article \"%{article}\" was approved."
66   -msgstr ""
67   -"%{author} veut publier l'article «%{article}» sur le groupe %{community}"
  65 +msgstr "Votre demande pour commenter l'article \"% {article}\" a été approuvée."
68 66  
69 67 #: app/models/approve_comment.rb:101
70   -#, fuzzy
71 68 msgid "Your request for commenting the article \"%{article}\" was rejected."
72   -msgstr ""
73   -"%{author} veut publier l'article «%{article}» sur le groupe %{community}"
  69 +msgstr "Votre demande de commenter l'article \"% {article}\" a été rejetée."
74 70  
75 71 #: app/models/approve_comment.rb:103
76 72 msgid ""
... ... @@ -120,19 +116,17 @@ msgstr &quot;Nom&quot;
120 116  
121 117 #: app/models/comment.rb:6 app/models/article.rb:18 app/models/article.rb:38
122 118 #: app/models/scrap.rb:6
123   -#, fuzzy
124 119 msgid "Content"
125   -msgstr "Type de contenu"
  120 +msgstr "Contenu"
126 121  
127 122 #: app/models/comment.rb:32
128   -#, fuzzy
129 123 msgid "{fn} can only be informed for unauthenticated authors"
130   -msgstr "%{fn} peut seulement être renseigné pour les auteurs non authentifiés"
  124 +msgstr "{fn} est informé uniquement pour les auteurs non authentifiés"
131 125  
132 126 #: app/models/comment.rb:71
133 127 #, fuzzy
134 128 msgid "(removed user)"
135   -msgstr "Pour ôter %s"
  129 +msgstr "(supprimé par l'utilisateur)"
136 130  
137 131 #: app/models/comment.rb:71
138 132 msgid "(unauthenticated user)"
... ... @@ -173,33 +167,30 @@ msgid &quot;100%&quot;
173 167 msgstr ""
174 168  
175 169 #: app/models/invite_member.rb:20
176   -#, fuzzy
177 170 msgid "Community invitation"
178   -msgstr "Calculs informatisés"
  171 +msgstr "Invitation de la communauté"
179 172  
180 173 #: app/models/invite_member.rb:28
181   -#, fuzzy
182 174 msgid "%{requestor} invited you to join %{linked_subject}."
183   -msgstr "%s veut être membre de %s."
  175 +msgstr "%{requestor} vous invite à rejoindre ce sujet % {linked_subject}."
184 176  
185 177 #: app/models/invite_member.rb:40
186   -#, fuzzy
187 178 msgid "%{requestor} invited you to join %{community}."
188   -msgstr "%s veut être membre de %s."
  179 +msgstr "%{requestor} vous invite à rejoindre la comunautée %{community}."
189 180  
190 181 #: app/models/invite_member.rb:45
191   -#, fuzzy
192 182 msgid "%{requestor} is inviting you to join \"%{community}\" on %{system}."
193   -msgstr "%s veut être membre de %s."
  183 +msgstr ""
  184 +"%{requestor} vous invite à rejoindre la communautée \"%{community}\" sur le "
  185 +"système %{system}."
194 186  
195 187 #: app/models/invite_member.rb:57 app/models/invite_friend.rb:37
196 188 msgid "Hello <friend>,"
197 189 msgstr "Bonjour <contact>,"
198 190  
199 191 #: app/models/invite_member.rb:58
200   -#, fuzzy
201 192 msgid "<user> is inviting you to join \"<community>\" on <environment>."
202   -msgstr "<utilisateur> vous invite à participer à %{environment}."
  193 +msgstr "<user> vous invite à rejoindre la « <community>» sur <environment>."
203 194  
204 195 #: app/models/invite_member.rb:59 app/models/invite_friend.rb:39
205 196 msgid "To accept the invitation, please follow this link:"
... ... @@ -214,14 +205,12 @@ msgid &quot;This block displays some info about your networking.&quot;
214 205 msgstr "Ce bloc affiche de l'information sur votre réseau."
215 206  
216 207 #: app/models/sellers_search_block.rb:6
217   -#, fuzzy
218 208 msgid "Search for enterprises and products"
219   -msgstr "Une recherche d'entreprises par produits"
  209 +msgstr "Recherche de produits et d'entreprises"
220 210  
221 211 #: app/models/sellers_search_block.rb:10
222   -#, fuzzy
223 212 msgid "Products/Enterprises search"
224   -msgstr "Produit|Entrprise"
  213 +msgstr "Recherche de produits ou d'entreprises"
225 214  
226 215 #: app/models/sellers_search_block.rb:14
227 216 msgid "Search for sellers"
... ... @@ -232,9 +221,8 @@ msgid &quot;This block presents a search engine for products.&quot;
232 221 msgstr "Ce bloc présente un moteur de recherche pour les produits."
233 222  
234 223 #: app/models/categories_block.rb:4
235   -#, fuzzy
236 224 msgid "Generic category"
237   -msgstr "Catégorie générale"
  225 +msgstr "Catégorie générique"
238 226  
239 227 #: app/models/categories_block.rb:5 app/helpers/categories_helper.rb:6
240 228 #: app/views/enterprise_registration/basic_information.html.erb:25
... ... @@ -246,23 +234,20 @@ msgid &quot;Product&quot;
246 234 msgstr "Produit"
247 235  
248 236 #: app/models/categories_block.rb:14 app/models/categories_block.rb:18
249   -#, fuzzy
250 237 msgid "Categories Menu"
251   -msgstr "Catégories"
  238 +msgstr "Menu catégories"
252 239  
253 240 #: app/models/categories_block.rb:22
254   -#, fuzzy
255 241 msgid "This block presents the categories like a web site menu."
256   -msgstr "Ce bloc présente l'image du profil."
  242 +msgstr "Ce bloc présente les catégories comme un menu de site web."
257 243  
258 244 #: app/models/contact_list.rb:18
259   -#, fuzzy
260 245 msgid ""
261 246 "There was an error while authenticating. Did you enter correct login and "
262 247 "password?"
263 248 msgstr ""
264   -"Une erreur s'est produite lors de la recherche de votre liste de contacts. "
265   -"Avez-vous entré un identifiant et un mot de passe corrects ?"
  249 +"Il y a eu une erreur lors de l'authentification. Utilisez vous un mot de "
  250 +"passe et un login correcte ?"
266 251  
267 252 #: app/models/contact_list.rb:25
268 253 #, fuzzy
... ...
po/pt/noosfero.po
... ... @@ -13,8 +13,8 @@ msgid &quot;&quot;
13 13 msgstr ""
14 14 "Project-Id-Version: 1.0-690-gcb6e853\n"
15 15 "POT-Creation-Date: 2015-03-05 12:10-0300\n"
16   -"PO-Revision-Date: 2015-03-12 15:42+0200\n"
17   -"Last-Translator: daniel <dtygel@eita.org.br>\n"
  16 +"PO-Revision-Date: 2015-03-13 14:56+0200\n"
  17 +"Last-Translator: TWS <tablettws@gmail.com>\n"
18 18 "Language-Team: Portuguese "
19 19 "<https://hosted.weblate.org/projects/noosfero/noosfero/pt/>\n"
20 20 "Language: pt\n"
... ... @@ -26,15 +26,15 @@ msgstr &quot;&quot;
26 26  
27 27 #: app/models/approve_comment.rb:17
28 28 msgid "Anonymous"
29   -msgstr "Anônimo"
  29 +msgstr "Anonimo"
30 30  
31 31 #: app/models/approve_comment.rb:25 app/models/approve_article.rb:17
32 32 msgid "Article removed."
33   -msgstr "Artigo removido."
  33 +msgstr "Articolo Rimosso."
34 34  
35 35 #: app/models/approve_comment.rb:33
36 36 msgid "New comment to article"
37   -msgstr "Novo comentário para o artigo"
  37 +msgstr "Nuovo commento in questo articolo"
38 38  
39 39 #: app/models/approve_comment.rb:49 app/models/approve_comment.rb:51
40 40 msgid "%{requestor} commented on the article: %{linked_subject}."
... ... @@ -3067,11 +3067,11 @@ msgstr &quot;Privado&quot;
3067 3067  
3068 3068 #: app/helpers/article_helper.rb:100
3069 3069 msgid "For all community members"
3070   -msgstr "Para todas/os as/os integrantes da comunidade"
  3070 +msgstr "Para todos os integrantes da comunidade"
3071 3071  
3072 3072 #: app/helpers/article_helper.rb:100
3073 3073 msgid "For all your friends"
3074   -msgstr "Para todas/os as/os suas/seus amigas/os"
  3074 +msgstr "Para todos os seus amigos"
3075 3075  
3076 3076 #: app/helpers/article_helper.rb:118
3077 3077 msgid "Fill in the search field to add the exception users to see this content"
... ... @@ -4049,21 +4049,21 @@ msgstr &quot;O nome já está sendo utilizado&quot;
4049 4049  
4050 4050 #: app/controllers/admin/templates_controller.rb:47
4051 4051 msgid "Community not found. The template could no be changed."
4052   -msgstr "Comunidade não encontrada. O tema não pôde ser alterado."
  4052 +msgstr "Comunidade não encontrada. O modelo não pôde ser alterado."
4053 4053  
4054 4054 #: app/controllers/admin/templates_controller.rb:51
4055 4055 #: app/controllers/admin/templates_controller.rb:65
4056 4056 #: app/controllers/admin/templates_controller.rb:79
4057 4057 msgid "%s defined as default"
4058   -msgstr "%s foi definido como padrão"
  4058 +msgstr "%s definido como padrão"
4059 4059  
4060 4060 #: app/controllers/admin/templates_controller.rb:61
4061 4061 msgid "Person not found. The template could no be changed."
4062   -msgstr "Pessoa não encontrada. O tema não pôde ser alterado."
  4062 +msgstr "Pessoa não encontrada. O modelo não pôde ser alterado."
4063 4063  
4064 4064 #: app/controllers/admin/templates_controller.rb:75
4065 4065 msgid "Enterprise not found. The template could no be changed."
4066   -msgstr "Empreendimento não encontrado. O tema não pôde ser alterado."
  4066 +msgstr "Empreendimento não encontrado. O modelo não pôde ser alterado."
4067 4067  
4068 4068 #: app/controllers/admin/plugins_controller.rb:12
4069 4069 msgid "Plugins updated successfully."
... ... @@ -5582,7 +5582,7 @@ msgstr &quot;Código HTML&quot;
5582 5582  
5583 5583 #: app/views/box_organizer/index.html.erb:1
5584 5584 msgid "Editing sideboxes"
5585   -msgstr "Editando blocos laterais"
  5585 +msgstr "Editar blocos laterais"
5586 5586  
5587 5587 #: app/views/box_organizer/index.html.erb:4
5588 5588 msgid "Add a block"
... ... @@ -5994,7 +5994,7 @@ msgstr &quot;Desativar perfil&quot;
5994 5994 #: app/views/profile_editor/edit.html.erb:81
5995 5995 #: app/views/profile_editor/edit.html.erb:83
5996 5996 msgid "Are you sure you want to deactivate this profile?"
5997   -msgstr "Tem certeza que quer desativar este perfil?"
  5997 +msgstr "Tem certeza que deseja desativar este perfil?"
5998 5998  
5999 5999 #: app/views/profile_editor/edit.html.erb:83
6000 6000 msgid "Activate profile"
... ... @@ -6588,7 +6588,7 @@ msgstr &quot;Editar modelo \&quot;%s\&quot;&quot;
6588 6588  
6589 6589 #: app/views/templates/index.html.erb:25
6590 6590 msgid "is the default template"
6591   -msgstr "é o tema padrão"
  6591 +msgstr "é o modelo padrão"
6592 6592  
6593 6593 #: app/views/templates/index.html.erb:27
6594 6594 msgid "Set as default"
... ... @@ -6596,7 +6596,7 @@ msgstr &quot;Definir como padrão&quot;
6596 6596  
6597 6597 #: app/views/templates/index.html.erb:27
6598 6598 msgid "Set %s template as default"
6599   -msgstr "Definir o tema %s como padrão"
  6599 +msgstr "Definir o modelo %s como padrão"
6600 6600  
6601 6601 #: app/views/templates/index.html.erb:31
6602 6602 msgid "Edit settings"
... ... @@ -9251,7 +9251,7 @@ msgstr &quot;Gerenciar organizações&quot;
9251 9251  
9252 9252 #: app/views/admin_panel/manage_organizations_status.html.erb:7
9253 9253 msgid "Find profiles"
9254   -msgstr "Encontrar perfis"
  9254 +msgstr "Buscar perfis"
9255 9255  
9256 9256 #: app/views/admin_panel/manage_organizations_status.html.erb:17
9257 9257 msgid "Filter by: "
... ... @@ -9264,11 +9264,11 @@ msgstr &quot;Desativar&quot;
9264 9264 #: app/views/admin_panel/manage_organizations_status.html.erb:44
9265 9265 #: app/views/admin_panel/manage_organizations_status.html.erb:48
9266 9266 msgid "Do you want to deactivate this profile ?"
9267   -msgstr "Você quer desativar esse perfil?"
  9267 +msgstr "Você deseja desativar esse perfil?"
9268 9268  
9269 9269 #: app/views/admin_panel/manage_organizations_status.html.erb:46
9270 9270 msgid "Do you want to activate this profile ?"
9271   -msgstr "Você quer ativar esse perfil?"
  9271 +msgstr "Você deseja ativar esse perfil?"
9272 9272  
9273 9273 #: app/views/admin_panel/set_portal_folders.html.erb:1
9274 9274 msgid "Select folders"
... ...
test/unit/article_test.rb
... ... @@ -1892,4 +1892,130 @@ class ArticleTest &lt; ActiveSupport::TestCase
1892 1892 assert_equal p3, article.author_by_version(3)
1893 1893 end
1894 1894  
  1895 + should 'display_filter display only public articles if there is no user' do
  1896 + p = fast_create(Person)
  1897 + Article.delete_all
  1898 + a = fast_create(Article, :published => true, :profile_id => p.id)
  1899 + fast_create(Article, :published => false, :profile_id => p.id)
  1900 + fast_create(Article, :published => false, :profile_id => p.id)
  1901 + assert_equal [a], Article.display_filter(nil, p)
  1902 + end
  1903 +
  1904 + should 'display_filter display public articles for users' do
  1905 + user = create_user('someuser').person
  1906 + p = fast_create(Person)
  1907 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  1908 + Article.delete_all
  1909 + a = fast_create(Article, :published => true, :profile_id => p.id)
  1910 + fast_create(Article, :published => false, :profile_id => p.id)
  1911 + fast_create(Article, :published => false, :profile_id => p.id)
  1912 + assert_equal [a], Article.display_filter(user, p)
  1913 + end
  1914 +
  1915 + should 'display_filter display private article last changed by user' do
  1916 + user = create_user('someuser').person
  1917 + p = fast_create(Person)
  1918 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  1919 + Article.delete_all
  1920 + a = fast_create(Article, :published => false, :last_changed_by_id => user.id, :profile_id => p.id)
  1921 + fast_create(Article, :published => false, :profile_id => p.id)
  1922 + fast_create(Article, :published => false, :profile_id => p.id)
  1923 + assert_equal [a], Article.display_filter(user, p)
  1924 + end
  1925 +
  1926 + should 'display_filter display user private article of his own profile' do
  1927 + user = create_user('someuser').person
  1928 + user.stubs(:has_permission?).with(:view_private_content, user).returns(false)
  1929 + p = fast_create(Person)
  1930 + Article.delete_all
  1931 + a = fast_create(Article, :published => false, :profile_id => user.id)
  1932 + fast_create(Article, :published => false, :profile_id => p.id)
  1933 + fast_create(Article, :published => false, :profile_id => p.id)
  1934 + assert_equal [a], Article.display_filter(user, user)
  1935 + end
  1936 +
  1937 + should 'display_filter show profile private content if the user has view_private_content permission' do
  1938 + user = create_user('someuser').person
  1939 + p = fast_create(Person)
  1940 + Article.delete_all
  1941 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  1942 + a = fast_create(Article, :published => false, :profile_id => p.id)
  1943 + assert_equal [], Article.display_filter(user, p)
  1944 +
  1945 + user.stubs(:has_permission?).with(:view_private_content, p).returns(true)
  1946 + assert_equal [a], Article.display_filter(user, p)
  1947 + end
  1948 +
  1949 + should 'display_filter show person private content to friends' do
  1950 + user = create_user('someuser').person
  1951 + p = fast_create(Person)
  1952 + p.add_friend(user)
  1953 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  1954 + Article.delete_all
  1955 + a = fast_create(Article, :published => false, :show_to_followers => true, :profile_id => p.id)
  1956 + fast_create(Article, :published => false, :profile_id => p.id)
  1957 + fast_create(Article, :published => false, :profile_id => p.id)
  1958 + assert_equal [a], Article.display_filter(user, p)
  1959 + end
  1960 +
  1961 + should 'display_filter show community private content to members' do
  1962 + user = create_user('someuser').person
  1963 + p = fast_create(Community)
  1964 + p.add_member(user)
  1965 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  1966 + Article.delete_all
  1967 + a = fast_create(Article, :published => false, :show_to_followers => true, :profile_id => p.id)
  1968 + fast_create(Article, :published => false, :profile_id => p.id)
  1969 + fast_create(Article, :published => false, :profile_id => p.id)
  1970 + assert_equal [a], Article.display_filter(user, p)
  1971 + end
  1972 +
  1973 + should 'display_filter do not show person private content to non friends' do
  1974 + user = create_user('someuser').person
  1975 + p = fast_create(Person)
  1976 + assert !p.is_a_friend?(user)
  1977 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  1978 + Article.delete_all
  1979 + a = fast_create(Article, :published => false, :show_to_followers => true, :profile_id => p.id)
  1980 + fast_create(Article, :published => false, :profile_id => p.id)
  1981 + fast_create(Article, :published => false, :profile_id => p.id)
  1982 + assert_equal [], Article.display_filter(user, p)
  1983 + end
  1984 +
  1985 + should 'display_filter do not show community private content to non members' do
  1986 + user = create_user('someuser').person
  1987 + p = fast_create(Community)
  1988 + assert !user.is_member_of?(p)
  1989 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  1990 + Article.delete_all
  1991 + a = fast_create(Article, :published => false, :show_to_followers => true, :profile_id => p.id)
  1992 + fast_create(Article, :published => false, :profile_id => p.id)
  1993 + fast_create(Article, :published => false, :profile_id => p.id)
  1994 + assert_equal [], Article.display_filter(user, p)
  1995 + end
  1996 +
  1997 + should 'display_filter show community public content even it has no followers defined' do
  1998 + user = create_user('someuser').person
  1999 + p = fast_create(Community)
  2000 + assert !user.is_member_of?(p)
  2001 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  2002 + Article.delete_all
  2003 + a = fast_create(Article, :published => true, :show_to_followers => true, :profile_id => p.id)
  2004 + fast_create(Article, :published => false, :profile_id => p.id)
  2005 + fast_create(Article, :published => false, :profile_id => p.id)
  2006 + assert_equal [a], Article.display_filter(user, p)
  2007 + end
  2008 +
  2009 + should 'display_filter show person public content even it has no followers defined' do
  2010 + user = create_user('someuser').person
  2011 + p = fast_create(Community)
  2012 + assert !user.is_a_friend?(p)
  2013 + user.stubs(:has_permission?).with(:view_private_content, p).returns(false)
  2014 + Article.delete_all
  2015 + a = fast_create(Article, :published => true, :show_to_followers => true, :profile_id => p.id)
  2016 + fast_create(Article, :published => false, :profile_id => p.id)
  2017 + fast_create(Article, :published => false, :profile_id => p.id)
  2018 + assert_equal [a], Article.display_filter(user, p)
  2019 + end
  2020 +
1895 2021 end
... ...