aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/track_controller.rb2
-rw-r--r--app/models/track_thing.rb7
-rw-r--r--spec/models/track_thing_spec.rb9
3 files changed, 12 insertions, 6 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 8e76b4c9f..51e081c88 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -180,7 +180,7 @@ class TrackController < ApplicationController
new_medium = params[:track_medium]
if new_medium == 'delete'
track_thing.destroy
- flash[:notice] = _("You are no longer following {{track_description}}", :track_description => track_thing.params[:list_description])
+ flash[:notice] = _("You are no longer following {{track_description}}.", :track_description => track_thing.params[:list_description])
redirect_to params[:r]
# Reuse code like this if we let medium change again.
#elsif new_medium == 'email_daily'
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index d1cef4d4d..2a61eb858 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -107,7 +107,12 @@ class TrackThing < ActiveRecord::Base
end
descriptions = []
if varieties.include? _("requests")
- descriptions << _("requests which are {{list_of_statuses}}", :list_of_statuses => Array(statuses).sort.join(_(' or ')))
+ if statuses.empty?
+ # HACK: Relies on the 'descriptions.sort' below to luckily put this first
+ descriptions << _("all requests")
+ else
+ descriptions << _("requests which are {{list_of_statuses}}", :list_of_statuses => Array(statuses).sort.join(_(' or ')))
+ end
varieties -= [_("requests")]
end
if descriptions.empty? and varieties.empty?
diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb
index 345629bd6..c42eb5e8b 100644
--- a/spec/models/track_thing_spec.rb
+++ b/spec/models/track_thing_spec.rb
@@ -35,10 +35,11 @@ describe TrackThing, "when tracking changes" do
end
it "will make some sane descriptions of search-based tracks" do
- tests = [['bob variety:user', "users matching text 'bob'"],
- ['bob (variety:sent OR variety:followup_sent OR variety:response OR variety:comment) (latest_status:successful OR latest_status:partially_successful OR latest_status:rejected OR latest_status:not_held)', "comments or requests which are successful or unsuccessful matching text 'bob'"],
- ['(latest_status:waiting_response OR latest_status:waiting_clarification OR waiting_classification:true)', 'requests which are awaiting a response']]
- for query, description in tests
+ tests = { 'bob variety:user' => "users matching text 'bob'",
+ 'bob (variety:sent OR variety:followup_sent OR variety:response OR variety:comment) (latest_status:successful OR latest_status:partially_successful OR latest_status:rejected OR latest_status:not_held)' => "comments or requests which are successful or unsuccessful matching text 'bob'",
+ '(latest_status:waiting_response OR latest_status:waiting_clarification OR waiting_classification:true)' => 'requests which are awaiting a response',
+ ' (variety:sent OR variety:followup_sent OR variety:response OR variety:comment)' => 'all requests or comments' }
+ tests.each do |query, description|
track_thing = TrackThing.create_track_for_search_query(query)
track_thing.track_query_description.should == description
end