aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2009-10-03 01:42:01 +0000
committerfrancis <francis>2009-10-03 01:42:01 +0000
commite6189e0222b9c94dd416df007ce2061bbc69c97c (patch)
tree6586e28f887542635fee195299059a2de330232d
parent6b934c0abc3c3b0a8b720a45f6699014c3865dba (diff)
how different flash if going back to game, vs staying on page of request. Link to request in former case.
-rw-r--r--app/controllers/request_controller.rb11
-rw-r--r--app/controllers/request_game_controller.rb3
-rw-r--r--spec/models/info_request_spec.rb16
3 files changed, 17 insertions, 13 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 9bf51483a..fa132001b 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: request_controller.rb,v 1.188 2009-10-02 22:56:34 francis Exp $
+# $Id: request_controller.rb,v 1.189 2009-10-03 01:42:01 francis Exp $
class RequestController < ApplicationController
@@ -307,9 +307,14 @@ class RequestController < ApplicationController
})
# Don't give advice on what to do next, as it isn't their request
- flash[:notice] = '<p>Thank you for updating this request!</p>'
RequestMailer.deliver_old_unclassified_updated(@info_request)
- redirect_to session[:request_game] ? play_url : request_url(@info_request)
+ if session[:request_game]
+ flash[:notice] = '<p>Thank you for updating the status of the request \'<a href="' + CGI.escapeHTML(request_url(@info_request)) + '">' + CGI.escapeHTML(@info_request.title) + '</a>\'. There are some more requests below for you to classify.</p>'
+ redirect_to play_url
+ else
+ flash[:notice] = '<p>Thank you for updating this request!</p>'
+ redirect_to request_url(@info_request)
+ end
return
end
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
index 574388e21..4a95d4108 100644
--- a/app/controllers/request_game_controller.rb
+++ b/app/controllers/request_game_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: request_game_controller.rb,v 1.4 2009-10-03 01:28:33 francis Exp $
+# $Id: request_game_controller.rb,v 1.5 2009-10-03 01:42:01 francis Exp $
class RequestGameController < ApplicationController
@@ -30,7 +30,6 @@ class RequestGameController < ApplicationController
end
end
- # Requests similar to this one
def stop
session[:request_game] = nil
flash[:notice] = 'Thank you for helping us keep the site tidy!'
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index 94be7a9e3..b16ced344 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -221,16 +221,16 @@ describe InfoRequest do
{:select=> anything,
:order=> anything,
:conditions=>["awaiting_description = ? and (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) < ? and url_title != 'holding_pen' and prominence != 'backpage'",
- true, Time.now - 14.days]})
+ true, Time.now - 21.days]})
InfoRequest.find_old_unclassified({:conditions => ["prominence != 'backpage'"]})
end
- it 'should ask the database for requests that are awaiting description, have a last response older than 14 days old, are not the holding pen and are not backpaged' do
+ it 'should ask the database for requests that are awaiting description, have a last response older than 21 days old, are not the holding pen and are not backpaged' do
InfoRequest.should_receive(:find).with(:all,
{:select=>"*, (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) as last_response_time",
:order=>"last_response_time",
:conditions=>["awaiting_description = ? and (select created_at from info_request_events where info_request_events.info_request_id = info_requests.id and info_request_events.event_type = 'response' order by created_at desc limit 1) < ? and url_title != 'holding_pen'",
- true, Time.now - 14.days]})
+ true, Time.now - 21.days]})
InfoRequest.find_old_unclassified
end
@@ -240,8 +240,8 @@ describe InfoRequest do
before do
Time.stub!(:now).and_return(Time.utc(2007, 11, 9, 23, 59))
- @mock_comment_event = mock_model(InfoRequestEvent, :created_at => Time.now - 16.days, :event_type => 'comment')
- @mock_response_event = mock_model(InfoRequestEvent, :created_at => Time.now - 15.days, :event_type => 'response')
+ @mock_comment_event = mock_model(InfoRequestEvent, :created_at => Time.now - 23.days, :event_type => 'comment')
+ @mock_response_event = mock_model(InfoRequestEvent, :created_at => Time.now - 22.days, :event_type => 'response')
@info_request = InfoRequest.new(:prominence => 'normal',
:awaiting_description => true,
:info_request_events => [@mock_response_event, @mock_comment_event])
@@ -257,12 +257,12 @@ describe InfoRequest do
@info_request.is_old_unclassified?.should be_false
end
- it 'should return false if its last response event occurred less than 14 days ago' do
- @mock_response_event.stub!(:created_at).and_return(Time.now - 13.days)
+ it 'should return false if its last response event occurred less than 21 days ago' do
+ @mock_response_event.stub!(:created_at).and_return(Time.now - 20.days)
@info_request.is_old_unclassified?.should be_false
end
- it 'should return true if it is awaiting description, isn\'t the holding pen and hasn\'t had an event in 14 days' do
+ it 'should return true if it is awaiting description, isn\'t the holding pen and hasn\'t had an event in 21 days' do
@info_request.is_old_unclassified?.should be_true
end