Commit 74a9b8cb5d44001af0a3814f06804bd318866253
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'register_performance' into production
Conflicts: Gemfile
Showing
4 changed files
with
28 additions
and
15 deletions
Show diff stats
.gitlab-ci.yml
... | ... | @@ -2,7 +2,7 @@ before_script: |
2 | 2 | - mkdir -p tmp/pids log |
3 | 3 | - bundle check || bundle install |
4 | 4 | - script/noosfero-plugins disableall |
5 | - - rm -f tmp/makemo.stamp && rake makemo &>/dev/null | |
5 | + - bundle exec rake makemo &>/dev/null | |
6 | 6 | # database |
7 | 7 | - cp config/database.yml.gitlab-ci config/database.yml |
8 | 8 | - createdb gitlab_ci_test || true | ... | ... |
.travis.yml
... | ... | @@ -2,12 +2,26 @@ language: ruby |
2 | 2 | rvm: |
3 | 3 | # for 2.2 support we need to upgrade the pg gem |
4 | 4 | - 2.1.6 |
5 | +cache: bundler | |
6 | + | |
7 | +sudo: false | |
8 | +addons: | |
9 | + apt: | |
10 | + packages: | |
11 | + - po4a | |
12 | + - iso-codes | |
13 | + - tango-icon-theme | |
14 | + - pidgin-data | |
15 | + # for gem extensions | |
16 | + - libmagickwand-dev | |
17 | + - libpq-dev | |
18 | + - libreadline-dev | |
19 | + - libsqlite3-dev | |
20 | + - libxslt1-dev | |
5 | 21 | |
6 | 22 | before_install: |
7 | -# dependencies | |
8 | - - sudo apt-get update | |
9 | - - sudo apt-get -y install po4a iso-codes tango-icon-theme pidgin-data default-jre | |
10 | - - sudo apt-get -y install libmagickwand-dev libpq-dev libreadline-dev libsqlite3-dev libxslt1-dev | |
23 | +# FIXME: workaround while https://github.com/travis-ci/travis-ci/issues/4210 is open | |
24 | + - rm config/initializers/default_icon_theme.rb | |
11 | 25 | # selenium support |
12 | 26 | - export DISPLAY=:99.0 |
13 | 27 | - sh -e /etc/init.d/xvfb start |
... | ... | @@ -16,12 +30,12 @@ before_script: |
16 | 30 | - mkdir -p tmp/pids log |
17 | 31 | - bundle check || bundle install |
18 | 32 | - script/noosfero-plugins disableall |
19 | - - rake makemo | |
33 | + - bundle exec rake makemo &>/dev/null | |
20 | 34 | # database |
21 | 35 | - cp config/database.yml.travis config/database.yml |
22 | 36 | - psql -c 'create database myapp_test;' -U postgres |
23 | - - bundle exec rake db:schema:load | |
24 | - - bundle exec rake db:migrate | |
37 | + - bundle exec rake db:schema:load &>/dev/null | |
38 | + - bundle exec rake db:migrate &>/dev/null | |
25 | 39 | |
26 | 40 | env: |
27 | 41 | - TASK=test:units | ... | ... |
Gemfile
... | ... | @@ -18,7 +18,6 @@ gem 'exception_notification', '~> 4.0.1' |
18 | 18 | gem 'gettext', '~> 2.2.1', :require => false |
19 | 19 | gem 'locale', '~> 2.0.5' |
20 | 20 | gem 'whenever', :require => false |
21 | -gem 'eita-jrails', '= 0.9.5', :require => 'jrails' | |
22 | 21 | gem 'grape', '~> 0.11.0' |
23 | 22 | gem 'grape-entity' |
24 | 23 | gem 'grape-swagger' |
... | ... | @@ -31,6 +30,7 @@ gem 'liquid', '~> 3.0.3' |
31 | 30 | |
32 | 31 | # FIXME list here all actual dependencies (i.e. the ones in debian/control), |
33 | 32 | # with their GEM names (not the Debian package names) |
33 | +gem 'eita-jrails', '~> 0.9.5', require: 'jrails' | |
34 | 34 | |
35 | 35 | # asset pipeline |
36 | 36 | gem 'uglifier', '>= 1.0.3' | ... | ... |
app/models/profile.rb
... | ... | @@ -432,7 +432,7 @@ class Profile < ActiveRecord::Base |
432 | 432 | end |
433 | 433 | |
434 | 434 | # registar callback for creating boxes after the object is created. |
435 | - after_create :create_default_set_of_boxes | |
435 | + before_create :create_default_set_of_boxes | |
436 | 436 | |
437 | 437 | # creates the initial set of boxes when the profile is created. Can be |
438 | 438 | # overriden for each subclass to create a custom set of boxes for its |
... | ... | @@ -498,9 +498,6 @@ class Profile < ActiveRecord::Base |
498 | 498 | self.custom_footer = template[:custom_footer] |
499 | 499 | self.custom_header = template[:custom_header] |
500 | 500 | self.public_profile = template.public_profile |
501 | - | |
502 | - # flush | |
503 | - self.save(:validate => false) | |
504 | 501 | end |
505 | 502 | |
506 | 503 | def apply_type_specific_template(template) |
... | ... | @@ -693,15 +690,15 @@ private :generate_url, :url_options |
693 | 690 | after_create :insert_default_article_set |
694 | 691 | def insert_default_article_set |
695 | 692 | if template |
696 | - copy_articles_from template | |
693 | + self.save! if copy_articles_from template | |
697 | 694 | else |
698 | 695 | default_set_of_articles.each do |article| |
699 | 696 | article.profile = self |
700 | 697 | article.advertise = false |
701 | 698 | article.save! |
702 | 699 | end |
700 | + self.save! | |
703 | 701 | end |
704 | - self.save! | |
705 | 702 | end |
706 | 703 | |
707 | 704 | # Override this method in subclasses of Profile to create a default article |
... | ... | @@ -722,10 +719,12 @@ private :generate_url, :url_options |
722 | 719 | end |
723 | 720 | |
724 | 721 | def copy_articles_from other |
722 | + return false if other.top_level_articles.empty? | |
725 | 723 | other.top_level_articles.each do |a| |
726 | 724 | copy_article_tree a |
727 | 725 | end |
728 | 726 | self.articles.reload |
727 | + true | |
729 | 728 | end |
730 | 729 | |
731 | 730 | def copy_article_tree(article, parent=nil) | ... | ... |