From abc8dc00522747edd1c85f3a44c06e89996c4483 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Fri, 16 Feb 2024 09:35:00 +0000
Subject: [PATCH 1/7] Update incoming_message.rb
Adding notes
---
app/models/incoming_message.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 9024959087..a6331368a7 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -67,6 +67,7 @@ class IncomingMessage < ApplicationRecord
has_many :info_request_events,
dependent: :destroy,
inverse_of: :incoming_message
+ has_many :notes, as: :notable
belongs_to :raw_email,
inverse_of: :incoming_message,
From 2875adf8062ae062e103872b450f30c966fc0746 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Fri, 16 Feb 2024 09:42:12 +0000
Subject: [PATCH 2/7] Update outgoing_message.rb
Adding notes
---
app/models/outgoing_message.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index dfa8e2d94a..28c5643f1a 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -67,6 +67,7 @@ class OutgoingMessage < ApplicationRecord
has_many :info_request_events,
inverse_of: :outgoing_message,
dependent: :destroy
+ has_many :notes, as: :notable
delegate :public_body, to: :info_request, private: true, allow_nil: true
From 5cedf467898fc7db4b6b32aaede7d07402fc4ca6 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Fri, 16 Feb 2024 09:45:36 +0000
Subject: [PATCH 3/7] Update edit.html.erb
Adding notes
---
app/views/admin_incoming_message/edit.html.erb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/views/admin_incoming_message/edit.html.erb b/app/views/admin_incoming_message/edit.html.erb
index e8938304c9..9c3ce04265 100644
--- a/app/views/admin_incoming_message/edit.html.erb
+++ b/app/views/admin_incoming_message/edit.html.erb
@@ -44,3 +44,8 @@
<%= render partial: 'foi_attachments',
locals: { foi_attachments: @incoming_message.foi_attachments } %>
+
+Notes
+<%= render partial: 'admin/notes/show',
+ locals: { notes: @incoming_message.notes, notable: @incoming_message } %>
+
From e60a00d566444773a668f09500d77bde0a3acb6a Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Fri, 16 Feb 2024 09:47:05 +0000
Subject: [PATCH 4/7] Update edit.html.erb
Adding notes
---
app/views/admin_outgoing_message/edit.html.erb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/views/admin_outgoing_message/edit.html.erb b/app/views/admin_outgoing_message/edit.html.erb
index cff4725b50..04831ebbfc 100644
--- a/app/views/admin_outgoing_message/edit.html.erb
+++ b/app/views/admin_outgoing_message/edit.html.erb
@@ -113,4 +113,8 @@
<% end %>
+
+Notes
+<%= render partial: 'admin/notes/show',
+ locals: { notes: @outgoing_message.notes, notable: @outgoing_message } %>
From f29cc83f1a518c7e25b8e881be490562355bbd12 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Fri, 16 Feb 2024 09:51:32 +0000
Subject: [PATCH 5/7] Update _incoming_correspondence.html.erb
Adding notes
---
app/views/request/_incoming_correspondence.html.erb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/views/request/_incoming_correspondence.html.erb b/app/views/request/_incoming_correspondence.html.erb
index 6d05b5178c..db5ef70345 100644
--- a/app/views/request/_incoming_correspondence.html.erb
+++ b/app/views/request/_incoming_correspondence.html.erb
@@ -14,6 +14,8 @@
<% end %>
+ <%= render_notes(incoming_message.notes, class: 'message-notes') %>
+
<%= render partial: 'request/prominence', locals: { prominenceable: incoming_message } %>
<%- if can?(:read, incoming_message) %>
From 4ffbbdaf143789c2854ec3fd4da3e3676cfaf7ec Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Fri, 16 Feb 2024 09:52:34 +0000
Subject: [PATCH 6/7] Update _outgoing_correspondence.html.erb
Adding notes
---
app/views/request/_outgoing_correspondence.html.erb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/views/request/_outgoing_correspondence.html.erb b/app/views/request/_outgoing_correspondence.html.erb
index 16d332c781..78a168078f 100644
--- a/app/views/request/_outgoing_correspondence.html.erb
+++ b/app/views/request/_outgoing_correspondence.html.erb
@@ -27,6 +27,8 @@
<%= link_to _('Try opening the logs in a new window.'), outgoing_message_delivery_status_path(outgoing_message), :target => '_blank' %>
+ <%= render_notes(outgoing_message.notes, class: 'message-notes') %>
+
<%= outgoing_message.get_body_for_html_display %>
From 347db686056ccd304454099aeaa14a3b30217b30 Mon Sep 17 00:00:00 2001
From: HelenWDTK <120410992+HelenWDTK@users.noreply.github.com>
Date: Fri, 16 Feb 2024 09:57:05 +0000
Subject: [PATCH 7/7] Update routes.rb
fixing route to redirect to edit page for incoming/outgoing messages
---
config/routes.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/config/routes.rb b/config/routes.rb
index 86db651a05..98e78d6c03 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -553,6 +553,10 @@ def matches?(request)
direct :admin_note_parent do |note|
if note.notable_tag
admin_tag_path(tag: note.notable_tag)
+ elsif note.notable.is_a?(OutgoingMessage)
+ edit_admin_outgoing_message_path(note.notable)
+ elsif note.notable.is_a?(IncomingMessage)
+ edit_admin_incoming_message_path(note.notable)
elsif note.notable
url_for([:admin, note.notable])
else