From 92ba759dc37a1365323381bd4a60a07785ab6345 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 8 Aug 2019 16:07:16 +0100 Subject: [PATCH 1/2] Minor code cleanup * Hash style * Quote style * Brace padding * Line spacing * DSL Parenthesis (don't need them for select tag) --- app/views/admin_incoming_message/edit.html.erb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/views/admin_incoming_message/edit.html.erb b/app/views/admin_incoming_message/edit.html.erb index b349ba033f..b47ae8c0c5 100644 --- a/app/views/admin_incoming_message/edit.html.erb +++ b/app/views/admin_incoming_message/edit.html.erb @@ -1,26 +1,28 @@ -<%= render :partial => 'intro', :locals => {:incoming_message => @incoming_message } %> -<%= render :partial => 'actions', :locals => { :incoming_message => @incoming_message } %> +<%= render partial: 'intro', locals: { incoming_message: @incoming_message } %> +<%= render partial: 'actions', locals: { incoming_message: @incoming_message } %> +
Prominence - <%= form_tag admin_incoming_message_path(@incoming_message), :method => 'put', :class => "form form-inline" do %> + <%= form_tag admin_incoming_message_path(@incoming_message), method: 'put', class: 'form form-inline' do %>
- + +
- <%= select('incoming_message', "prominence", IncomingMessage.prominence_states) %> + <%= select 'incoming_message', 'prominence', IncomingMessage.prominence_states %>
+
- <%= text_area "incoming_message", "prominence_reason", :rows => 5, :class => "span6" %> + <%= text_area 'incoming_message', 'prominence_reason', rows: 5, class: 'span6' %>
- <%= submit_tag 'Save', :class => "btn" %> + <%= submit_tag 'Save', class: 'btn' %>
- <% end %>
From 392a2dad44d5c8f38898a8dd8759933cb3bbfcdf Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 8 Aug 2019 16:08:36 +0100 Subject: [PATCH 2/2] List FOI Attachments on admin page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When handling data breaches we need to find the hexdigest of the attachment to ensure it gets purged from all caches / backups etc. Its quite hard to do this – even from the console – and any console commands are prone to error. Its easier to just show the associated attachments on the admin interface, along with some less user-friendly information that's useful for admin purposes. --- .../_foi_attachments.html.erb | 30 +++++++++++++++++++ .../admin_incoming_message/edit.html.erb | 3 ++ doc/CHANGES.md | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 app/views/admin_incoming_message/_foi_attachments.html.erb diff --git a/app/views/admin_incoming_message/_foi_attachments.html.erb b/app/views/admin_incoming_message/_foi_attachments.html.erb new file mode 100644 index 0000000000..5e7a865e47 --- /dev/null +++ b/app/views/admin_incoming_message/_foi_attachments.html.erb @@ -0,0 +1,30 @@ +
+ Attachments + + <% if foi_attachments.any? %> + + + + + + + + + + + + <% foi_attachments.each do |attachment| %> + + + + + + + + <% end %> + +
IDFilenameContent TypeHexdigestDisplay Size
<%= attachment.id %><%= attachment.filename %><%= attachment.content_type %><%= attachment.hexdigest %><%= attachment.display_size %>
+ <% else %> +

No attachments.

+ <% end %> +
diff --git a/app/views/admin_incoming_message/edit.html.erb b/app/views/admin_incoming_message/edit.html.erb index b47ae8c0c5..02832c652e 100644 --- a/app/views/admin_incoming_message/edit.html.erb +++ b/app/views/admin_incoming_message/edit.html.erb @@ -26,3 +26,6 @@ <% end %> + +<%= render partial: 'foi_attachments', + locals: { foi_attachments: @incoming_message.foi_attachments } %> diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 1357b4f392..29998fe62b 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -2,6 +2,8 @@ ## Highlighted Features +* Show incoming message attachments in admin interface (Gareth Rees) + ## Upgrade Notes ### Changed Templates