diff options
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 54 | ||||
-rw-r--r-- | app/controllers/api_controller.rb | 5 | ||||
-rw-r--r-- | config/deploy.rb | 13 | ||||
-rwxr-xr-x | script/install-as-user | 4 | ||||
-rw-r--r-- | spec/controllers/api_controller_spec.rb | 12 |
6 files changed, 52 insertions, 38 deletions
@@ -7,7 +7,7 @@ if File.exist? "/etc/debian_version" and File.open("/etc/debian_version").read.s end source 'https://rubygems.org' -gem 'rails', '3.2.16' +gem 'rails', '3.2.17' gem 'pg' diff --git a/Gemfile.lock b/Gemfile.lock index 62258c0c6..a1c26620a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,12 +18,12 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (3.2.16) - actionpack (= 3.2.16) + actionmailer (3.2.17) + actionpack (= 3.2.17) mail (~> 2.5.4) - actionpack (3.2.16) - activemodel (= 3.2.16) - activesupport (= 3.2.16) + actionpack (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -31,18 +31,18 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.16) - activesupport (= 3.2.16) + activemodel (3.2.17) + activesupport (= 3.2.17) builder (~> 3.0.0) - activerecord (3.2.16) - activemodel (= 3.2.16) - activesupport (= 3.2.16) + activerecord (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.16) - activemodel (= 3.2.16) - activesupport (= 3.2.16) - activesupport (3.2.16) + activeresource (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) + activesupport (3.2.17) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) annotate (2.5.0) @@ -140,7 +140,7 @@ GEM thin (~> 1.5.0) memcache-client (1.8.5) mime-types (1.25.1) - multi_json (1.8.2) + multi_json (1.8.4) net-http-local (0.1.2) net-purge (0.1.0) net-scp (1.1.1) @@ -156,7 +156,7 @@ GEM activerecord (~> 3.0) railties (~> 3.0) pg (0.15.1) - polyglot (0.3.3) + polyglot (0.3.4) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) @@ -166,19 +166,19 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.16) - actionmailer (= 3.2.16) - actionpack (= 3.2.16) - activerecord (= 3.2.16) - activeresource (= 3.2.16) - activesupport (= 3.2.16) + rails (3.2.17) + actionmailer (= 3.2.17) + actionpack (= 3.2.17) + activerecord (= 3.2.17) + activeresource (= 3.2.17) + activesupport (= 3.2.17) bundler (~> 1.0) - railties (= 3.2.16) + railties (= 3.2.17) rails-i18n (0.7.3) i18n (~> 0.5) - railties (3.2.16) - actionpack (= 3.2.16) - activesupport (= 3.2.16) + railties (3.2.17) + actionpack (= 3.2.17) + activesupport (= 3.2.17) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -306,7 +306,7 @@ DEPENDENCIES nokogiri pg rack - rails (= 3.2.16) + rails (= 3.2.17) rails-i18n rake (= 0.9.2.2) rdoc diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 00a3beebd..e6b0c121a 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -16,11 +16,14 @@ class ApiController < ApplicationController :status => @request.calculate_status, :public_body_url => make_url("body", @request.public_body.url_name), - :requestor_url => make_url("user", @request.user.url_name), + :request_email => @request.incoming_email, :request_text => @request.last_event_forming_initial_request.outgoing_message.body, } + if @request.user + @request_data[:requestor_url] = make_url("user", @request.user.url_name) + end render :json => @request_data end diff --git a/config/deploy.rb b/config/deploy.rb index 3a4f175b4..c73d16f53 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -17,14 +17,13 @@ set :rails_env, configuration['rails_env'] server configuration['server'], :app, :web, :db, :primary => true -namespace :rake do - namespace :themes do - task :install do - run "cd #{latest_release} && bundle exec rake themes:install RAILS_ENV=#{rails_env}" - end +namespace :themes do + task :install do + run "cd #{latest_release} && bundle exec rake themes:install RAILS_ENV=#{rails_env}" end end + # Not in the rake namespace because we're also specifying app-specific arguments here namespace :xapian do desc 'Rebuilds the Xapian index as per the ./scripts/rebuild-xapian-index script' @@ -71,8 +70,8 @@ namespace :deploy do end end -after 'deploy:update_code', 'deploy:symlink_configuration' -after 'deploy:update_code', 'rake:themes:install' +before 'deploy:assets:precompile', 'deploy:symlink_configuration' +before 'deploy:assets:precompile', 'themes:install' # Put up a maintenance notice if doing a migration which could take a while before 'deploy:migrate', 'deploy:web:disable' diff --git a/script/install-as-user b/script/install-as-user index 4fc341fc6..aaad52145 100755 --- a/script/install-as-user +++ b/script/install-as-user @@ -93,8 +93,8 @@ then -e "s,^( *DOMAIN:).*,\\1 '$HOST'," \ -e "s,^( *FORCE_SSL:).*,\\1 false," \ -e "s,^( *TIME_ZONE:).*,\\1 'Europe/London'," \ - -e "s,^( *BLOG_FEED:).*,\\1 null," \ - -e "s,^( *TWITTER_USERNAME:).*,\\1 null," \ + -e "s,^( *BLOG_FEED:).*,\\1 ''," \ + -e "s,^( *TWITTER_USERNAME:).*,\\1 ''," \ -e "s,^( *INCLUDE_DEFAULT_LOCALE_IN_URLS:).*,\\1 false," \ -e "s,^( *INCOMING_EMAIL_DOMAIN:).*,\\1 '$HOST'," \ -e "s,^( *INCOMING_EMAIL_PREFIX:).*,\\1 'foi+'," \ diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb index 8e9d17fbe..2b1c515f7 100644 --- a/spec/controllers/api_controller_spec.rb +++ b/spec/controllers/api_controller_spec.rb @@ -282,6 +282,18 @@ describe ApiController, "when using the API" do # check, which does not really test anything at all. end + it 'should show information about an external request' do + info_request = info_requests(:external_request) + get :show_request, + :k => public_bodies(:geraldine_public_body).api_key, + :id => info_request.id + + response.should be_success + assigns[:request].id.should == info_request.id + r = ActiveSupport::JSON.decode(response.body) + r["title"].should == info_request.title + end + it "should show an Atom feed of new request events" do get :body_request_events, :id => public_bodies(:geraldine_public_body).id, |