aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/track_controller.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-05-11 10:59:29 +0100
committerSeb Bacon <seb.bacon@gmail.com>2012-05-11 10:59:29 +0100
commit835fb0a3e87701316120b5c4625213dd41c4e762 (patch)
tree2d7f1a62bfe0eb5a67b59717b07b727952ae7fe2 /app/controllers/track_controller.rb
parentfab239d4134d9e0b7560637df6897deff7e77336 (diff)
Redirect people to more user-friendly search results page (where possible) after they've "followed" search results. Fixes #487
Diffstat (limited to 'app/controllers/track_controller.rb')
-rw-r--r--app/controllers/track_controller.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 95b573cdc..312cedc6c 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -98,7 +98,23 @@ class TrackController < ApplicationController
return atom_feed_internal if params[:feed] == 'feed'
if self.track_set
- redirect_to search_url(@query)
+ if @query.scan("variety").length == 1
+ # we're making a track for a simple filter, for which
+ # there's an expression in the UI (rather than relying
+ # on index:value strings in the query)
+ if @query =~ /variety:user/
+ postfix = "users"
+ @query.sub!("variety:user", "")
+ elsif @query =~ /variety:authority/
+ postfix = "bodies"
+ @query.sub!("variety:authority", "")
+ elsif @query =~ /variety:sent/
+ postfix = "requests"
+ @query.sub!("variety:sent", "")
+ end
+ @query.strip!
+ end
+ redirect_to search_url([@query, postfix])
end
end