From e2d2dc752befe4bed5bcd224368e0d002b9d41b9 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Mon, 12 Feb 2024 21:30:14 +0000
Subject: [PATCH 1/7] Update info_request_helper.rb
Collect attachments for an info request in one place
---
app/helpers/info_request_helper.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/helpers/info_request_helper.rb b/app/helpers/info_request_helper.rb
index a39c74a113..d21e652e69 100644
--- a/app/helpers/info_request_helper.rb
+++ b/app/helpers/info_request_helper.rb
@@ -335,4 +335,8 @@ def attachment_params(attachment, options = {})
def public_token?
defined?(public_token) && public_token.present?
end
+
+ def fetch_foi_attachments(info_request)
+ info_request.incoming_messages.includes(:foi_attachments).flat_map(&:foi_attachments)
+ end
end
From 431b23d31fb377c9355d9e1b46a8401759e2b33b Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Mon, 12 Feb 2024 21:34:48 +0000
Subject: [PATCH 2/7] Update show.html.erb
rendering attachments in the admin panel
---
app/views/admin_request/show.html.erb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb
index 4946874df6..73daf7def8 100644
--- a/app/views/admin_request/show.html.erb
+++ b/app/views/admin_request/show.html.erb
@@ -372,6 +372,11 @@
+ Attachments
+<%= render partial: 'admin_request/some_attachments' %>
+
+
+
Annotations
<%= render partial: 'admin_request/some_annotations' ,
From fb08a5bbce58c56aa9c607cc22933f4f203d24a5 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Mon, 12 Feb 2024 21:49:08 +0000
Subject: [PATCH 3/7] Create _some_attachments.html.erb
new partial to house none main body attachments
---
.../admin_request/_some_attachments.html.erb | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
create mode 100644 app/views/admin_request/_some_attachments.html.erb
diff --git a/app/views/admin_request/_some_attachments.html.erb b/app/views/admin_request/_some_attachments.html.erb
new file mode 100644
index 0000000000..14f60b9b86
--- /dev/null
+++ b/app/views/admin_request/_some_attachments.html.erb
@@ -0,0 +1,27 @@
+
From 134b3a3e1bba2affe2bf749fa2381a56c7c08633 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Mon, 12 Feb 2024 21:55:23 +0000
Subject: [PATCH 4/7] Update info_request_helper.rb
Add main body filtering and split method over several lines so as not to exceed 80 chars
---
app/helpers/info_request_helper.rb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/helpers/info_request_helper.rb b/app/helpers/info_request_helper.rb
index d21e652e69..5c02152acc 100644
--- a/app/helpers/info_request_helper.rb
+++ b/app/helpers/info_request_helper.rb
@@ -337,6 +337,9 @@ def public_token?
end
def fetch_foi_attachments(info_request)
- info_request.incoming_messages.includes(:foi_attachments).flat_map(&:foi_attachments)
+ info_request.incoming_messages
+ .includes(:foi_attachments)
+ .flat_map(&:foi_attachments)
+ .reject(&:main_body_part?)
end
end
From 368aabb7459ea9cce16a0724226036880e918d55 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Tue, 13 Feb 2024 18:32:24 +0000
Subject: [PATCH 5/7] Update info_request_helper.rb
undoing previous change
---
app/helpers/info_request_helper.rb | 7 -------
1 file changed, 7 deletions(-)
diff --git a/app/helpers/info_request_helper.rb b/app/helpers/info_request_helper.rb
index 5c02152acc..a39c74a113 100644
--- a/app/helpers/info_request_helper.rb
+++ b/app/helpers/info_request_helper.rb
@@ -335,11 +335,4 @@ def attachment_params(attachment, options = {})
def public_token?
defined?(public_token) && public_token.present?
end
-
- def fetch_foi_attachments(info_request)
- info_request.incoming_messages
- .includes(:foi_attachments)
- .flat_map(&:foi_attachments)
- .reject(&:main_body_part?)
- end
end
From d055d6bbd0c816e7c9bf384d35f6cb720f90657b Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Tue, 13 Feb 2024 18:36:13 +0000
Subject: [PATCH 6/7] Update show.html.erb
Adds help block, and uses existing partial
---
app/views/admin_request/show.html.erb | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/views/admin_request/show.html.erb b/app/views/admin_request/show.html.erb
index 73daf7def8..85270f7f46 100644
--- a/app/views/admin_request/show.html.erb
+++ b/app/views/admin_request/show.html.erb
@@ -373,8 +373,13 @@
Attachments
-<%= render partial: 'admin_request/some_attachments' %>
+
+
Excludes main body part attachments.
+
+
+<%= render partial: 'admin_incoming_message/foi_attachments',
+ locals: { foi_attachments: @info_request.foi_attachments.substantive } %>
Annotations
From 13b1136591f579af078ac5b9b784635bd17ec2f4 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Tue, 13 Feb 2024 18:39:06 +0000
Subject: [PATCH 7/7] Update foi_attachment.rb
Adds scope to filter out main body part attachments out
---
app/models/foi_attachment.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index f0c726d373..de9e701969 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -49,6 +49,7 @@ class FoiAttachment < ApplicationRecord
before_destroy :delete_cached_file!
scope :binary, -> { where.not(content_type: AlaveteliTextMasker::TextMask) }
+ scope :substantive, -> { reject(&:main_body_part?) }
delegate :expire, :log_event, to: :info_request
delegate :metadata, to: :file_blob