Commit d5f45e5e7d87d114183317e5ff9f016425e90671
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'master' into production
Showing
9 changed files
with
26 additions
and
15 deletions
Show diff stats
.travis.yml
... | ... | @@ -19,13 +19,6 @@ addons: |
19 | 19 | - libsqlite3-dev |
20 | 20 | - libxslt1-dev |
21 | 21 | |
22 | -before_install: | |
23 | -# FIXME: workaround while https://github.com/travis-ci/travis-ci/issues/4210 is open | |
24 | - - rm config/initializers/default_icon_theme.rb | |
25 | -# selenium support | |
26 | - - export DISPLAY=:99.0 | |
27 | - - sh -e /etc/init.d/xvfb start | |
28 | - | |
29 | 22 | before_script: |
30 | 23 | - mkdir -p tmp/pids log |
31 | 24 | - bundle check || bundle install | ... | ... |
app/models/article.rb
... | ... | @@ -510,9 +510,9 @@ class Article < ActiveRecord::Base |
510 | 510 | where( |
511 | 511 | [ |
512 | 512 | "published = ? OR last_changed_by_id = ? OR profile_id = ? OR ? |
513 | - OR (show_to_followers = ? AND ? AND profile_id = ?)", true, user.id, user.id, | |
513 | + OR (show_to_followers = ? AND ? AND profile_id IN (?))", true, user.id, user.id, | |
514 | 514 | profile.nil? ? false : user.has_permission?(:view_private_content, profile), |
515 | - true, user.follows?(profile), (profile.nil? ? nil : profile.id) | |
515 | + true, (profile.nil? ? true : user.follows?(profile)), ( profile.nil? ? (user.friends.select('profiles.id')) : [profile.id]) | |
516 | 516 | ] |
517 | 517 | ) |
518 | 518 | } | ... | ... |
plugins/event/lib/event_plugin/event_block.rb
... | ... | @@ -26,8 +26,8 @@ class EventPlugin::EventBlock < Block |
26 | 26 | end |
27 | 27 | |
28 | 28 | def events(user = nil) |
29 | - events = events_source.events | |
30 | - events = events.published.order('start_date') | |
29 | + events = events_source.events.order('start_date') | |
30 | + events = user.nil? ? events.public : events.display_filter(user,nil) | |
31 | 31 | |
32 | 32 | if future_only |
33 | 33 | events = events.where('start_date >= ?', Date.today) | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +require_relative '../../../test/test_helper' | ... | ... |
plugins/event/test/unit/event_block_test.rb
1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
1 | +require_relative '../test_helper' | |
2 | 2 | |
3 | -class EventPlugin::EventBlockTest < ActiveSupport::TestCase | |
3 | +class EventBlockTest < ActiveSupport::TestCase | |
4 | 4 | |
5 | 5 | def setup |
6 | 6 | @env = Environment.default |
... | ... | @@ -165,7 +165,7 @@ class EventPlugin::EventBlockTest < ActiveSupport::TestCase |
165 | 165 | |
166 | 166 | def visibility_content_test_from_a_profile(profile) |
167 | 167 | @block.box.owner = @env |
168 | - ev = fast_create Event, :name => '2 de Julho', :profile_id => profile.id | |
168 | + ev = Event.create!(:name => '2 de Julho', :profile => profile) | |
169 | 169 | @block.all_env_events = true |
170 | 170 | |
171 | 171 | # Do not list event from private profile for non logged visitor | ... | ... |
plugins/event/test/unit/event_plugin_test.rb
plugins/sub_organizations/db/migrate/20150508153119_add_timestamp_to_relation.rb
... | ... | @@ -2,5 +2,7 @@ class AddTimestampToRelation < ActiveRecord::Migration |
2 | 2 | def change |
3 | 3 | add_column :sub_organizations_plugin_relations, :created_at, :datetime |
4 | 4 | add_column :sub_organizations_plugin_relations, :updated_at, :datetime |
5 | + add_column :sub_organizations_plugin_approve_paternity_relations, :created_at, :datetime | |
6 | + add_column :sub_organizations_plugin_approve_paternity_relations, :updated_at, :datetime | |
5 | 7 | end |
6 | 8 | end | ... | ... |
script/quick-start
test/unit/article_test.rb
... | ... | @@ -1971,6 +1971,19 @@ class ArticleTest < ActiveSupport::TestCase |
1971 | 1971 | assert_equal [a], Article.display_filter(user, p) |
1972 | 1972 | end |
1973 | 1973 | |
1974 | + should 'display_filter show person private content to friends when no profile is passed as parameter' do | |
1975 | + user = create_user('someuser').person | |
1976 | + p = fast_create(Person) | |
1977 | + user.add_friend(p) | |
1978 | + user.stubs(:has_permission?).with(:view_private_content, p).returns(false) | |
1979 | + Article.delete_all | |
1980 | + a = fast_create(Article, :published => false, :show_to_followers => true, :profile_id => p.id) | |
1981 | + fast_create(Article, :published => false, :show_to_followers => false, :profile_id => p.id) | |
1982 | + fast_create(Article, :published => false, :show_to_followers => false, :profile_id => p.id) | |
1983 | + assert_equal [a], Article.display_filter(user, nil) | |
1984 | + end | |
1985 | + | |
1986 | + | |
1974 | 1987 | should 'display_filter show community private content to members' do |
1975 | 1988 | user = create_user('someuser').person |
1976 | 1989 | p = fast_create(Community) | ... | ... |