aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-07-31 15:32:57 +0100
committerLouise Crow <louise.crow@gmail.com>2013-09-16 12:11:40 +0100
commita23be37bb6b4c4991766e1ed0f9cd0922c8db3a7 (patch)
tree43bd8057a5a0b6fcc45824e8d79079876c26c62c
parent220e4ac2c76c16b3d16c77753228fe439bafc7c7 (diff)
Remove prominence.
Add a migration to remove the unused column 'prominence' from info_request_events, remove validation of prominence, remove unused InfoRequestEvent.user_can_view? method. Remove references to InfoRequestEvent.prominence.
-rw-r--r--app/models/info_request_event.rb23
-rw-r--r--app/views/admin_general/timeline.html.erb2
-rw-r--r--db/migrate/20130731142632_remove_prominence_from_info_request_event.rb9
-rw-r--r--spec/fixtures/locale/en/app.po4
-rw-r--r--spec/fixtures/locale/en_GB/app.po4
-rw-r--r--spec/fixtures/locale/es/app.po4
6 files changed, 10 insertions, 36 deletions
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 0967e3940..2350aea01 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -63,35 +63,12 @@ class InfoRequestEvent < ActiveRecord::Base
# user described state (also update in info_request)
validate :must_be_valid_state
- # whether event is publicly visible
- validates_inclusion_of :prominence, :in => [
- 'normal',
- 'hidden',
- 'requester_only'
- ]
-
def must_be_valid_state
if !described_state.nil? and !InfoRequest.enumerate_states.include?(described_state)
errors.add(described_state, "is not a valid state")
end
end
- def user_can_view?(user)
- unless info_request.user_can_view?(user)
- raise "internal error, called user_can_view? on event when there is not permission to view entire request"
- end
-
- case prominence
- when 'hidden'
- User.view_hidden_requests?(user)
- when 'requester_only'
- info_request.is_owning_user?(user)
- else
- true
- end
- end
-
-
# Full text search indexing
acts_as_xapian :texts => [ :search_text_main, :title ],
:values => [
diff --git a/app/views/admin_general/timeline.html.erb b/app/views/admin_general/timeline.html.erb
index 8fd8875b6..fe2221294 100644
--- a/app/views/admin_general/timeline.html.erb
+++ b/app/views/admin_general/timeline.html.erb
@@ -34,7 +34,7 @@
<%= request_both_links(event.info_request) %>
<% if event.event_type == 'edit' %>
was edited by administrator <strong><%=h event.params[:editor] %></strong>.
- <% for p in ['title', 'prominence', 'described_state', 'awaiting_description']
+ <% for p in ['title', 'described_state', 'awaiting_description']
if event.params[p.to_sym] != event.params[('old_'+p).to_sym]
%> Changed <%=p%> from '<%=h event.params[('old_'+p).to_sym]%>' to '<%=h event.params[p.to_sym] %>'. <%
end
diff --git a/db/migrate/20130731142632_remove_prominence_from_info_request_event.rb b/db/migrate/20130731142632_remove_prominence_from_info_request_event.rb
new file mode 100644
index 000000000..df0278c20
--- /dev/null
+++ b/db/migrate/20130731142632_remove_prominence_from_info_request_event.rb
@@ -0,0 +1,9 @@
+class RemoveProminenceFromInfoRequestEvent < ActiveRecord::Migration
+ def up
+ remove_column :info_request_events, :prominence
+ end
+
+ def down
+ add_column :info_request_events, :prominence, :string, :null => false, :default => 'normal'
+ end
+end
diff --git a/spec/fixtures/locale/en/app.po b/spec/fixtures/locale/en/app.po
index ee5c8d9c8..6d5bca1f9 100644
--- a/spec/fixtures/locale/en/app.po
+++ b/spec/fixtures/locale/en/app.po
@@ -1417,10 +1417,6 @@ msgstr ""
msgid "InfoRequestEvent|Params yaml"
msgstr ""
-#: locale/model_attributes.rb:41
-msgid "InfoRequestEvent|Prominence"
-msgstr ""
-
#: locale/model_attributes.rb:102
msgid "InfoRequest|Allow new responses from"
msgstr ""
diff --git a/spec/fixtures/locale/en_GB/app.po b/spec/fixtures/locale/en_GB/app.po
index 84997a319..f106273a0 100644
--- a/spec/fixtures/locale/en_GB/app.po
+++ b/spec/fixtures/locale/en_GB/app.po
@@ -1417,10 +1417,6 @@ msgstr ""
msgid "InfoRequestEvent|Params yaml"
msgstr ""
-#: locale/model_attributes.rb:41
-msgid "InfoRequestEvent|Prominence"
-msgstr ""
-
#: locale/model_attributes.rb:102
msgid "InfoRequest|Allow new responses from"
msgstr ""
diff --git a/spec/fixtures/locale/es/app.po b/spec/fixtures/locale/es/app.po
index d45d9b3b1..2e0f4302a 100644
--- a/spec/fixtures/locale/es/app.po
+++ b/spec/fixtures/locale/es/app.po
@@ -1553,10 +1553,6 @@ msgstr "InfoRequestEvent|Last described at"
msgid "InfoRequestEvent|Params yaml"
msgstr "InfoRequestEvent|Params yaml"
-#: locale/model_attributes.rb:41
-msgid "InfoRequestEvent|Prominence"
-msgstr "InfoRequestEvent|Prominence"
-
#: locale/model_attributes.rb:102
msgid "InfoRequest|Allow new responses from"
msgstr "InfoRequest|Allow new responses from"