aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--README.md8
-rwxr-xr-xapp/helpers/link_to_helper.rb2
-rw-r--r--app/views/admin_request/show.rhtml28
-rw-r--r--config/environment.rb19
-rw-r--r--config/general.yml-example4
-rw-r--r--config/httpd.conf3
-rw-r--r--config/test.yml8
-rw-r--r--doc/CHANGES.md44
-rw-r--r--doc/INSTALL.md14
-rw-r--r--doc/THEMES.md4
-rw-r--r--doc/TRANSLATE.md2
-rw-r--r--lib/public_body_categories.rb29
-rw-r--r--lib/rack_quote_monkeypatch.rb4
-rw-r--r--lib/tasks/themes.rake87
-rw-r--r--locale/uk/app.po58
-rw-r--r--public/robots.txt2
-rwxr-xr-xscript/rails-post-deploy28
-rw-r--r--spec/controllers/admin_request_controller_spec.rb5
-rw-r--r--spec/controllers/general_controller_spec.rb14
-rw-r--r--spec/controllers/request_controller_spec.rb2
-rw-r--r--spec/fixtures/info_request_events.yml35
-rw-r--r--spec/fixtures/info_requests.yml10
-rw-r--r--spec/fixtures/outgoing_messages.yml11
-rw-r--r--spec/helpers/link_to_helper_spec.rb32
-rw-r--r--spec/integration/create_request_spec.rb12
-rw-r--r--spec/lib/public_body_categories_spec.rb42
-rw-r--r--spec/models/public_body_spec.rb64
28 files changed, 383 insertions, 190 deletions
diff --git a/Gemfile b/Gemfile
index 4ab068d64..0ec056eaf 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,4 +1,4 @@
-# Work around bug in Debian Squeeze - see https://github.com/sebbacon/alaveteli/pull/297#issuecomment-4101012
+# Work around bug in Debian Squeeze - see https://github.com/mysociety/alaveteli/pull/297#issuecomment-4101012
if File.exist? "/etc/debian_version" and File.open("/etc/debian_version").read.strip =~ /^(squeeze|6\.0\.[45])$/
if File.exist? "/lib/libuuid.so.1"
require 'dl'
diff --git a/README.md b/README.md
index 4bba49af7..6c0c15782 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Welcome to Alaveteli!
-[![Build Status](https://secure.travis-ci.org/sebbacon/alaveteli.png)](http://travis-ci.org/sebbacon/alaveteli) [![Dependency Status](https://gemnasium.com/sebbacon/alaveteli.png)](https://gemnasium.com/sebbacon/alaveteli)
+[![Build Status](https://secure.travis-ci.org/mysociety/alaveteli.png)](http://travis-ci.org/mysociety/alaveteli) [![Dependency Status](https://gemnasium.com/mysociety/alaveteli.png)](https://gemnasium.com/mysociety/alaveteli)
This is an open source project to create a standard, internationalised
platform for making Freedom of Information (FOI) requests in different
@@ -17,11 +17,11 @@ Please join our mailing list at
https://groups.google.com/group/alaveteli-dev and introduce yourself.
Some documentation can be found in the
-[`doc/` folder](https://github.com/sebbacon/alaveteli/tree/master/doc).
+[`doc/` folder](https://github.com/mysociety/alaveteli/tree/master/doc).
There's background information and a more documentation on
-[our wiki](https://github.com/sebbacon/alaveteli/wiki/Home/), and lots
+[our wiki](https://github.com/mysociety/alaveteli/wiki/Home/), and lots
of useful information (including a blog) on
[the project website](http://alaveteli.org)
Looking for the latest stable release? It's on the
-[master branch](https://github.com/sebbacon/alaveteli/tree/master).
+[master branch](https://github.com/mysociety/alaveteli/tree/master).
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 16e37277b..cae17ebd3 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -118,7 +118,7 @@ module LinkToHelper
def user_admin_link_for_request(request, external_text=nil, internal_text=nil)
if request.is_external?
- text = external_text ? external_text : request.user_name + " (external)"
+ text = external_text ? external_text : (request.external_user_name || _("Anonymous user")) + " (external)"
else
text = internal_text ? internal_text : request.user.name
link_to(h(text), user_admin_url(request.user))
diff --git a/app/views/admin_request/show.rhtml b/app/views/admin_request/show.rhtml
index aac68ad2e..9d939eb35 100644
--- a/app/views/admin_request/show.rhtml
+++ b/app/views/admin_request/show.rhtml
@@ -11,14 +11,20 @@
<% if column.name == 'described_state' %>
<strong>Calculated status:</strong> <%= @info_request.calculate_status %>
<br/><strong>Initial request last sent at:</strong> <%=@info_request.date_initial_request_last_sent_at.to_date %>
- <strong>Date response required by:</strong> <%= @info_request.date_response_required_by %>
+ <strong>Date response required by:</strong> <%= @info_request.date_response_required_by %>
<strong>Very overdue after:</strong> <%= @info_request.date_very_overdue_after %>
<% end %>
<% if ![ 'allow_new_responses_from' ].include?(column.name) %>
<br/>
<% end %>
<% end %>
- <strong>Created by:</strong> <%= user_both_links(@info_request.user) %>
+ <strong>Created by:</strong>
+ <% if @info_request.is_external? %>
+ <%= @info_request.public_body.name %> on behalf of <%= (@info_request.user_name || _('an anonymous user'))%> (using API)
+ <% else %>
+ <%= user_both_links(@info_request.user) %>
+ <% end %>
+
<span>
<span>
(<%= link_to_function("move...", "$(this).up(1).childElements().invoke('toggle')") %>)
@@ -30,7 +36,7 @@
</span>
</span>
<br>
-<strong>Public authority:</strong> <%= public_body_both_links(@info_request.public_body) %>
+<strong>Public authority:</strong> <%= public_body_both_links(@info_request.public_body) %>
<span>
<span>
(<%= link_to_function("move...", "$(this).up(1).childElements().invoke('toggle')") %>)
@@ -63,7 +69,7 @@
<% end %>
<th>Actions</th>
</tr>
-
+
<% for info_request_event in @info_request.info_request_events.find(:all, :order => "created_at, id") %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%=h info_request_event.id %></td>
@@ -102,7 +108,7 @@
<% end %>
<th>Actions</th>
</tr>
-
+
<% for outgoing_message in @info_request.outgoing_messages.find(:all, :order => 'created_at') %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%=h outgoing_message.id %></td>
@@ -110,8 +116,8 @@
<% if column == 'body' %>
<td>
- <div><%= simple_format( truncate(outgoing_message.body, :length => 400,
- :omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
+ <div><%= simple_format( truncate(outgoing_message.body, :length => 400,
+ :omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
)) %></div>
<div style="display:none;"><%= simple_format( outgoing_message.body ) %></div>
</td>
@@ -143,15 +149,15 @@
<% end %>
<th>Actions</th>
</tr>
-
+
<% for incoming_message in @info_request.incoming_messages.find(:all, :order => 'created_at') %>
<tr class="<%= cycle('odd', 'even') %>" id="incoming-<%=incoming_message.id.to_s%>">
<td><%=h incoming_message.id %></td>
<% for column in IncomingMessage.content_columns.map { |c| c.name } %>
<% if column =~ /^cached_.*?$/ %>
<td>
- <div><%= simple_format( truncate(incoming_message.send(column), :length => 400,
- :omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
+ <div><%= simple_format( truncate(incoming_message.send(column), :length => 400,
+ :omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
)) %></div>
<div style="display:none;"><%= simple_format( incoming_message.send(column) ) %></div>
</td>
@@ -183,7 +189,7 @@
<% end %>
<th>Actions</th>
</tr>
-
+
<% for comment in @info_request.comments %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%=h comment.id %></td>
diff --git a/config/environment.rb b/config/environment.rb
index b958c6475..f788845a9 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,7 +1,7 @@
# Be sure to restart your web server when you modify this file.
-# Uncomment below to force Rails into production mode when
+# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
@@ -31,9 +31,12 @@ load "util.rb"
require File.join(File.dirname(__FILE__), '../lib/old_rubygems_patch')
+# Application version
+ALAVETELI_VERSION = '0.6.5'
+
Rails::Initializer.run do |config|
# Load intial mySociety config
- if ENV["RAILS_ENV"] == "test"
+ if ENV["RAILS_ENV"] == "test"
MySociety::Config.set_file(File.join(config.root_path, 'config', 'test'), true)
else
MySociety::Config.set_file(File.join(config.root_path, 'config', 'general'), true)
@@ -41,7 +44,7 @@ Rails::Initializer.run do |config|
MySociety::Config.load_default
# Settings in config/environments/* take precedence over those specified here
-
+
# Skip frameworks you're not going to use (only works if using vendor/rails)
# config.frameworks -= [ :action_web_service, :action_mailer ]
@@ -51,7 +54,7 @@ Rails::Initializer.run do |config|
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{Rails.root}/extras )
- # Force all environments to use the same logger level
+ # Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# TEMP: uncomment this to turn on logging in production environments
# config.log_level = :debug
@@ -60,7 +63,7 @@ Rails::Initializer.run do |config|
#GettextI18nRails.translations_are_html_safe = true
# Use SQL instead of Active Record's schema dumper when creating the test database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
config.active_record.schema_format = :sql
@@ -69,8 +72,8 @@ Rails::Initializer.run do |config|
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
-
- config.after_initialize do
+
+ config.after_initialize do
require 'routing_filters.rb'
end
@@ -79,7 +82,7 @@ Rails::Initializer.run do |config|
ENV['RECAPTCHA_PRIVATE_KEY'] = MySociety::Config::get("RECAPTCHA_PRIVATE_KEY", 'x');
end
-# Add new inflection rules using the following format
+# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
diff --git a/config/general.yml-example b/config/general.yml-example
index 33e3ad5bf..a6f657d96 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -38,8 +38,8 @@ FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
# script). Earlier in the list means the templates have a higher
# priority.
THEME_URLS:
- - 'git://github.com/sebbacon/adminbootstraptheme.git'
- - 'git://github.com/sebbacon/alavetelitheme.git'
+ - 'git://github.com/mysociety/adminbootstraptheme.git'
+ - 'git://github.com/mysociety/alavetelitheme.git'
# Whether a user needs to sign in to start the New Request process
FORCE_REGISTRATION_ON_NEW_REQUEST: false
diff --git a/config/httpd.conf b/config/httpd.conf
index 36f567964..129b1577b 100644
--- a/config/httpd.conf
+++ b/config/httpd.conf
@@ -43,7 +43,8 @@ RewriteRule /files/(.+) http://files.whatdotheyknow.com/$1
# file exists.
RewriteMap escape int:escape
RewriteCond %{DOCUMENT_ROOT}/views_cache/request/$2/$1/${escape:$3} -f
-RewriteRule ^/request/((\d{1,3})\d*)/(response/\d+/attach/\d+/.+) /views_cache/request/$2/$1/${escape:$3} [L]
+RewriteRule ^/request/((\d{1,3})\d*)/(response/\d+/attach/(html/)?\d+/.+) /views_cache/request/$2/$1/${escape:$3} [L]
+
<IfModule mod_passenger.c>
# Set this to something like 100 if you have memory leak issues
diff --git a/config/test.yml b/config/test.yml
index 6e34340ff..5811b1785 100644
--- a/config/test.yml
+++ b/config/test.yml
@@ -1,7 +1,7 @@
# test.yml
# Test values for the "general" config file.
#
-# Configuration parameters, in YAML syntax.
+# Configuration parameters, in YAML syntax.
#
# These may be values expected by the test suite; changing them may
# break tests.
@@ -12,7 +12,7 @@ SITE_NAME: 'Alaveteli'
# Domain used in URLs generated by scripts (e.g. for going in some emails)
# It makes things simpler if this is the same as the Rails test domain test.host
DOMAIN: 'test.host'
-
+
# ISO country code of country currrently deployed in
# (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
ISO_COUNTRY_CODE: DE
@@ -34,14 +34,14 @@ REPLY_VERY_LATE_AFTER_DAYS: 40
# We give some types of authority like schools a bit longer than everyone else
SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60
-# example searches for the home page, semicolon delimited.
+# example searches for the home page, semicolon delimited.
FRONTPAGE_SEARCH_EXAMPLES: 'Geraldine Quango; Department for Humpadinking'
# example public bodies for the home page, semicolon delimited - short_names
FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
# URL of theme to install (when running rails-post-deploy script)
-THEME_URL: 'git://github.com/sebbacon/alavetelitheme.git'
+THEME_URL: 'git://github.com/mysociety/alavetelitheme.git'
## Incoming email
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 42f408bab..ae9418ef4 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -1,8 +1,22 @@
+# Version 0.6.5
+* This is a minor release, to update all documentation and example files to reflect the move of the official repository to http://github.com/mysociety/alaveteli and the alavetelitheme and adminbootstraptheme themes to http://github.com/mysociety/alavetelitheme and http://github.com/mysociety/adminbootstraptheme respectively.
+* Some basic versioning has been added for themes. An ALAVETELI_VERSION constant has been added in config/environment.rb. When loading themes, `rails-post-deploy` now looks for a tag on the theme repository in the form 'use-with-alaveteli-0.6.5' that matches the ALAVETELI_VERSION being deployed - if it finds such a tag, the theme will be checked out from that tag, rather than from the HEAD of the theme repository. If no such tag is found, HEAD is used, as before [issue #573](https://github.com/mysociety/alaveteli/issues/573).
+* Apache has been configured to serve cached HTML versions of attached files (and associated images) directly from the file cache, as well as the original versions [issue #580](https://github.com/mysociety/alaveteli/issues/580).
+* PublicBodyCategories have a couple of new methods for more easily working with headings [issue #575](https://github.com/mysociety/alaveteli/issues/575).
+
+* [List of issues on github](https://github.com/mysociety/alaveteli/issues?milestone=21&state=closed)
+
+## Upgrade notes
+
+* Please update your `THEME_URLS` to point to http://github.com/mysociety/alavetelitheme and http://github.com/mysociety/adminbootstraptheme if you are using the alavetelitheme or adminbootstraptheme themes.
+
+* Check out this version and run `rails-post-deploy` as usual.
+
# Version 0.6.4
## Highlighted features
* This is a minor bugfix release, mainly to fix bugs related to external request handling.
-* [List of issues on github](https://github.com/sebbacon/alaveteli/issues?milestone=18&state=closed)
-* [List of commits since last release](https://github.com/sebbacon/alaveteli/compare/master...release/0.6.4)
+* [List of issues on github](https://github.com/mysociety/alaveteli/issues?milestone=18&state=closed)
+* [List of commits since last release](https://github.com/mysociety/alaveteli/compare/master...release/0.6.4)
## Upgrade notes
@@ -22,7 +36,7 @@
customisation in themes
* Themes can now provide a `post_install.rb` script that is executed
by `rails-post-deploy`
-* [List of issues on github](https://github.com/sebbacon/alaveteli/issues?milestone=17&state=closed)
+* [List of issues on github](https://github.com/mysociety/alaveteli/issues?milestone=17&state=closed)
## Upgrade notes
@@ -43,14 +57,14 @@
# Version 0.6.1
## Highlighted features
-* Fixes important security bug [issue #515](https://github.com/sebbacon/alaveteli/issues/515)
+* Fixes important security bug [issue #515](https://github.com/mysociety/alaveteli/issues/515)
* Show admin nav bar when browsing main site
* A new API for adding requests and correspondence to an Alaveteli
instance, designed for use by public bodies that wish to use
Alaveteli as a disclosure log. See
- [the wiki](https://github.com/sebbacon/alaveteli/wiki/API) for some
+ [the wiki](https://github.com/mysociety/alaveteli/wiki/API) for some
documentation.
-* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?milestone=8&state=closed)
+* [Full list of changes on github](https://github.com/mysociety/alaveteli/issues?milestone=8&state=closed)
## Upgrade notes
@@ -87,9 +101,9 @@
and sends the user an email explaining why.
* A bug which prevented locales containing underscores (e.g. `en_GB`)
was fixed
- ([issue #503](https://github.com/sebbacon/alaveteli/issues/503))
+ ([issue #503](https://github.com/mysociety/alaveteli/issues/503))
* Error pages are now presented with styling from themes
-* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?milestone=13&state=closed)
+* [Full list of changes on github](https://github.com/mysociety/alaveteli/issues?milestone=13&state=closed)
## Upgrade notes
@@ -178,7 +192,7 @@ We now have a most of a Czech translation (thanks Josef Pospisil!)
Finally, this release also addresses a number of small bugs, including
the (potentially) important issue #408.
-As usual, there is a [full list of changes on github](https://github.com/sebbacon/alaveteli/issues?milestone=9&state=closed)
+As usual, there is a [full list of changes on github](https://github.com/mysociety/alaveteli/issues?milestone=9&state=closed)
## Upgrade notes
@@ -194,16 +208,16 @@ As usual, there is a [full list of changes on github](https://github.com/sebbaco
* When listing authorities, show all authorities in default locale, rather than only those in the currently selected locale.
* Ensure incoming emails are only ever parsed once (should give a performance boost)
* Added a simple rate-limiting feature: restrict the number of requests users can make per day, except if explicitly unrestricted in the admin interface
-* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?state=closed&milestone=9)
+* [Full list of changes on github](https://github.com/mysociety/alaveteli/issues?state=closed&milestone=9)
## Upgrade notes
-* **IMPORTANT! We now depend on Xapian 1.2**, which means you may need to install Xapian from backports. See [issue #159](https://github.com/sebbacon/alaveteli/issues/159) for more info.
+* **IMPORTANT! We now depend on Xapian 1.2**, which means you may need to install Xapian from backports. See [issue #159](https://github.com/mysociety/alaveteli/issues/159) for more info.
* Themes created for 0.4 and below should be changed to match the new format (although the old way should continue to work):
* You should create a resources folder at `<yourtheme>/public/` and symlink to it from the main rails app. See the `install.rb` in `alaveteli-theme` example theme for details.
* Your styles should be moved from `general/custom_css.rhtml` to a standalone stylesheet in `<yourtheme>/public/stylesheets/`
* The partial at `general/_before_head_end.rhtml` should be changed in the theme to include this stylesheet
-* [issue #281](https://github.com/sebbacon/alaveteli/issues/281) fixes some bugs relating to display of internationalised emails. To fix any wrongly displayed emails, you'll need to run the script at `script/clear-caches` so that the caches can be regenerated
-* During this release, a bug was discovered in pdftk 1.44 which caused it to loop forever. Until it's incorporated into an official release, you'll need to patch it yourself or use the Debian package compiled by mySociety (see link in [issue 305](https://github.com/sebbacon/alaveteli/issues/305))
+* [issue #281](https://github.com/mysociety/alaveteli/issues/281) fixes some bugs relating to display of internationalised emails. To fix any wrongly displayed emails, you'll need to run the script at `script/clear-caches` so that the caches can be regenerated
+* During this release, a bug was discovered in pdftk 1.44 which caused it to loop forever. Until it's incorporated into an official release, you'll need to patch it yourself or use the Debian package compiled by mySociety (see link in [issue 305](https://github.com/mysociety/alaveteli/issues/305))
* Ensure you have values for new config variables (see `config/general.yml-example`):
* EXCEPTION_NOTIFICATIONS_FROM
* EXCEPTION_NOTIFICATIONS_TO
@@ -220,7 +234,7 @@ As usual, there is a [full list of changes on github](https://github.com/sebbaco
See the new instructions in INSTALL-exim4.md for details of how to set this up.
* Logged in users now have the ability to download a zipfile of the entire correspondence for a request
* Improved UI for responding to requests. The user now has a single option to "reply" at the bottom of a request, and can adjust who they are replying to on the next page
-* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?sort=created&direction=desc&state=closed&milestone=7)
+* [Full list of changes on github](https://github.com/mysociety/alaveteli/issues?sort=created&direction=desc&state=closed&milestone=7)
## Upgrade notes
* Remember to `rake db:migrate` and `git submodule update`
@@ -248,4 +262,4 @@ As usual, there is a [full list of changes on github](https://github.com/sebbaco
* Introduce reCaptcha for people apparently coming from foreign countries (to combat spam) (requires values for new config variables `ISO_COUNTRY_CODE` and `GAZE_URL`, and existing config variables `RECAPTCHA_PUBLIC_KEY` and `RECAPTCHA_PRIVATE_KEY`)
* Better admin interface for editing multiple translations of a public body at once
## Other
-* [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?milestone=5&state=closed)
+* [Full list of changes on github](https://github.com/mysociety/alaveteli/issues?milestone=5&state=closed)
diff --git a/doc/INSTALL.md b/doc/INSTALL.md
index 588f8e4fe..62c5071ca 100644
--- a/doc/INSTALL.md
+++ b/doc/INSTALL.md
@@ -1,12 +1,12 @@
These instructions assume Debian Squeeze or Ubuntu 10.04 LTS.
-[Install instructions for OS X](https://github.com/sebbacon/alaveteli/wiki/OS-X-Quickstart)
+[Install instructions for OS X](https://github.com/mysociety/alaveteli/wiki/OS-X-Quickstart)
are under development. Debian Squeeze is the best supported
deployment platform.
Commands are intended to be run via the terminal or over ssh.
As an aid to evaluation, there is an
-[Amazon AMI](https://github.com/sebbacon/alaveteli/wiki/Alaveteli-ec2-ami)
+[Amazon AMI](https://github.com/mysociety/alaveteli/wiki/Alaveteli-ec2-ami)
with all these steps configured. It is *not* production-ready.
# Get Alaveteli
@@ -16,7 +16,7 @@ install git-core`
Next, get hold of the Alaveteli source code from github:
- git clone https://github.com/sebbacon/alaveteli.git
+ git clone https://github.com/mysociety/alaveteli.git
cd alaveteli
This will get the development branch, which has the latest (possibly
@@ -103,7 +103,7 @@ in certain edge conditions. Until it's incorporated into an official
release, you can either hope you don't encounter the bug (it ties up a
rails process until you kill it) you'll need to patch it yourself or
use the Debian package compiled by mySociety (see link in
-[issue 305](https://github.com/sebbacon/alaveteli/issues/305))
+[issue 305](https://github.com/mysociety/alaveteli/issues/305))
# Configure Database
@@ -329,7 +329,7 @@ similar init script, which is optional and not required if you choose
not to run your site behind Varnish (see below).
The cron jobs refer to a program `run-with-lockfile`. See
-[this issue](https://github.com/sebbacon/alaveteli/issues/112) for a
+[this issue](https://github.com/mysociety/alaveteli/issues/112) for a
discussion of where to find this program, and how you might replace
it.
@@ -351,7 +351,7 @@ server behind an http accelerator like Varnish. A sample varnish VCL
is supplied in `../conf/varnish-alaveteli.vcl`.
Some
-[production server best practice notes](https://github.com/sebbacon/alaveteli/wiki/Production-Server-Best-Practices)
+[production server best practice notes](https://github.com/mysociety/alaveteli/wiki/Production-Server-Best-Practices)
are evolving on the wiki.
# Upgrading Alaveteli
@@ -450,7 +450,7 @@ various other things that can be automated for deployment.
set document.codepage.force_assumed = 1
You should also check that your locale is set up correctly. See
- [https://github.com/sebbacon/alaveteli/issues/128#issuecomment-1814845](this issue followup)
+ [https://github.com/mysociety/alaveteli/issues/128#issuecomment-1814845](this issue followup)
for further discussion.
* **I'm getting lots of `SourceIndex.new(hash) is deprecated` errors when running the tests**
diff --git a/doc/THEMES.md b/doc/THEMES.md
index e33371df7..6c22764fc 100644
--- a/doc/THEMES.md
+++ b/doc/THEMES.md
@@ -42,7 +42,7 @@ explanation.
You can also install the sample theme by hand, by running:
- ./script/plugin install git://github.com/sebbacon/alavetelitheme.git
+ ./script/plugin install git://github.com/mysociety/alavetelitheme.git
The sample theme contains examples for nearly everything you might
want to customise. You should probably make a copy, rename it, and
@@ -112,7 +112,7 @@ locale you support.
# Customising the request states
As mentioned above, if you can possibly live with the
-[default Alaveteli request statuses](https://github.com/sebbacon/alaveteli/wiki/Alaveteli's-request-statuses),
+[default Alaveteli request statuses](https://github.com/mysociety/alaveteli/wiki/Alaveteli's-request-statuses),
it would be good to do so. Note that you can set how many days counts
as "overdue" in the main site config file.
diff --git a/doc/TRANSLATE.md b/doc/TRANSLATE.md
index 543c16cd9..abf47add3 100644
--- a/doc/TRANSLATE.md
+++ b/doc/TRANSLATE.md
@@ -84,4 +84,4 @@ must:
# Translations: developers' view
-See the [I18n guide](https://github.com/sebbacon/alaveteli/wiki/I18n-guide) on the wiki.
+See the [I18n guide](https://github.com/mysociety/alaveteli/wiki/I18n-guide) on the wiki.
diff --git a/lib/public_body_categories.rb b/lib/public_body_categories.rb
index b8058bf9e..b4aa71a40 100644
--- a/lib/public_body_categories.rb
+++ b/lib/public_body_categories.rb
@@ -7,9 +7,15 @@
# $Id: public_body_categories.rb,v 1.1 2009-09-14 14:45:48 francis Exp $
class PublicBodyCategories
-
- attr_reader :with_description, :with_headings, :tags, :by_tag, :singular_by_tag
-
+
+ attr_reader :with_description,
+ :with_headings,
+ :tags,
+ :by_tag,
+ :singular_by_tag,
+ :by_heading,
+ :headings
+
def initialize(categories)
@with_headings = categories
# Arranged in different ways for different sorts of displaying
@@ -17,8 +23,21 @@ class PublicBodyCategories
@tags = @with_description.map() { |a| a[0] }
@by_tag = Hash[*@with_description.map() { |a| a[0..1] }.flatten]
@singular_by_tag = Hash[*@with_description.map() { |a| [a[0],a[2]] }.flatten]
+ @by_heading = {}
+ heading = nil
+ @headings = []
+ @with_headings.each do |row|
+ if ! row.instance_of?(Array)
+ heading = row
+ @headings << row
+ @by_heading[row] = []
+ else
+ @by_heading[heading] << row[0]
+ end
+ end
end
+
def PublicBodyCategories.get
load_categories if @@CATEGORIES.empty?
@@CATEGORIES[I18n.locale.to_s] || @@CATEGORIES[I18n.default_locale.to_s] || PublicBodyCategories.new([])
@@ -28,10 +47,10 @@ class PublicBodyCategories
def PublicBodyCategories.add(locale, categories)
@@CATEGORIES[locale.to_s] = PublicBodyCategories.new(categories)
end
-
+
private
@@CATEGORIES = {}
-
+
def PublicBodyCategories.load_categories()
I18n.available_locales.each do |locale|
begin
diff --git a/lib/rack_quote_monkeypatch.rb b/lib/rack_quote_monkeypatch.rb
index be079c6a2..b477ac0cb 100644
--- a/lib/rack_quote_monkeypatch.rb
+++ b/lib/rack_quote_monkeypatch.rb
@@ -2,9 +2,9 @@
# current version of Rails won't use that. So for now, monkeypatch,
# This can be dropped when we move to Rails 3.
#
-# See https://github.com/sebbacon/alaveteli/issues/38 for Alaveteli
+# See https://github.com/mysociety/alaveteli/issues/38 for Alaveteli
# bug report
-#
+#
# More info about the monkeypatch:
# http://thewebfellas.com/blog/2010/7/15/rails-2-3-8-rack-1-1-and-the-curious-case-of-the-missing-quotes
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
new file mode 100644
index 000000000..2b1dbb3a9
--- /dev/null
+++ b/lib/tasks/themes.rake
@@ -0,0 +1,87 @@
+
+namespace :themes do
+
+ def plugin_dir
+ File.join(Rails.root,"vendor","plugins")
+ end
+
+ def theme_dir(theme_name)
+ File.join(plugin_dir, theme_name)
+ end
+
+ def install_theme_using_git(name, uri, verbose=false, options={})
+ mkdir_p(install_path = theme_dir(name))
+ Dir.chdir install_path do
+ init_cmd = "git init"
+ init_cmd += " -q" if options[:quiet] and not verbose
+ puts init_cmd if verbose
+ system(init_cmd)
+ base_cmd = "git pull --depth 1 #{uri}"
+ # Is there a tag for this version of Alaveteli?
+ usage_tag = "use-with-alaveteli-#{ALAVETELI_VERSION}"
+ # Query the remote repository passing flags for tags
+ version_tag = `git ls-remote --tags #{uri} #{usage_tag}`
+ if /^[a-z0-9]+\s+refs\/tags\/#{Regexp.escape(usage_tag)}$/.match(version_tag)
+ # If we got a tag, pull that instead of HEAD
+ puts "Using tag #{usage_tag}" if verbose
+ base_cmd += " refs/tags/#{usage_tag}"
+ else
+ puts "No specific tag for this version: using HEAD" if verbose
+ end
+ base_cmd += " -q" if options[:quiet] and not verbose
+ puts base_cmd if verbose
+ if system(base_cmd)
+ puts "removing: .git .gitignore" if verbose
+ rm_rf %w(.git .gitignore)
+ else
+ rm_rf install_path
+ raise "#{base_cmd} failed! Stopping."
+ end
+ end
+ end
+
+ def uninstall(theme_name, verbose=false)
+ dir = theme_dir(theme_name)
+ if File.directory?(dir)
+ run_hook(theme_name, 'uninstall', verbose)
+ puts "Removing '#{dir}'" if verbose
+ rm_r dir
+ else
+ puts "Plugin doesn't exist: #{dir}"
+ end
+ end
+
+ def run_hook(theme_name, hook_name, verbose=false)
+ hook_file = File.join(theme_dir(theme_name), "#{hook_name}.rb")
+ if File.exist? hook_file
+ puts "Running #{hook_name} hook for #{theme_name}" if verbose
+ load hook_file
+ end
+ end
+
+ def installed?(theme_name)
+ File.directory?(theme_dir(theme_name))
+ end
+
+ def install_theme(theme_url, verbose, deprecated=false)
+ deprecation_string = deprecated ? " using deprecated THEME_URL" : ""
+ theme_name = File.basename(theme_url, '.git')
+ puts "Installing theme #{theme_name}#{deprecation_string} from #{theme_url}"
+ uninstall(theme_name, verbose) if installed?(theme_name)
+ install_theme_using_git(theme_name, theme_url, verbose)
+ run_hook(theme_name, 'install', verbose)
+ run_hook(theme_name, 'post_install', verbose)
+ end
+
+ desc "Install themes specified in the config file's THEME_URLS"
+ task :install => :environment do
+ verbose = true
+ theme_urls = MySociety::Config.get("THEME_URLS", [])
+ theme_urls.each{ |theme_url| install_theme(theme_url, verbose) }
+ theme_url = MySociety::Config.get("THEME_URL", "")
+ if ! theme_url.blank?
+ # Old version of the above, for backwards compatibility
+ install_theme(theme_url, verbose, deprecated=true)
+ end
+ end
+end \ No newline at end of file
diff --git a/locale/uk/app.po b/locale/uk/app.po
index b195e83b4..34f9a2d1a 100644
--- a/locale/uk/app.po
+++ b/locale/uk/app.po
@@ -10,7 +10,7 @@ msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: http://github.com/sebbacon/alaveteli/issues\n"
"POT-Creation-Date: 2012-08-24 09:20+0100\n"
-"PO-Revision-Date: 2012-08-27 23:12+0000\n"
+"PO-Revision-Date: 2012-08-28 10:57+0000\n"
"Last-Translator: hiiri <murahoid@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
@@ -1404,10 +1404,10 @@ msgid ""
msgstr ""
msgid "Joined in"
-msgstr ""
+msgstr "Приєднався у"
msgid "Joined {{site_name}} in"
-msgstr ""
+msgstr "Користувач долучився до {{site_name}} у"
msgid ""
"Keep it <strong>focused</strong>, you'll be more likely to get what you want"
@@ -1504,10 +1504,10 @@ msgid "My wall"
msgstr "Моя стіна"
msgid "Name can't be blank"
-msgstr "Ім’я не може бути пустим"
+msgstr "Ім’я/назва не може бути пустим"
msgid "Name is already taken"
-msgstr "Користувач з таким іменем уже зареєстрованим"
+msgstr "Це ім’я/назва вже використано"
msgid "New Freedom of Information requests"
msgstr "Нові запити"
@@ -2167,7 +2167,7 @@ msgstr[1] "Шукати серед %d запитів зроблених до %s"
msgstr[2] "Шукати серед %d запитів зроблених до %s"
msgid "Search your contributions"
-msgstr ""
+msgstr "Пошук у вашій діяльності на сайті"
msgid "Select one to see more information about the authority."
msgstr "Оберіть щоб дізнатися більше про розпорядника інформації"
@@ -2212,7 +2212,7 @@ msgid "Show only..."
msgstr "Показати тільки..."
msgid "Showing"
-msgstr ""
+msgstr "Показати"
msgid "Sign in"
msgstr "Увійти"
@@ -2620,7 +2620,7 @@ msgid "Things to do with this request"
msgstr "Що можна зробити з цим запитом"
msgid "Things you're following"
-msgstr ""
+msgstr "Відслідковуване вами"
msgid "This authority no longer exists, so you cannot make a request to it."
msgstr "Цього органу більше не існує, тож ви не можете зробити запит."
@@ -2904,7 +2904,7 @@ msgid "TrackThing|Track type"
msgstr ""
msgid "Turn off email alerts"
-msgstr ""
+msgstr "Відключити сповіщення на електронну пошту"
msgid "Tweet this request"
msgstr ""
@@ -3038,16 +3038,16 @@ msgid "View Freedom of Information requests made by {{user_name}}:"
msgstr ""
msgid "View and search requests"
-msgstr ""
+msgstr "Переглядати та шукати запити"
msgid "View authorities"
-msgstr ""
+msgstr "Показати розпорядників інформації"
msgid "View email"
-msgstr ""
+msgstr "Показати емейли"
msgid "View requests"
-msgstr ""
+msgstr "Показати запити"
msgid "Waiting clarification."
msgstr ""
@@ -3193,7 +3193,7 @@ msgstr ""
msgid ""
"You are currently receiving notification of new activity on your wall by "
"email."
-msgstr ""
+msgstr "Ви отримуєте сповіщення про нову активність на вашій стіні електронною поштою."
msgid "You are following all new successful responses"
msgstr ""
@@ -3212,7 +3212,7 @@ msgstr ""
msgid ""
"You can change the requests and users you are following on <a "
"href=\"{{profile_url}}\">your profile page</a>."
-msgstr ""
+msgstr "Ви можете змінювати відслідковувані вами запити та користувачів на <a href=\"{{profile_url}}\">сторінці вашого профілю</a>."
msgid ""
"You can get this page in computer-readable format as part of the main JSON\n"
@@ -3229,7 +3229,7 @@ msgstr ""
msgid ""
"You have found a bug. Please <a href=\"{{contact_url}}\">contact us</a> to "
"tell us about the problem"
-msgstr ""
+msgstr "Ви натрапили на баг. Будь ласка, <a href=\"{{contact_url}}\">напишіть нам</a> про цю проблему"
msgid ""
"You have hit the rate limit on new requests. Users are ordinarily limited to"
@@ -3238,13 +3238,13 @@ msgid ""
msgstr ""
msgid "You have made no Freedom of Information requests using this site."
-msgstr ""
+msgstr "Ви не зробили жодного запиту через цей сайт."
msgid "You have now changed the text about you on your profile."
-msgstr ""
+msgstr "Ви змінили текст про себе в профілі."
msgid "You have now changed your email address used on {{site_name}}"
-msgstr ""
+msgstr "Ви змінили свою електронну адресу на {{site_name}}"
msgid ""
"You just tried to sign up to {{site_name}}, when you\n"
@@ -3326,7 +3326,7 @@ msgid "You're long overdue a response to your FOI request - "
msgstr ""
msgid "You're not following anything."
-msgstr ""
+msgstr "Ви нічого не відслідковуєте"
msgid "You've now cleared your profile photo"
msgstr ""
@@ -3352,7 +3352,7 @@ msgid ""
msgstr ""
msgid "Your annotations"
-msgstr ""
+msgstr "Ваші анотації"
msgid ""
"Your details have not been given to anyone, unless you choose to reply to this\n"
@@ -3459,13 +3459,13 @@ msgid "admin"
msgstr ""
msgid "all requests"
-msgstr ""
+msgstr "усі запити"
msgid "also called {{public_body_short_name}}"
msgstr ""
msgid "and"
-msgstr ""
+msgstr "і"
msgid ""
"and update the status accordingly. Perhaps <strong>you</strong> might like "
@@ -3535,7 +3535,7 @@ msgid "during term time"
msgstr ""
msgid "edit text about you"
-msgstr ""
+msgstr "відредагувати інформацію про себе"
msgid "even during holidays"
msgstr ""
@@ -3571,7 +3571,7 @@ msgid "is <strong>waiting for your clarification</strong>."
msgstr ""
msgid "just to see how it works"
-msgstr ""
+msgstr "просто щоб побачити, як це працює"
msgid "left an annotation"
msgstr ""
@@ -3637,7 +3637,7 @@ msgid "successful"
msgstr ""
msgid "successful requests"
-msgstr ""
+msgstr "успішні запити"
msgid "that you made to"
msgstr ""
@@ -3682,10 +3682,10 @@ msgid "unsubscribe all"
msgstr ""
msgid "unsuccessful"
-msgstr ""
+msgstr "невдалі"
msgid "unsuccessful requests"
-msgstr ""
+msgstr "невдалі запити"
msgid "useful information."
msgstr ""
@@ -3694,7 +3694,7 @@ msgid "users"
msgstr ""
msgid "{{count}} FOI requests found"
-msgstr ""
+msgstr "Знайдено таку кількість запитів: {{count}}"
msgid ""
"{{existing_request_user}} already\n"
diff --git a/public/robots.txt b/public/robots.txt
index a187d0775..279573d31 100644
--- a/public/robots.txt
+++ b/public/robots.txt
@@ -28,6 +28,6 @@ Disallow: */body/*/view_email$
# The following adding Jan 2012 to stop robots crawling pages
# generated in error (see
-# https://github.com/sebbacon/alaveteli/issues/311). Can be removed
+# https://github.com/mysociety/alaveteli/issues/311). Can be removed
# later in 2012 when the error pages have been dropped from the index
Disallow: *.json.j*
diff --git a/script/rails-post-deploy b/script/rails-post-deploy
index dd2e61877..977805eb5 100755
--- a/script/rails-post-deploy
+++ b/script/rails-post-deploy
@@ -82,33 +82,7 @@ fi
bundle install $bundle_install_options
-function run_post_install {
- NAME=`echo $1 | sed -re 's/.*\/(.*)\.git.?/\1/'`
- POST_INSTALL="vendor/plugins/$NAME/post_install.rb"
- if [ -e $POST_INSTALL ]
- then
- echo "running post install script at $POST_INSTALL..."
- script/runner $POST_INSTALL
- fi
-}
-
-if [ -n "$OPTION_THEME_URLS" ]
-then
- for THEME in "${OPTION_THEME_URLS[@]}"
- do
- echo "Installing $THEME..."
- script/plugin install --force $THEME
- run_post_install $THEME
- done
-fi
-
-# Old version of the above, for backwards compatibility
-if [ -n "$OPTION_THEME_URL" ]
-then
- echo "Installing $OPTION_THEME_URL using deprecated THEME_URL..."
- script/plugin install --force $OPTION_THEME_URL
- run_post_install $OPTION_THEME_URL
-fi
+bundle exec rake themes:install
# upgrade database
bundle exec rake db:migrate #--trace
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
index 252818452..8a3934685 100644
--- a/spec/controllers/admin_request_controller_spec.rb
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -21,6 +21,11 @@ describe AdminRequestController, "when administering requests" do
get :show, :id => info_requests(:fancy_dog_request)
end
+ it 'shows an external public body with no username' do
+ get :show, :id => info_requests(:anonymous_external_request)
+ response.should be_success
+ end
+
it "edits a public body" do
get :edit, :id => info_requests(:fancy_dog_request)
end
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index df2c139bd..de8dd8422 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -9,7 +9,7 @@ describe GeneralController, "when trying to show the blog" do
FakeWeb.clean_registry
end
- it "should fail silently if the blog is returning an error" do
+ it "should fail silently if the blog is returning an error" do
FakeWeb.register_uri(:get, %r|.*|, :body => "Error", :status => ["500", "Error"])
get :blog
response.status.should == "200 OK"
@@ -76,7 +76,7 @@ describe GeneralController, "when searching" do
response.should redirect_to(:action => 'search', :combined => "mouse", :view => "all") # URL /search/:query/all
end
- describe "when using different locale settings" do
+ describe "when using different locale settings" do
home_link_regex = /href=".*\/en\//
it "should generate URLs with a locale prepended when there's more than one locale set" do
get :frontpage
@@ -117,7 +117,7 @@ describe GeneralController, "when searching" do
I18n.available_locales = old_i18n_available_locales
end
end
-
+
describe 'when constructing the list of recent requests' do
before(:each) do
load_raw_emails_data
@@ -127,7 +127,7 @@ describe GeneralController, "when searching" do
it 'should list the newest successful request first' do
# Make sure the newest is listed first even if an older one
# has a newer comment or was reclassified more recently:
- # https://github.com/sebbacon/alaveteli/issues/370
+ # https://github.com/mysociety/alaveteli/issues/370
#
# This is a deliberate behaviour change, in that the
# previous behaviour (showing more-recently-reclassified
@@ -135,7 +135,7 @@ describe GeneralController, "when searching" do
get :frontpage
assigns[:request_events].first.info_request.should == info_requests(:another_boring_request)
end
-
+
it 'should coalesce duplicate requests' do
get :frontpage
assigns[:request_events].map(&:info_request).select{|x|x.url_title =~ /^spam/}.length.should == 1
@@ -231,7 +231,7 @@ describe GeneralController, "when searching" do
u.email_confirmed = true
u.save!
update_xapian_index
-
+
get :search, :combined => ["unconfirmed", "users"]
response.should render_template('search')
assigns[:xapian_users].results.map{|x|x[:model]}.should == [u]
@@ -239,7 +239,7 @@ describe GeneralController, "when searching" do
it "should show tracking links for requests-only searches" do
get :search, :combined => ['"bob"', "requests"]
- response.body.should include('Track this search')
+ response.body.should include('Track this search')
end
end
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 0ff795029..b8425613c 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -522,7 +522,7 @@ describe RequestController, "when showing one request" do
# error-handling path, causing the wrong sort of error response to be returned in the
# case where the integer prefix referred to the wrong request.)
#
- # https://github.com/sebbacon/alaveteli/issues/351
+ # https://github.com/mysociety/alaveteli/issues/351
it "should return 404 for ugly URLs containing a request id that isn't an integer" do
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-two-same-name.email', ir.incoming_email)
diff --git a/spec/fixtures/info_request_events.yml b/spec/fixtures/info_request_events.yml
index e3e8a4460..c1a00ad47 100644
--- a/spec/fixtures/info_request_events.yml
+++ b/spec/fixtures/info_request_events.yml
@@ -16,7 +16,7 @@ silly_outgoing_message_event:
created_at: 2007-10-14 10:41:12.686264
described_state:
outgoing_message_id: 2
-useless_incoming_message_event:
+useless_incoming_message_event:
id: 902
params_yaml: "--- \n\
:incoming_message_id: 1\n"
@@ -25,18 +25,18 @@ useless_incoming_message_event:
created_at: 2007-11-13 18:09:20.042061
described_state:
incoming_message_id: 1
-silly_comment_event:
+silly_comment_event:
id: 903
params_yaml: "--- \n\
:comment_id: 1\n"
- incoming_message_id:
- last_described_at:
- described_state:
+ incoming_message_id:
+ last_described_at:
+ described_state:
info_request_id: 101
comment_id: 1
- calculated_state:
+ calculated_state:
event_type: comment
- outgoing_message_id:
+ outgoing_message_id:
created_at: 2008-08-12 23:05:12.500942
badger_outgoing_message_event:
id: 904
@@ -98,11 +98,11 @@ another_comment_event:
comment_id: 2
params_yaml: "--- \n\
:comment_id: 2\n"
- incoming_message_id:
- outgoing_message_id:
- last_described_at:
- described_state:
- calculated_state:
+ incoming_message_id:
+ outgoing_message_id:
+ last_described_at:
+ described_state:
+ calculated_state:
event_type: comment
created_at: 2008-08-12 12:05:12.879634
@@ -160,3 +160,14 @@ external_outgoing_message_event:
created_at: 2009-01-02 02:23:45.6789100
described_state: waiting_response
calculated_state: waiting_response
+
+anonymous_external_outgoing_message_event:
+ id: 915
+ params_yaml: "--- \n\
+ :outgoing_message_id: 9\n"
+ outgoing_message_id: 9
+ info_request_id: 110
+ event_type: sent
+ created_at: 2009-01-03 02:23:45.6789100
+ described_state: waiting_response
+ calculated_state: waiting_response
diff --git a/spec/fixtures/info_requests.yml b/spec/fixtures/info_requests.yml
index e4f2287c0..079a44cd0 100644
--- a/spec/fixtures/info_requests.yml
+++ b/spec/fixtures/info_requests.yml
@@ -88,3 +88,13 @@ external_request:
described_state: waiting_response
awaiting_description: false
idhash: a1234567
+anonymous_external_request:
+ id: 110
+ title: Anonymous request
+ url_title: anonymous_request
+ external_user_name:
+ external_url: http://www.example.org/request/anonymous_requesr
+ public_body_id: 2
+ described_state: waiting_response
+ awaiting_description: false
+ idhash: 7654321a \ No newline at end of file
diff --git a/spec/fixtures/outgoing_messages.yml b/spec/fixtures/outgoing_messages.yml
index 32b322bd7..55df8473e 100644
--- a/spec/fixtures/outgoing_messages.yml
+++ b/spec/fixtures/outgoing_messages.yml
@@ -97,3 +97,14 @@ external_outgoing_message:
updated_at: 2009-01-12 01:56:58.586598
what_doing: normal_sort
+anonymous_external_outgoing_message:
+ id: 9
+ info_request_id: 110
+ message_type: initial_request
+ status: sent
+ body: "I do not wish to reveal my name, but would like all your information."
+ last_sent_at: 2009-01-12 01:57:58.586598
+ created_at: 2009-01-12 01:56:58.586598
+ updated_at: 2009-01-12 01:56:58.586598
+ what_doing: normal_sort
+
diff --git a/spec/helpers/link_to_helper_spec.rb b/spec/helpers/link_to_helper_spec.rb
index f11f2b5bb..9ec0afce1 100644
--- a/spec/helpers/link_to_helper_spec.rb
+++ b/spec/helpers/link_to_helper_spec.rb
@@ -1,11 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-describe LinkToHelper do
-
+describe LinkToHelper do
+
include LinkToHelper
-
- describe 'when creating a url for a request' do
-
+
+ describe 'when creating a url for a request' do
+
before do
@mock_request = mock_model(InfoRequest, :url_title => 'test_title')
@old_filters = ActionController::Routing::Routes.filters
@@ -15,15 +15,15 @@ describe LinkToHelper do
ActionController::Routing::Routes.filters = @old_filters
end
-
- it 'should return a path like /request/test_title' do
+
+ it 'should return a path like /request/test_title' do
request_url(@mock_request).should == '/request/test_title'
end
-
- it 'should return a path including any extra parameters passed' do
+
+ it 'should return a path including any extra parameters passed' do
request_url(@mock_request, {:update_status => 1}).should == '/request/test_title?update_status=1'
end
-
+
end
describe "when appending something to a URL" do
@@ -37,5 +37,15 @@ describe LinkToHelper do
main_url('/a?z=9%', '.json').should == 'http://test.host/a?z=9%'
end
end
-
+
+ describe 'when displaying a user admin link for a request' do
+
+ it 'should return the text "An anonymous user (external)" in the case where there is no external username' do
+ info_request = mock_model(InfoRequest, :external_user_name => nil,
+ :is_external? => true)
+ user_admin_link_for_request(info_request).should == 'Anonymous user (external)'
+ end
+
+ end
+
end
diff --git a/spec/integration/create_request_spec.rb b/spec/integration/create_request_spec.rb
index 6f336d406..56757c7e0 100644
--- a/spec/integration/create_request_spec.rb
+++ b/spec/integration/create_request_spec.rb
@@ -2,14 +2,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "When creating requests" do
it "should associate the request with the requestor, even if it is approved by an admin" do
- # This is a test for https://github.com/sebbacon/alaveteli/issues/446
-
+ # This is a test for https://github.com/mysociety/alaveteli/issues/446
+
params = { :info_request => { :public_body_id => public_bodies(:geraldine_public_body).id,
:title => "Why is your quango called Geraldine?", :tag_string => "" },
:outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
:submitted_new_request => 1, :preview => 0
}
-
+
# Initially we are not logged in. Try to create a new request.
post "/new", params
# We expect to be redirected to the login page
@@ -17,13 +17,13 @@ describe "When creating requests" do
response.should redirect_to(:controller => 'user', :action => 'signin', :token => post_redirect.token)
follow_redirect!
response.should render_template("user/sign")
-
+
# Now log in as an unconfirmed user.
post "/profile/sign_in", :user_signin => {:email => users(:unconfirmed_user).email, :password => "jonespassword"}, :token => post_redirect.token
# This will trigger a confirmation mail. Get the PostRedirect for later.
response.should render_template("user/confirm")
post_redirect = PostRedirect.get_last_post_redirect
-
+
# Now log in as an admin user, then follow the confirmation link in the email that was sent to the unconfirmed user
admin_user = users(:admin_user)
admin_user.email_confirmed = true
@@ -37,7 +37,7 @@ describe "When creating requests" do
url_title = $1
info_request = InfoRequest.find_by_url_title(url_title)
info_request.should_not be_nil
-
+
# Make sure the request is still owned by the user who made it, not the admin who confirmed it
info_request.user_id.should == users(:unconfirmed_user).id
end
diff --git a/spec/lib/public_body_categories_spec.rb b/spec/lib/public_body_categories_spec.rb
new file mode 100644
index 000000000..e53d9a028
--- /dev/null
+++ b/spec/lib/public_body_categories_spec.rb
@@ -0,0 +1,42 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe PublicBodyCategories do
+
+ before do
+ load_test_categories
+ end
+
+ describe 'when asked for categories with headings' do
+
+ it 'should return a list of headings as plain strings, each followed by n tag specifications as
+ lists in the form:
+ ["tag_to_use_as_category", "Sub category title", "Instance description"]' do
+ expected_categories = ["Local and regional", ["local_council",
+ "Local councils",
+ "a local council"],
+ "Miscellaneous", ["other",
+ "Miscellaneous",
+ "miscellaneous"]]
+ PublicBodyCategories::get().with_headings().should == expected_categories
+ end
+
+ end
+
+ describe 'when asked for headings' do
+
+ it 'should return a list of headings' do
+ PublicBodyCategories::get().headings().should == ['Local and regional', 'Miscellaneous']
+ end
+
+ end
+
+ describe 'when asked for tags by headings' do
+
+ it 'should return a hash of tags keyed by heading' do
+ PublicBodyCategories::get().by_heading().should == {'Local and regional' => ['local_council'],
+ 'Miscellaneous' => ['other']}
+ end
+
+ end
+
+end \ No newline at end of file
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index e30916dff..8ff6afde3 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -1,6 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
-describe PublicBody, " using tags" do
+describe PublicBody, " using tags" do
before do
@public_body = PublicBody.new(:name => 'Aardvark Monitoring Service',
:short_name => 'AMS',
@@ -9,7 +9,7 @@ describe PublicBody, " using tags" do
:last_edit_comment => '')
end
- it 'should correctly convert a tag string into tags' do
+ it 'should correctly convert a tag string into tags' do
@public_body.tag_string = 'stilton emmental'
@public_body.tag_string.should == 'stilton emmental'
@@ -56,7 +56,7 @@ describe PublicBody, " using tags" do
end
end
-describe PublicBody, " using machine tags" do
+describe PublicBody, " using machine tags" do
before do
@public_body = PublicBody.new(:name => 'Aardvark Monitoring Service',
:short_name => 'AMS',
@@ -114,22 +114,22 @@ describe PublicBody, "when finding_by_tags" do
end
end
-describe PublicBody, " when making up the URL name" do
+describe PublicBody, " when making up the URL name" do
before do
@public_body = PublicBody.new
end
- it 'should remove spaces, and make lower case' do
+ it 'should remove spaces, and make lower case' do
@public_body.name = 'Some Authority'
@public_body.url_name.should == 'some_authority'
end
- it 'should not allow a numeric name' do
+ it 'should not allow a numeric name' do
@public_body.name = '1234'
@public_body.url_name.should == 'body'
end
end
-
+
describe PublicBody, " when saving" do
before do
@public_body = PublicBody.new
@@ -157,14 +157,14 @@ describe PublicBody, " when saving" do
@public_body.last_edit_comment = "This is a test"
@public_body.save!
end
-
+
it "should update first_letter" do
@public_body.name = "Testing Public Body"
@public_body.short_name = "TPB"
@public_body.request_email = "request@localhost"
@public_body.last_edit_editor = "*test*"
@public_body.last_edit_comment = "This is a test"
-
+
@public_body.first_letter.should be_nil
@public_body.save!
@public_body.first_letter.should == 'T'
@@ -208,14 +208,14 @@ describe PublicBody, "when searching" do
body.id.should == 3
body.class.to_s.should == 'PublicBody'
end
-
+
it "should cope with same url_name across multiple locales" do
PublicBody.with_locale(:es) do
# use the unique spanish name to retrieve and edit
body = PublicBody.find_by_url_name_with_historic('etgq')
body.short_name = 'tgq' # Same as english version
- body.save!
-
+ body.save!
+
# now try to retrieve it
body = PublicBody.find_by_url_name_with_historic('tgq')
body.id.should == public_bodies(:geraldine_public_body).id
@@ -242,7 +242,7 @@ describe PublicBody, " when loading CSV files" do
# depending on the tag used. By accessing it here before every test, it doesn't disturb our checks later on
PublicBody.internal_admin_body
end
-
+
it "should import even if no email is provided" do
errors, notes = PublicBody.import_csv("1,aBody", '', 'replace', true, 'someadmin') # true means dry run
errors.should == []
@@ -250,7 +250,7 @@ describe PublicBody, " when loading CSV files" do
notes[0].should == "line 1: creating new authority 'aBody' (locale: en):\n\t{\"name\":\"aBody\"}"
notes[1].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/
end
-
+
it "should do a dry run successfully" do
original_count = PublicBody.count
@@ -259,8 +259,8 @@ describe PublicBody, " when loading CSV files" do
errors.should == []
notes.size.should == 4
notes[0..2].should == [
- "line 1: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\"\}",
- "line 2: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\"\}",
+ "line 1: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\"\}",
+ "line 2: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\"\}",
"line 3: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"\}",
]
notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/
@@ -276,8 +276,8 @@ describe PublicBody, " when loading CSV files" do
errors.should == []
notes.size.should == 4
notes[0..2].should == [
- "line 1: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\"\}",
- "line 2: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\"\}",
+ "line 1: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\"\}",
+ "line 2: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\"\}",
"line 3: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"\}",
]
notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/
@@ -287,14 +287,14 @@ describe PublicBody, " when loading CSV files" do
it "should do imports without a tag successfully" do
original_count = PublicBody.count
-
+
csv_contents = load_file_fixture("fake-authority-type.csv")
errors, notes = PublicBody.import_csv(csv_contents, '', 'replace', false, 'someadmin') # false means real run
errors.should == []
notes.size.should == 4
notes[0..2].should == [
- "line 1: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\"\}",
- "line 2: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\"\}",
+ "line 1: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\"\}",
+ "line 2: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\"\}",
"line 3: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\"\}",
]
notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/
@@ -309,15 +309,15 @@ describe PublicBody, " when loading CSV files" do
errors.should == []
notes.size.should == 4
notes[0..2].should == [
- "line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"\}",
- "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"\}",
+ "line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"\}",
+ "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"\}",
"line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"\}",
]
notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/
PublicBody.count.should == original_count
end
-
+
it "should import tags successfully when the import tag is not set" do
csv_contents = load_file_fixture("fake-authority-type-with-field-names.csv")
errors, notes = PublicBody.import_csv(csv_contents, '', 'replace', false, 'someadmin') # false means real run
@@ -344,11 +344,11 @@ describe PublicBody, " when loading CSV files" do
PublicBody.find_by_name('North West Fake Authority').tag_array_for_search.should == ['fake']
PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['fake', 'scottish']
PublicBody.find_by_name('Fake Authority of Northern Ireland').tag_array_for_search.should == ['aTag', 'fake']
-
+
# Import again to check the 'replace' tag functionality works
new_tags_file = load_file_fixture('fake-authority-add-tags.rb')
errors, notes = PublicBody.import_csv(new_tags_file, 'fake', 'replace', false, 'someadmin') # false means real run
-
+
# Check tags were added successfully
PublicBody.find_by_name('North West Fake Authority').tag_array_for_search.should == ['aTag']
PublicBody.find_by_name('Scottish Fake Authority').tag_array_for_search.should == ['aTag']
@@ -363,8 +363,8 @@ describe PublicBody, " when loading CSV files" do
errors.should == []
notes.size.should == 7
notes[0..5].should == [
- "line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"}",
- "line 2: creating new authority 'North West Fake Authority' (locale: es):\n\t{\"name\":\"Autoridad del Nordeste\"}",
+ "line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"}",
+ "line 2: creating new authority 'North West Fake Authority' (locale: es):\n\t{\"name\":\"Autoridad del Nordeste\"}",
"line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}",
"line 3: creating new authority 'Scottish Fake Authority' (locale: es):\n\t{\"name\":\"Autoridad Escocesa\"}",
"line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}",
@@ -373,8 +373,8 @@ describe PublicBody, " when loading CSV files" do
notes[6].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/
PublicBody.count.should == original_count + 3
-
- # XXX Not sure why trying to do a PublicBody.with_locale fails here. Seems related to
+
+ # XXX Not sure why trying to do a PublicBody.with_locale fails here. Seems related to
# the way categories are loaded every time from the PublicBody class. For now we just
# test some translation was done.
body = PublicBody.find_by_name('North West Fake Authority')
@@ -387,13 +387,13 @@ describe PublicBody, " when loading CSV files" do
csv_contents = load_file_fixture("fake-authority-type-with-field-names.csv")
# Depending on the runtime environment (Ruby version? OS?) the list of available locales
# is made of strings or symbols, so we use 'en' here as a string to test both scenarios.
- # See https://github.com/sebbacon/alaveteli/issues/193
+ # See https://github.com/mysociety/alaveteli/issues/193
errors, notes = PublicBody.import_csv(csv_contents, '', 'replace', true, 'someadmin', ['en', :xx]) # true means dry run
errors.should == []
notes.size.should == 4
notes[0..2].should == [
"line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"}",
- "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}",
+ "line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}",
"line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}",
]
notes[3].should =~ /Notes: Some bodies are in database, but not in CSV file:\n( [A-Za-z ]+\n)*You may want to delete them manually.\n/