Commit 02d5269c396935cf2ed39aeb9efe34ae2a1aa23e
Exists in
api_private_token
and in
2 other branches
Merge branch 'master' into api
Showing
12 changed files
with
41 additions
and
16 deletions
Show diff stats
.travis.yml
@@ -19,13 +19,6 @@ addons: | @@ -19,13 +19,6 @@ addons: | ||
19 | - libsqlite3-dev | 19 | - libsqlite3-dev |
20 | - libxslt1-dev | 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 | before_script: | 22 | before_script: |
30 | - mkdir -p tmp/pids log | 23 | - mkdir -p tmp/pids log |
31 | - bundle check || bundle install | 24 | - bundle check || bundle install |
app/models/article.rb
@@ -506,9 +506,9 @@ class Article < ActiveRecord::Base | @@ -506,9 +506,9 @@ class Article < ActiveRecord::Base | ||
506 | where( | 506 | where( |
507 | [ | 507 | [ |
508 | "published = ? OR last_changed_by_id = ? OR profile_id = ? OR ? | 508 | "published = ? OR last_changed_by_id = ? OR profile_id = ? OR ? |
509 | - OR (show_to_followers = ? AND ? AND profile_id = ?)", true, user.id, user.id, | 509 | + OR (show_to_followers = ? AND ? AND profile_id IN (?))", true, user.id, user.id, |
510 | profile.nil? ? false : user.has_permission?(:view_private_content, profile), | 510 | profile.nil? ? false : user.has_permission?(:view_private_content, profile), |
511 | - true, user.follows?(profile), (profile.nil? ? nil : profile.id) | 511 | + true, (profile.nil? ? true : user.follows?(profile)), ( profile.nil? ? (user.friends.select('profiles.id')) : [profile.id]) |
512 | ] | 512 | ] |
513 | ) | 513 | ) |
514 | } | 514 | } |
app/models/highlights_block.rb
@@ -12,6 +12,7 @@ class HighlightsBlock < Block | @@ -12,6 +12,7 @@ class HighlightsBlock < Block | ||
12 | block.images.each do |i| | 12 | block.images.each do |i| |
13 | i[:image_id] = i[:image_id].to_i | 13 | i[:image_id] = i[:image_id].to_i |
14 | i[:position] = i[:position].to_i | 14 | i[:position] = i[:position].to_i |
15 | + i[:address] = Noosfero.root + i[:address] unless Noosfero.root.nil? | ||
15 | begin | 16 | begin |
16 | file = UploadedFile.find(i[:image_id]) | 17 | file = UploadedFile.find(i[:image_id]) |
17 | i[:image_src] = file.public_filename | 18 | i[:image_src] = file.public_filename |
plugins/event/lib/event_plugin/event_block.rb
@@ -26,8 +26,8 @@ class EventPlugin::EventBlock < Block | @@ -26,8 +26,8 @@ class EventPlugin::EventBlock < Block | ||
26 | end | 26 | end |
27 | 27 | ||
28 | def events(user = nil) | 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 | if future_only | 32 | if future_only |
33 | events = events.where('start_date >= ?', Date.today) | 33 | events = events.where('start_date >= ?', Date.today) |
@@ -0,0 +1 @@ | @@ -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 | def setup | 5 | def setup |
6 | @env = Environment.default | 6 | @env = Environment.default |
@@ -165,7 +165,7 @@ class EventPlugin::EventBlockTest < ActiveSupport::TestCase | @@ -165,7 +165,7 @@ class EventPlugin::EventBlockTest < ActiveSupport::TestCase | ||
165 | 165 | ||
166 | def visibility_content_test_from_a_profile(profile) | 166 | def visibility_content_test_from_a_profile(profile) |
167 | @block.box.owner = @env | 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 | @block.all_env_events = true | 169 | @block.all_env_events = true |
170 | 170 | ||
171 | # Do not list event from private profile for non logged visitor | 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,5 +2,7 @@ class AddTimestampToRelation < ActiveRecord::Migration | ||
2 | def change | 2 | def change |
3 | add_column :sub_organizations_plugin_relations, :created_at, :datetime | 3 | add_column :sub_organizations_plugin_relations, :created_at, :datetime |
4 | add_column :sub_organizations_plugin_relations, :updated_at, :datetime | 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 | end | 7 | end |
6 | end | 8 | end |
public/javascripts/manage-categories.js
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | fetch_sub_items = function(sub_items, category){ | 2 | fetch_sub_items = function(sub_items, category){ |
3 | loading_for_button($("#category-loading-"+category)[0]); | 3 | loading_for_button($("#category-loading-"+category)[0]); |
4 | $.ajax({ | 4 | $.ajax({ |
5 | - url: "/admin/categories/get_children", | 5 | + url: noosfero_root() + "/admin/categories/get_children", |
6 | dataType: "html", | 6 | dataType: "html", |
7 | data: {id: category}, | 7 | data: {id: category}, |
8 | success: function(data, st, ajax){ | 8 | success: function(data, st, ajax){ |
script/quick-start
@@ -61,6 +61,8 @@ setup_rubygems_path() { | @@ -61,6 +61,8 @@ setup_rubygems_path() { | ||
61 | fi | 61 | fi |
62 | } | 62 | } |
63 | 63 | ||
64 | +# change current directory to the noosfero's root | ||
65 | +cd "$(dirname $0)/../" | ||
64 | 66 | ||
65 | force_install=false | 67 | force_install=false |
66 | if test "$1" = '--force-install'; then | 68 | if test "$1" = '--force-install'; then |
test/unit/article_test.rb
@@ -1971,6 +1971,19 @@ class ArticleTest < ActiveSupport::TestCase | @@ -1971,6 +1971,19 @@ class ArticleTest < ActiveSupport::TestCase | ||
1971 | assert_equal [a], Article.display_filter(user, p) | 1971 | assert_equal [a], Article.display_filter(user, p) |
1972 | end | 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 | should 'display_filter show community private content to members' do | 1987 | should 'display_filter show community private content to members' do |
1975 | user = create_user('someuser').person | 1988 | user = create_user('someuser').person |
1976 | p = fast_create(Community) | 1989 | p = fast_create(Community) |
test/unit/highlights_block_test.rb
@@ -119,6 +119,19 @@ class HighlightsBlockTest < ActiveSupport::TestCase | @@ -119,6 +119,19 @@ class HighlightsBlockTest < ActiveSupport::TestCase | ||
119 | block.featured_images | 119 | block.featured_images |
120 | end | 120 | end |
121 | 121 | ||
122 | + should 'return correct sub-dir address' do | ||
123 | + Noosfero.stubs(:root).returns("/social") | ||
124 | + f1 = mock() | ||
125 | + f1.expects(:public_filename).returns('address') | ||
126 | + UploadedFile.expects(:find).with(1).returns(f1) | ||
127 | + block = HighlightsBlock.new | ||
128 | + i1 = {:image_id => 1, :address => '/address', :position => 3, :title => 'address'} | ||
129 | + block.images = [i1] | ||
130 | + block.save! | ||
131 | + block.reload | ||
132 | + assert_equal block.images.first[:address], "/social/address" | ||
133 | + end | ||
134 | + | ||
122 | [Environment, Profile].each do |klass| | 135 | [Environment, Profile].each do |klass| |
123 | should "choose between owner galleries when owner is #{klass.name}" do | 136 | should "choose between owner galleries when owner is #{klass.name}" do |
124 | owner = fast_create(klass) | 137 | owner = fast_create(klass) |