aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/body_controller.rb15
-rw-r--r--app/controllers/user_controller.rb17
2 files changed, 22 insertions, 10 deletions
diff --git a/app/controllers/body_controller.rb b/app/controllers/body_controller.rb
index 7a07daf39..e8e0780cd 100644
--- a/app/controllers/body_controller.rb
+++ b/app/controllers/body_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: body_controller.rb,v 1.19 2008-10-17 11:37:59 francis Exp $
+# $Id: body_controller.rb,v 1.20 2009-03-18 02:37:42 francis Exp $
class BodyController < ApplicationController
# XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL
@@ -33,6 +33,19 @@ class BodyController < ApplicationController
@public_body = @public_bodies[0]
set_last_body(@public_body)
+ # Use search query for this so can collapse and paginate easily
+ # XXX really should just use SQL query here rather than Xapian.
+ begin
+ @xapian_requests = perform_search([InfoRequestEvent], 'requested_from:' + @public_body.url_name, 'newest', 'request_collapse')
+ if (@page > 1)
+ @page_desc = " (page " + @page.to_s + ")"
+ else
+ @page_desc = ""
+ end
+ rescue
+ @xapian_requests = nil
+ end
+
@track_thing = TrackThing.create_track_for_public_body(@public_body)
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ]
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 38ebd076f..5809484f1 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_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: user_controller.rb,v 1.63 2009-03-09 01:17:04 francis Exp $
+# $Id: user_controller.rb,v 1.64 2009-03-18 02:37:42 francis Exp $
class UserController < ApplicationController
# Show page about a user
@@ -23,21 +23,20 @@ class UserController < ApplicationController
@is_you = !@user.nil? && @user.id == @display_user.id
# Use search query for this so can collapse and paginate easily
- # XXX really should just use SQL query here rather than Xapian. Partly
- # will be more accurate, as will include backpage'd requests which
- # don't appear in Xapian.
+ # XXX really should just use SQL query here rather than Xapian.
begin
@xapian_requests = perform_search([InfoRequestEvent], 'requested_by:' + @display_user.url_name, 'newest', 'request_collapse')
@xapian_comments = perform_search([InfoRequestEvent], 'commented_by:' + @display_user.url_name, 'newest', nil)
+
+ if (@page > 1)
+ @page_desc = " (page " + @page.to_s + ")"
+ else
+ @page_desc = ""
+ end
rescue
@xapian_requests = nil
@xapian_comments = nil
end
- if (@page > 1)
- @page_desc = " (page " + @page.to_s + ")"
- else
- @page_desc = ""
- end
# Track corresponding to this page
@track_thing = TrackThing.create_track_for_user(@display_user)