diff options
-rw-r--r-- | app/controllers/request_controller.rb | 6 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 6 | ||||
-rw-r--r-- | app/views/request/_request_listing_via_event.rhtml | 6 | ||||
-rw-r--r-- | app/views/track_mailer/event_digest.rhtml | 6 | ||||
-rw-r--r-- | spec/views/body/show.rhtml_spec.rb | 6 | ||||
-rw-r--r-- | spec/views/request/list.rhtml_spec.rb | 6 |
6 files changed, 18 insertions, 18 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 2605a7e05..f413d7320 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.157 2009-04-15 18:15:30 louise Exp $ +# $Id: request_controller.rb,v 1.158 2009-04-23 13:32:21 tony Exp $ class RequestController < ApplicationController @@ -355,9 +355,9 @@ class RequestController < ApplicationController # proper URL for the message the event refers to def show_request_event @info_request_event = InfoRequestEvent.find(params[:info_request_event_id]) - if not @info_request_event.incoming_message.nil? + if @info_request_event.is_incoming_message? redirect_to incoming_message_url(@info_request_event.incoming_message) - elsif not @info_request_event.outgoing_message.nil? + elsif @info_request_event.is_outgoing_message? redirect_to outgoing_message_url(@info_request_event.outgoing_message) else # XXX maybe there are better URLs for some events than this diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 8910b9997..ef1a71d4a 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request_event.rb,v 1.81 2009-04-23 13:08:49 tony Exp $ +# $Id: info_request_event.rb,v 1.82 2009-04-23 13:32:21 tony Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -201,7 +201,7 @@ class InfoRequestEvent < ActiveRecord::Base # Display version of status def display_status - if !incoming_message.nil? + if is_incoming_message? status = self.calculated_state if !status.nil? if status == 'waiting_response' @@ -232,7 +232,7 @@ class InfoRequestEvent < ActiveRecord::Base return "Response" end - if !outgoing_message.nil? + if is_outgoing_message? status = self.calculated_state if !status.nil? if status == 'internal_review' diff --git a/app/views/request/_request_listing_via_event.rhtml b/app/views/request/_request_listing_via_event.rhtml index 8ffb738ce..4faa2b0e5 100644 --- a/app/views/request/_request_listing_via_event.rhtml +++ b/app/views/request/_request_listing_via_event.rhtml @@ -4,11 +4,11 @@ end %> <div class="request_listing"> <span class="head"> - <% if not event.incoming_message.nil? %> + <% if event.is_incoming_message? %> <%= link_to highlight_words(info_request.title, @highlight_words), incoming_message_url(event.incoming_message) %> - <% elsif not event.outgoing_message.nil? and event.event_type == 'followup_sent' %> + <% elsif event.is_outgoing_message? and event.event_type == 'followup_sent' %> <%= link_to highlight_words(info_request.title, @highlight_words), outgoing_message_url(event.outgoing_message) %> - <% elsif not event.comment.nil? %> + <% elsif event.is_comment? %> <%= link_to highlight_words(info_request.title, @highlight_words), comment_url(event.comment) %> <% else %> <%= link_to highlight_words(info_request.title, @highlight_words), request_url(info_request) %> diff --git a/app/views/track_mailer/event_digest.rhtml b/app/views/track_mailer/event_digest.rhtml index 214b47aca..cd28b8840 100644 --- a/app/views/track_mailer/event_digest.rhtml +++ b/app/views/track_mailer/event_digest.rhtml @@ -35,11 +35,11 @@ main_text += " (" + simple_date(event.created_at) + ")\n" # Main text, wrapped, words highlighted with * and indented. - if not event.outgoing_message.nil? + if event.is_outgoing_message? extract = highlight_and_excerpt(event.outgoing_message.get_text_for_indexing, @highlight_words, 150, false) - elsif not event.incoming_message.nil? + elsif event.is_incoming_message? extract = highlight_and_excerpt(event.incoming_message.get_text_for_indexing, @highlight_words, 150, false) - elsif not event.comment.nil? + elsif event.is_comment? extract = highlight_and_excerpt(event.comment.body, @highlight_words, 150, false) else extract = highlight_and_excerpt(info_request.initial_request_text, @highlight_words, 150, false) diff --git a/spec/views/body/show.rhtml_spec.rb b/spec/views/body/show.rhtml_spec.rb index ad7d50e31..8e531b91e 100644 --- a/spec/views/body/show.rhtml_spec.rb +++ b/spec/views/body/show.rhtml_spec.rb @@ -88,9 +88,9 @@ def mock_event :public_body => @pb, :user => mock_model(User, :name => 'Test User', :url_name => 'testuser') ), - :incoming_message => nil, - :outgoing_message => nil, - :comment => nil, + :incoming_message => nil, :is_incoming_message? => false, + :outgoing_message => nil, :is_outgoing_message? => false, + :comment => nil, :is_comment? => false, :event_type => 'sent', :created_at => Time.now - 4.days, :search_text_main => '' diff --git a/spec/views/request/list.rhtml_spec.rb b/spec/views/request/list.rhtml_spec.rb index b171c5815..a1f057415 100644 --- a/spec/views/request/list.rhtml_spec.rb +++ b/spec/views/request/list.rhtml_spec.rb @@ -24,9 +24,9 @@ describe "when listing recent requests" do :public_body => mock_model(PublicBody, :name => 'Test Quango', :url_name => 'testquango'), :user => mock_model(User, :name => 'Test User', :url_name => 'testuser') ), - :incoming_message => nil, - :outgoing_message => nil, - :comment => nil, + :incoming_message => nil, :is_incoming_message? => false, + :outgoing_message => nil, :is_outgoing_message? => false, + :comment => nil, :is_comment? => false, :event_type => 'sent', :created_at => Time.now - 4.days, :search_text_main => '' |