Commit 58e6280d60130b0eec7116233c538d4283de1b37
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'staging' of gitlab.com:participa/noosfero into staging
Showing
4 changed files
with
24 additions
and
2 deletions
Show diff stats
lib/noosfero/api/helpers.rb
| ... | ... | @@ -34,7 +34,6 @@ require 'grape' |
| 34 | 34 | def current_user |
| 35 | 35 | private_token = (params[PRIVATE_TOKEN_PARAM] || headers['Private-Token']).to_s |
| 36 | 36 | @current_user ||= User.find_by_private_token(private_token) |
| 37 | - @current_user = nil if !@current_user.nil? && @current_user.private_token_expired? | |
| 38 | 37 | @current_user |
| 39 | 38 | end |
| 40 | 39 | ... | ... |
plugins/community_track/test/functional/community_track_plugin_cms_controller_test.rb
| ... | ... | @@ -6,6 +6,9 @@ class CmsController; def rescue_action(e) raise e end; end |
| 6 | 6 | class CmsControllerTest < ActionController::TestCase |
| 7 | 7 | |
| 8 | 8 | def setup |
| 9 | + @environment = Environment.default | |
| 10 | + @environment.enabled_plugins = ['CommunityTrackPlugin'] | |
| 11 | + @environment.save! | |
| 9 | 12 | @profile = fast_create(Community) |
| 10 | 13 | @track = create_track('track', @profile) |
| 11 | 14 | @step = CommunityTrackPlugin::Step.create!(:name => 'step1', :body => 'body', :profile => @profile, :parent => @track, :published => false, :end_date => Date.today, :start_date => Date.today) |
| ... | ... | @@ -39,4 +42,15 @@ class CmsControllerTest < ActionController::TestCase |
| 39 | 42 | assert_equal 'changed', @step.name |
| 40 | 43 | end |
| 41 | 44 | |
| 45 | + should 'have parent_id present in form' do | |
| 46 | + get :new, :parent_id => @track.id, :profile => @profile.identifier, :type => CommunityTrackPlugin::Step | |
| 47 | + assert_tag :tag => 'input', :attributes => { :name => 'parent_id' } | |
| 48 | + end | |
| 49 | + | |
| 50 | + should 'be able to create an step with a parent' do | |
| 51 | + amount_of_steps = CommunityTrackPlugin::Step.count | |
| 52 | + post :new, :parent_id => @track.id, :profile => @profile.identifier, :type => CommunityTrackPlugin::Step, :article => {:name => 'some', :body => 'some'} | |
| 53 | + assert_equal amount_of_steps + 1, CommunityTrackPlugin::Step.count | |
| 54 | + end | |
| 55 | + | |
| 42 | 56 | end | ... | ... |
plugins/community_track/views/cms/community_track_plugin/_step.html.erb
| ... | ... | @@ -14,6 +14,8 @@ |
| 14 | 14 | |
| 15 | 15 | <%= labelled_form_field(_('Tool type'), select(:article, :tool_type, @article.enabled_tools.map {|t| [t.short_description, t.name]} )) %> |
| 16 | 16 | <%= hidden_field_tag('success_back_to', url_for(@article.parent.view_url)) %> |
| 17 | + <%= hidden_field_tag('parent_id', @article.parent_id) %> | |
| 18 | + | |
| 17 | 19 | </div> |
| 18 | 20 | |
| 19 | 21 | <%= labelled_form_field check_box(:article, :hidden) + _('Hidden Step'), '' %> | ... | ... |
script/production
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | set -e |
| 4 | 4 | |
| 5 | +TIMEOUT=60 | |
| 6 | + | |
| 5 | 7 | if [ -e /etc/default/noosfero ]; then |
| 6 | 8 | . /etc/default/noosfero |
| 7 | 9 | fi |
| ... | ... | @@ -40,7 +42,12 @@ app_server_stop() { |
| 40 | 42 | app_server_restart() { |
| 41 | 43 | # see unicorn_rails(1) and "Signal handling" in unicorn documentation |
| 42 | 44 | kill -s USR2 $(cat tmp/pids/unicorn.pid) |
| 43 | - sleep 5 | |
| 45 | + count=0 | |
| 46 | + while [ ! -f tmp/pids/unicorn.pid.oldbin || $count > $TIMEOUT ] | |
| 47 | + do | |
| 48 | + echo "Waitting for $count" | |
| 49 | + sleep 1 | |
| 50 | + done | |
| 44 | 51 | kill -s QUIT $(cat tmp/pids/unicorn.pid.oldbin) |
| 45 | 52 | } |
| 46 | 53 | ... | ... |