diff options
-rw-r--r-- | app/controllers/admin_request_controller.rb | 8 | ||||
-rw-r--r-- | app/models/comment.rb | 10 | ||||
-rw-r--r-- | app/models/info_request.rb | 6 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 14 | ||||
-rw-r--r-- | app/models/user.rb | 6 | ||||
-rw-r--r-- | app/views/admin_request/edit_comment.rhtml | 5 | ||||
-rw-r--r-- | app/views/admin_request/show.rhtml | 8 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 4 | ||||
-rw-r--r-- | app/views/user/_user_listing_single.rhtml | 2 | ||||
-rw-r--r-- | app/views/user/show.rhtml | 4 | ||||
-rw-r--r-- | todo.txt | 23 |
11 files changed, 68 insertions, 22 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index 446b5263c..70db7cd8a 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_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: admin_request_controller.rb,v 1.23 2008-09-24 19:43:21 francis Exp $ +# $Id: admin_request_controller.rb,v 1.24 2008-10-02 23:11:40 francis Exp $ class AdminRequestController < ApplicationController layout "admin" @@ -110,11 +110,15 @@ class AdminRequestController < ApplicationController @comment = Comment.find(params[:id]) old_body = @comment.body + old_visible = @comment.visible + @comment.visible = params[:comment][:visible] == "true" ? true : false if @comment.update_attributes(params[:comment]) @comment.info_request.log_event("edit_comment", { :comment_if => @comment.id, :editor => admin_http_auth_user(), - :old_body => old_body, :body => @comment.body }) + :old_body => old_body, :body => @comment.body, + :old_visible => old_visible, :visible => @comment.visible, + }) flash[:notice] = 'Comment successfully updated.' redirect_to request_admin_url(@comment.info_request) else diff --git a/app/models/comment.rb b/app/models/comment.rb index 967108171..e4b995f32 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -19,7 +19,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: comment.rb,v 1.6 2008-09-22 22:16:37 francis Exp $ +# $Id: comment.rb,v 1.7 2008-10-02 23:11:40 francis Exp $ class Comment < ActiveRecord::Base belongs_to :user @@ -43,6 +43,14 @@ class Comment < ActiveRecord::Base read_attribute(:body) end + # So when made invisble it vanishes + after_save :event_xapian_update + def event_xapian_update + for event in self.info_request_events + event.xapian_mark_needs_index + end + end + # Check have edited comment def validate if self.body.empty? || self.body =~ /^\s+$/ diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 43d566199..e9f76f445 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -23,7 +23,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.143 2008-09-23 00:47:50 francis Exp $ +# $Id: info_request.rb,v 1.144 2008-10-02 23:11:40 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -76,6 +76,10 @@ class InfoRequest < ActiveRecord::Base end end + def visible_comments + self.comments.find(:all, :conditions => 'visible') + end + # Central function to do all searches # (Not really the right place to put it, but everything can get it here, and it # does *mainly* find info requests, via their events, so hey) diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 7b32954d3..0b6e126a9 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.61 2008-09-23 21:00:14 francis Exp $ +# $Id: info_request_event.rb,v 1.62 2008-10-02 23:11:40 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -149,7 +149,10 @@ class InfoRequestEvent < ActiveRecord::Base end def indexed_by_search if ['sent', 'followup_sent', 'response', 'comment'].include?(self.event_type) - if info_request.prominence == 'backpage' + if self.info_request.prominence == 'backpage' + return false + end + if self.event_type == 'comment' && !self.comment.visible return false end return true @@ -161,6 +164,13 @@ class InfoRequestEvent < ActiveRecord::Base self.event_type end + def visible + if self.event_type == 'comment' + return self.comment.visible + end + return true + end + # We store YAML version of parameters in the database def params=(params) # XXX should really set these explicitly, and stop storing them in diff --git a/app/models/user.rb b/app/models/user.rb index ba7e6f72b..072cca50a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,7 +22,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: user.rb,v 1.72 2008-09-24 12:59:27 francis Exp $ +# $Id: user.rb,v 1.73 2008-10-02 23:11:40 francis Exp $ require 'digest/sha1' @@ -68,6 +68,10 @@ class User < ActiveRecord::Base end end + def visible_comments + self.comments.find(:all, :conditions => 'visible') + end + def validate errors.add(:email, "doesn't look like a valid address") unless MySociety::Validate.is_valid_email(self.email) if MySociety::Validate.is_valid_email(self.name) diff --git a/app/views/admin_request/edit_comment.rhtml b/app/views/admin_request/edit_comment.rhtml index d8d7de276..ee43e849a 100644 --- a/app/views/admin_request/edit_comment.rhtml +++ b/app/views/admin_request/edit_comment.rhtml @@ -7,6 +7,11 @@ <p><label for="comment_body">Body of annotation</label><br/> <%= text_area 'comment', 'body', :rows => 10, :cols => 60 %></p> + <p><label for="comment_visible">Visible</label> + <%= select('comment', "visible", [["Yes - show comment",true],["No - hide comment",false]]) %> + </p> + + <p><%= submit_tag 'Save', :accesskey => 's' %></p> <% end %> diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml index 54b307cf9..7a5deb7d7 100644 --- a/app/views/admin_request/show.rhtml +++ b/app/views/admin_request/show.rhtml @@ -110,12 +110,16 @@ <th>Actions</th> </tr> -<% for comment in @info_request.comments.find(:all, :order => 'created_at') %> +<% for comment in @info_request.comments %> <tr class="<%= cycle('odd', 'even') %>"> <td><%=h comment.id %></td> <td><%= user_both_links(comment.user) %></td> <% for column in Comment.content_columns.map { |c| c.name } %> - <td><%=h comment.send(column) %></td> + <% if column == 'body' && !comment.visible %> + <td><s><%=h comment.send(column) %></s></td> + <% else %> + <td><%=h comment.send(column) %></td> + <% end %> <% end %> <td> <%= link_to "Edit", '../edit_comment/' + comment.id.to_s %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index b77e3c464..a806434c4 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -98,7 +98,9 @@ </p> <% for info_request_event in @info_request_events %> - <%= render :partial => 'correspondence', :locals => { :info_request_event => info_request_event } %> + <% if info_request_event.visible %> + <%= render :partial => 'correspondence', :locals => { :info_request_event => info_request_event } %> + <% end %> <% end %> <% if @info_request.awaiting_description %> diff --git a/app/views/user/_user_listing_single.rhtml b/app/views/user/_user_listing_single.rhtml index 1362dc780..cd2328418 100644 --- a/app/views/user/_user_listing_single.rhtml +++ b/app/views/user/_user_listing_single.rhtml @@ -8,7 +8,7 @@ end %> <span class="bottomline"> <%= pluralize(display_user.info_requests.size, "request") %> made. - <%= pluralize(display_user.comments.size, "annotation") %> made. + <%= pluralize(display_user.visible_comments.size, "annotation") %> made. Joined on <%= simple_date(display_user.created_at) %>. </span> diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml index d2966fcfe..7e85faabe 100644 --- a/app/views/user/show.rhtml +++ b/app/views/user/show.rhtml @@ -111,7 +111,7 @@ <% else %> <h2> <%= @is_you ? 'Your ' : "This person's " %> - <%=pluralize(@display_user.comments.size, "annotation") %> + <%=pluralize(@display_user.visible_comments.size, "annotation") %> <!-- matches_estimated <%=@xapian_comments.matches_estimated%> --> <%= @page_desc %> </h2> @@ -120,7 +120,7 @@ <%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %> <% end %> - <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.comments.size) %> + <%= will_paginate WillPaginate::Collection.new(@page, @per_page, @display_user.visible_comments.size) %> <% end %> </div> @@ -3,6 +3,10 @@ Test data for Tony Next ==== +Make it so signin link from being emailed that you have new response +goes to the # link on main page rather than the describe page that +needs login + Performance: Remove loading of public body tags from every info request load Completed in 15.53564 (0 reqs/sec) | Rendering: 1.03024 (6%) | DB: 14.46186 (93%) | 200 OK [http://www.whatdotheyknow.com/body/list/n] @@ -10,8 +14,6 @@ Performance: Upload Julian's large Cambridgeshire contract -Sort admin tag search by name rather than by modification date - Internal review status/marker? http://www.whatdotheyknow.com/request/search_engine_advertising_bought http://www.whatdotheyknow.com/request/communications_from_home_office @@ -38,6 +40,7 @@ Request withdrawn by user status/marker? Perhaps encourage user to annotate what they learnt after getting information? When they say "successful", encourage them to make an annotation? +"Some of the information" option should give you choice of complaining if you like. Clear out all the need admin attention requests @@ -57,8 +60,6 @@ Add "I didn't get the email / spam question" and link to from FOI offcier upload Add "Postal replies stuff" and link to from FOI officer upload page Add "I'm not sure which authority to make my request to" - make flow better after first section, to abrupt now -Test code for FOI officer upload - Grrr - so here I wanted to clarify my request, but don't want the timer to be reset! http://www.whatdotheyknow.com/request/online_petitions_documents_from#incoming-3248 @@ -69,10 +70,14 @@ Admin: Somehow fold up the enormous pages on many admin pages Have internal links to different parts of request page +Consider removing login links from notifications of new responses, now we have remember me + Later ===== +Test code for FOI officer upload + Detect councils that always send automatic acknowledgements, and notice if they do not for a particular request? (e.g. Leicestershire County Council) @@ -170,9 +175,6 @@ This does it all: $ ./script/clear-incoming-text-cache ; ./script/rebuild-xapian-index Get Atom highlighting to include stylesheet for yellow somehow -Offer option of one RSS feed with all things you are tracking in it. Maybe. - -"Some of the information" option should give you choice of complaining if you like. For followups, have radio button to say is it a new request or followup? @@ -185,8 +187,6 @@ Synthesise these tips into our handful of snappy snappy bullet points http://community.foe.co.uk/tools/right_to_know/tips.html http://www.justice.gov.uk/requestinginformation.htm -Consider removing login links from notifications of new responses, now we have remember me - (10:32:14) richard: you just need to count the number of rows of text and compare it to the number of rows in the textbox (10:32:29) richard: then increase the height of the textbox by 1em-ish (10:32:52) Matthew: their function is called autogrow_textarea() by the way, if you just want to look at it... @@ -250,11 +250,16 @@ Quoting fixing TODO: http://www.whatdotheyknow.com/request/415/response/1041/attach/3/CONF%20FOI%209508%20Ian%20Holton.doc http://www.whatdotheyknow.com/request/function_council_88#incoming-6258 + http://www.whatdotheyknow.com/request/please_submit_the_surveyors_repo#incoming-6334 # charset + + http://www.whatdotheyknow.com/request/enforcement_forders_for_replacin#incoming-6277 # over zealous quoting Larger new features ------------------- +Offer option of one RSS feed with all things you are tracking in it. Maybe. + Antispam on contact form Find a way to get corrected email addresses from responses - somehow getting |