[Git][noosfero/noosfero][master] 2 commits: Wont call in_social_circle? for blocks in the Enviroment
Leandro Nunes
gitlab at mg.gitlab.com
Thu Jun 29 15:12:32 BRT 2017
Leandro Nunes pushed to branch master at Noosfero / noosfero
Commits:
fead38c2 by Evandro Junior at 2017-06-29T13:24:54-03:00
Wont call in_social_circle? for blocks in the Enviroment
- - - - -
f7278e72 by Leandro Nunes at 2017-06-29T18:12:00+00:00
Merge branch 'fix_calling_in_social_circle_for_environment' into 'master'
Won't call in_social_circle? for blocks in the Enviroment
Closes noosfero-themes/angular-theme#569
See merge request !1261
- - - - -
2 changed files:
- app/models/block.rb
- test/unit/block_test.rb
Changes:
=====================================
app/models/block.rb
=====================================
--- a/app/models/block.rb
+++ b/app/models/block.rb
@@ -103,7 +103,7 @@ class Block < ApplicationRecord
end
def display_to_user?(user)
- display_user == 'all' || (user.nil? && display_user == 'not_logged') || (user && display_user == 'logged') || (user && display_user == 'followers' && owner.in_social_circle?(user))
+ display_user == 'all' || (user.nil? && display_user == 'not_logged') || (user && display_user == 'logged') || (user && !self.owner.kind_of?(Environment) && display_user == 'followers' && owner.in_social_circle?(user) && self.owner.kind_of?(Profile))
end
def display_always(context)
=====================================
test/unit/block_test.rb
=====================================
--- a/test/unit/block_test.rb
+++ b/test/unit/block_test.rb
@@ -355,6 +355,17 @@ class BlockTest < ActiveSupport::TestCase
refute block.display_to_user?(person_friend)
end
+ should 'do not display block to friend if the owner of the block is an enviroment' do
+ person = create_user('person_one').person
+ person_friend = create_user('person_friend').person
+ person.add_friend(person_friend)
+ box = fast_create(Box, :owner_id => Environment.default, :owner_type => 'Environment')
+ block = create(Block, :box_id => box.id)
+ block.display_user = 'followers'
+ block.save!
+ refute block.display_to_user?(person_friend)
+ end
+
should 'get limit as a number when limit is string' do
block = RecentDocumentsBlock.new
block.settings[:limit] = '5'
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/db07f4fe3060ef5aaf76ece2a2f3f4498da4b1ae...f7278e72bfc183adde8c5ce2d6e2f8bff8b81c74
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/db07f4fe3060ef5aaf76ece2a2f3f4498da4b1ae...f7278e72bfc183adde8c5ce2d6e2f8bff8b81c74
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170629/e9fcce9f/attachment-0001.html>
More information about the Noosfero-dev
mailing list