Link conversation topic if present on show view (#5102)

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
Daniel O'Connorandgoogle-labs-jules[bot] authored and GitHub committed 2026-10-26 22:25:11 +10:30
1 parent 75595350bc
commit fc4a152bf1
2 files changed
+19 -6

No files matched your search

+2 -2
View File
@@ -24,10 +24,10 @@
on #{message.created_at}
.col-md-4.text-end.float-end
= render 'members/tiny', member: message.sender
- if message.notified_object.is_a?(Seed)
- if message.notified_object.present?
.col-12
About
= link_to "#{message.notified_object.crop_name} seeds", seed_path(message.notified_object)
= link_to message.notified_object.to_s, polymorphic_path(message.notified_object)
.col-12
%p.text-justify
:markdown
+17 -4
View File
@@ -62,10 +62,10 @@ describe 'Messages' do
end
end
describe 'the conversation about a seed' do
describe 'the conversation about a topic' do
let(:conversation) do
receipt = member.send_message(recipient, 'Could I have some?', subject_line)
receipt.notification.update(notified_object: seed)
receipt.notification.update(notified_object: topic)
receipt.conversation
end
@@ -74,7 +74,20 @@ describe 'Messages' do
get conversation_path(conversation)
end
it { expect(response.body).to include("About") }
it { expect(response.body).to include(seed_path(seed)) }
context 'when topic is a seed' do
let(:topic) { seed }
it { expect(response.body).to include("About") }
it { expect(response.body).to include(seed_path(seed)) }
it { expect(response.body).to include(seed.to_s) }
end
context 'when topic is another notified object' do
let(:topic) { create(:planting) }
it { expect(response.body).to include("About") }
it { expect(response.body).to include(planting_path(topic)) }
it { expect(response.body).to include(topic.to_s) }
end
end
end