From 62861c7196e918cd09a945fae1f0cfae70c637af Mon Sep 17 00:00:00 2001 From: Joseph Dudley Date: Thu, 2 Apr 2020 18:26:42 +0100 Subject: [PATCH 1/3] Replaced placeholder text Fixes #249 --- app/controllers/support_requests_controller.rb | 2 +- app/mailers/notifications_mailer.rb | 3 ++- app/views/notifications_mailer/support_requested.html.erb | 2 +- test/mailers/notifications_mailer_test.rb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/support_requests_controller.rb b/app/controllers/support_requests_controller.rb index cc49ded..4230313 100644 --- a/app/controllers/support_requests_controller.rb +++ b/app/controllers/support_requests_controller.rb @@ -22,7 +22,7 @@ def create @request = authorize @offer.support_requests.create(support_request_params) if @request.save - NotificationsMailer.support_requested(@request).deliver_now + NotificationsMailer.support_requested(@request, @project).deliver_now redirect_to project_url(@project) flash[:notice] = 'Support request sent! You should hear back soon.' else diff --git a/app/mailers/notifications_mailer.rb b/app/mailers/notifications_mailer.rb index 9eff211..4be7138 100644 --- a/app/mailers/notifications_mailer.rb +++ b/app/mailers/notifications_mailer.rb @@ -58,8 +58,9 @@ def debrief_overdue(iteration) mail to: emails, subject: 'Debrief overdue!' end - def support_requested(support_request) + def support_requested(support_request, project) @request = support_request + @project = project @beneficiary = @request.on_behalf_of || @request.requester @offer = support_request.offer @mentor = emails_by_role(@request, %w[mentor]) diff --git a/app/views/notifications_mailer/support_requested.html.erb b/app/views/notifications_mailer/support_requested.html.erb index 359a6d3..3115000 100644 --- a/app/views/notifications_mailer/support_requested.html.erb +++ b/app/views/notifications_mailer/support_requested.html.erb @@ -1,6 +1,6 @@

New support request

-

<%= @request.requester.full_name %> (cc'd) from CharityName has just expressed interest in a <%= @request.offer.title %> with you (<%= @request.offer.provider.name %>).

+

<%= @request.requester.full_name %> (cc'd) from <%= @project.title %> has just expressed interest in a <%= @request.offer.title %> with you (<%= @request.offer.provider.name %>).

Reply to this email to let them know if this is something you can help them with.

diff --git a/test/mailers/notifications_mailer_test.rb b/test/mailers/notifications_mailer_test.rb index 4366c2c..c53dcf0 100644 --- a/test/mailers/notifications_mailer_test.rb +++ b/test/mailers/notifications_mailer_test.rb @@ -47,7 +47,7 @@ class NotificationsMailerTest < ActionMailer::TestCase @offer = build(:offer) @request = build(:support_request, requester: @user, message: 'Test', offer: @offer, project: @project) - mail = NotificationsMailer.support_requested(@request) + mail = NotificationsMailer.support_requested(@request, @project) assert_equal('New support request', mail.subject) assert_equal([@offer.provider_email], mail.to) assert_equal([@user.email], mail.cc) From 75adb83a633bdafcd6601c9a869a113357feaef6 Mon Sep 17 00:00:00 2001 From: Joseph Dudley Date: Thu, 2 Apr 2020 18:28:25 +0100 Subject: [PATCH 2/3] Added support metadata to topic page Also tweaked language --- app/views/offers/show.html.erb | 2 +- app/views/topics/show.html.erb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/offers/show.html.erb b/app/views/offers/show.html.erb index 4d280cb..5feb441 100644 --- a/app/views/offers/show.html.erb +++ b/app/views/offers/show.html.erb @@ -17,7 +17,7 @@
-

Run by: <%= link_to @offer.provider.name, @offer.provider.website, class: 'link', target: '_blank' %>

+

Provided by: <%= link_to @offer.provider.name, @offer.provider.website, class: 'link', target: '_blank' %>

Duration: <%= @offer.duration_description %>

diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 4c1a808..18f238c 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -15,7 +15,11 @@ <% offers.each do |offer| %>

<%= offer.title %>

- +
+

Provided by: <%= link_to offer.provider.name, offer.provider.website, class: 'link', target: '_blank' %>

+

Duration: <%= offer.duration_description %>

+
+
<%= offer.short_description&.html_safe %>
From e890b1775ef9c6420e1cb7074228b34cdf33c6de Mon Sep 17 00:00:00 2001 From: Joseph Dudley Date: Thu, 2 Apr 2020 18:30:43 +0100 Subject: [PATCH 3/3] Added check for mentor Addresses #248 --- app/views/topics/index.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/topics/index.html.erb b/app/views/topics/index.html.erb index bc18243..9448600 100644 --- a/app/views/topics/index.html.erb +++ b/app/views/topics/index.html.erb @@ -31,9 +31,11 @@
<% end %> + <% unless @project.members('mentor').empty? %>

If the support you're looking for isn't listed here, get in touch with your coach <%= @project.members('mentor')[0].full_name %>.

+ <% end %> \ No newline at end of file