From 8e233ca4c9b0e71a3096ee71f852b013345ebc36 Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Mon, 9 Sep 2024 17:50:13 -0700 Subject: [PATCH 1/7] initial check in routes, views mailers stil TBD --- app/controllers/events_controller.rb | 23 ++++++++++++++ app/views/events/_email_form.html.haml | 14 +++++++++ app/views/events/active_guest_list.html.haml | 33 ++++++++++++++++++++ app/views/events/guest_list.html.haml | 3 +- app/views/shared/_nav_event_tabs.html.haml | 6 ++-- config/routes.rb | 2 ++ 6 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 app/views/events/_email_form.html.haml create mode 100644 app/views/events/active_guest_list.html.haml diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 7f1bb7cf..10cbcaad 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -111,12 +111,35 @@ def guest_list @ticket_requests = @event.admissible_requests end + # all active guests (completed, awaiting payment) + def active_guest_list + @ticket_requests = @event.ticket_requests.active + end + def download_guest_list send_file(FnF::Services::GuestListCSV.new(@event).csv, filename: "#{@event.name} Guest List.csv".gsub(/\s+/, '-'), type: 'text/csv') end + def email_all_active + Rails.logger.debug { "email_all_active: params: #{params.inspect}" } + Rails.logger.debug { "email_all_active: subject: #{params[:subject]}" } + Rails.logger.debug { "email_all_active: message: #{params[:message]}" } + + counter = 0 + # @event.ticket_requests.active.find_each do |ticket_request| + # Rails.logger.debug { "email_all_active: sending reminder for ticket request: #{ticket_request.inspect}" } + # # TicketRequestMailer.payment_reminder(ticket_request).deliver_later + # counter += 1 + # end + + Rails.logger.debug { "email_all_active: counter: #{counter}" } + + redirect_to event_ticket_requests_path(@event), + notice: "Emails sent to #{counter} ticket holders!" + end + def active_addons_passes active_addons end diff --git a/app/views/events/_email_form.html.haml b/app/views/events/_email_form.html.haml new file mode 100644 index 00000000..b643e0c0 --- /dev/null +++ b/app/views/events/_email_form.html.haml @@ -0,0 +1,14 @@ += form_with url: email_all_active_event_path(event_id: @event.id), method: :post, data: { event: @event, turbo: true, controller: 'flatpickr', target: '_blank' } do |f| + .container-fluid + .card-header.bg-primary-subtle + %legend Email All Ticket Holders + %hr + + %h6 Subject + = f.text_field :subject, maxlength: 80, class: 'form-control', required: true + %hr + %h6 Email Message + = f.text_area :message, rows: 30, cols: 80, class: 'form-control', required: true + + = f.submit "▶︎ Send Emails", class: 'btn btn-primary btn-large', + id: 'submit-email', data: { disable_with: 'Submitting...' } \ No newline at end of file diff --git a/app/views/events/active_guest_list.html.haml b/app/views/events/active_guest_list.html.haml new file mode 100644 index 00000000..abe3c91a --- /dev/null +++ b/app/views/events/active_guest_list.html.haml @@ -0,0 +1,33 @@ += render partial: 'shared/nav_event', locals: { event: @event, active_tab: { active_guest_list: 'active' } } + +.card + .card-body + = render '/events/email_form', resource: @event + + %table.table.table-condensed + %thead + %tr + %th Ticket Requester + %th Their Guests + %tbody + - @ticket_requests.each do |ticket_request| + %tr + %td + - user = "#{ticket_request.user.name} <#{ticket_request.user.email}>" + - email = ticket_request.user.email + = link_to event_ticket_request_path(@event, ticket_request) do + %span= user + %td + - if ticket_request.guests.empty? + %span= "as themselves" + %br + - else + - ticket_request.guests.each do |guest| + - next unless guest.present? + - guest_email = guest.split(/[<>]/).last + - if guest == user || (guest_email.present? && guest_email == email) + %span= "as themselves" + %br + - else + %span= guest + %br diff --git a/app/views/events/guest_list.html.haml b/app/views/events/guest_list.html.haml index 9cce819b..4b9cd710 100644 --- a/app/views/events/guest_list.html.haml +++ b/app/views/events/guest_list.html.haml @@ -20,7 +20,8 @@ %td - user = "#{ticket_request.user.name} <#{ticket_request.user.email}>" - email = ticket_request.user.email - %span= user + = link_to event_ticket_request_path(@event, ticket_request) do + %span= user %td - if ticket_request.guests.empty? %span= "as themselves" diff --git a/app/views/shared/_nav_event_tabs.html.haml b/app/views/shared/_nav_event_tabs.html.haml index d197ee37..870fbb46 100644 --- a/app/views/shared/_nav_event_tabs.html.haml +++ b/app/views/shared/_nav_event_tabs.html.haml @@ -10,7 +10,7 @@ = event.name .col-sm-12.col-md-12.col-lg-5.col-xl-3.text-end %h5.d-inline.block.align-baseline.text-nowrap - = event.starting.to_date.strftime('%A, %B %d, %Y') + = event.starting.to_date.strftime('%A, %B %d, %Y') .card-body.p-0.pt-3.pb-0.border-bottom-0.border-2 %ul.nav.nav-tabs.p-4.pb-0.mb-3.event-tabs @@ -41,8 +41,10 @@ = link_to active_addons_camping_event_path(event), class: "nav-link #{active_tab[:camping_permits]}" do Camping Permits - %li.nav-item = link_to guest_list_event_path(event), class: "nav-link #{active_tab[:guest_list]}" do Guest List + %li.nav-item + = link_to active_guest_list_event_path(event), class: "nav-link #{active_tab[:active_guest_list]}" do + Email Guests diff --git a/config/routes.rb b/config/routes.rb index c36775db..84c43dbc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,6 +20,8 @@ post :add_admin post :remove_admin get :guest_list + get :active_guest_list + post :email_all_active get :download_guest_list get :active_addons_passes get :active_addons_camping From 50c0a7ed95fa59bddae5e8fb13bea2ff93d26bd1 Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Tue, 10 Sep 2024 16:01:50 -0700 Subject: [PATCH 2/7] email ticket holders Added controller, model, view added mailer support mailer previews --- app/controllers/events_controller.rb | 19 +------ app/controllers/ticket_requests_controller.rb | 55 +++++++++++++------ app/mailers/application_mailer.rb | 4 +- app/mailers/ticket_request_mailer.rb | 31 +++++++++++ app/views/events/_email_form.html.haml | 13 +++-- app/views/events/active_guest_list.html.haml | 33 ----------- .../events/active_ticket_requests.html.haml | 17 ++++++ .../payment_mailer/payment_received.html.haml | 22 +++++++- app/views/payments/other.html.haml | 2 +- app/views/payments/show.html.haml | 2 +- app/views/shared/_nav_event_tabs.html.haml | 4 +- .../email_ticket_holder.html.haml | 27 +++++++++ app/views/ticket_requests/_form.html.haml | 7 ++- config/application.rb | 2 + config/routes.rb | 4 +- .../ticket_request_mailer_preview.rb | 22 ++++++++ 16 files changed, 180 insertions(+), 84 deletions(-) delete mode 100644 app/views/events/active_guest_list.html.haml create mode 100644 app/views/events/active_ticket_requests.html.haml create mode 100644 app/views/ticket_request_mailer/email_ticket_holder.html.haml create mode 100644 lib/mailer_previews/ticket_request_mailer_preview.rb diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 10cbcaad..43384a92 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -112,7 +112,7 @@ def guest_list end # all active guests (completed, awaiting payment) - def active_guest_list + def active_ticket_requests @ticket_requests = @event.ticket_requests.active end @@ -122,23 +122,6 @@ def download_guest_list type: 'text/csv') end - def email_all_active - Rails.logger.debug { "email_all_active: params: #{params.inspect}" } - Rails.logger.debug { "email_all_active: subject: #{params[:subject]}" } - Rails.logger.debug { "email_all_active: message: #{params[:message]}" } - - counter = 0 - # @event.ticket_requests.active.find_each do |ticket_request| - # Rails.logger.debug { "email_all_active: sending reminder for ticket request: #{ticket_request.inspect}" } - # # TicketRequestMailer.payment_reminder(ticket_request).deliver_later - # counter += 1 - # end - - Rails.logger.debug { "email_all_active: counter: #{counter}" } - - redirect_to event_ticket_requests_path(@event), - notice: "Emails sent to #{counter} ticket holders!" - end def active_addons_passes active_addons diff --git a/app/controllers/ticket_requests_controller.rb b/app/controllers/ticket_requests_controller.rb index 28621f6c..0387613f 100644 --- a/app/controllers/ticket_requests_controller.rb +++ b/app/controllers/ticket_requests_controller.rb @@ -7,7 +7,7 @@ class TicketRequestsController < ApplicationController before_action :authenticate_user!, except: %i[create new] before_action :set_event - before_action :set_ticket_request, except: %i[create index download payment_reminder] + before_action :set_ticket_request, except: %i[create index download payment_reminder email_ticket_holders] before_action :require_event_admin, except: %i[create new show edit update destroy] def index @@ -60,22 +60,6 @@ def download render_flash(flash) end - def payment_reminder - counter = 0 - @event.ticket_requests.where(status: TicketRequest::STATUS_AWAITING_PAYMENT).find_each do |ticket_request| - if ticket_request.price.positive? - Rails.logger.debug { "payment_reminder: sending reminder for ticket request: #{ticket_request.inspect}" } - TicketRequestMailer.payment_reminder(ticket_request).deliver_later - counter += 1 - end - end - - Rails.logger.debug { "payment_reminder: counter: #{counter}" } - - redirect_to event_ticket_requests_path(@event), - notice: "Reminder emails sent to #{counter} ticket requesters!" - end - def show return redirect_to root_path unless @ticket_request.can_view?(current_user) @@ -264,6 +248,43 @@ def refund end end + def payment_reminder + counter = 0 + @event.ticket_requests.awaiting_payment.find_each do |ticket_request| + if ticket_request.price.positive? + Rails.logger.debug { "payment_reminder: sending reminder for ticket request: #{ticket_request.inspect}" } + TicketRequestMailer.payment_reminder(ticket_request).deliver_later + counter += 1 + end + end + + Rails.logger.debug { "payment_reminder: counter: #{counter}" } + + redirect_to event_ticket_requests_path(@event), + notice: "Reminder emails sent to #{counter} ticket requesters!" + end + + def email_ticket_holders + Rails.logger.debug { "email_ticket_holders: params: #{params.inspect}" } + + subject = params[:subject].strip + body = params[:body].strip + counter = 0 + limit = 1 + + @event.ticket_requests.active.find_each do |ticket_request| + Rails.logger.debug { "email_ticket_holders: sending reminder for ticket request: #{ticket_request.inspect}" } + TicketRequestMailer.email_ticket_holder(ticket_request, subject, body).deliver_later + counter += 1 + break if counter >= limit + end + + Rails.logger.debug { "email_ticket_holders: counter: #{counter}" } + + redirect_to event_ticket_requests_path(@event), + notice: "Emails sent to #{counter} ticket holders!" + end + private def ticket_request_id diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 2341e009..321d6ff3 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true class ApplicationMailer < ActionMailer::Base - DEFAULT_SENDER_EMAIL = 'tickets@fnf.org' - DEFAULT_REPLY_TO_EMAIL = 'tickets@fnf.org' + DEFAULT_SENDER_EMAIL = 'ticket-support@fnf.org' + DEFAULT_REPLY_TO_EMAIL = 'ticket-support@fnf.org' layout 'email' diff --git a/app/mailers/ticket_request_mailer.rb b/app/mailers/ticket_request_mailer.rb index a6520e05..ee78474b 100644 --- a/app/mailers/ticket_request_mailer.rb +++ b/app/mailers/ticket_request_mailer.rb @@ -126,6 +126,37 @@ def payment_reminder(ticket_request) subject: "#{@event.name} buy your tickets now!" # The subject of the email end + # The `email_ticket_holder` method is used to send an email to ticket holders + # + # @param ticket_request [TicketRequest] The ticket request that has been confirmed + # @param subject [String] email subject line + # @param body [String] email message body + # @return [Mail::Message] The email that has been prepared to be sent. + def email_ticket_holder(ticket_request, subject, body) + self.ticket_request = ticket_request + @body = body.to_s.html_safe + + if @ticket_request.awaiting_payment? + # Return if the authentication token is blank + if (@auth_token = @ticket_request.generate_user_auth_token!).blank? + Rails.logger.warn { "email_ticket_holder: no auth token for user: #{@ticket_request.inspect}" } + return + end + + @payment_url = new_event_ticket_request_payment_url(event_id: @event.id, ticket_request_id: @ticket_request.id, user_token: @auth_token) + end + + Rails.logger.debug { "email_ticket_holder: ticket_request: #{ticket_request.inspect} user: #{ticket_request.user.id}" } + @ticket_request_url = event_ticket_request_url(event_id: @event.id, id: @ticket_request.id) + + mail to: to_email, # The recipient of the email + from: from_email, # The sender of the email + reply_to: reply_to_email, # The email address that will receive replies + content_type: "text/html", + subject: subject # The subject of the email + + end + private def ticket_request=(ticket_request) diff --git a/app/views/events/_email_form.html.haml b/app/views/events/_email_form.html.haml index b643e0c0..b52d02df 100644 --- a/app/views/events/_email_form.html.haml +++ b/app/views/events/_email_form.html.haml @@ -1,14 +1,19 @@ -= form_with url: email_all_active_event_path(event_id: @event.id), method: :post, data: { event: @event, turbo: true, controller: 'flatpickr', target: '_blank' } do |f| += form_with url: email_ticket_holders_event_ticket_requests_path(event_id: @event.id), method: :get, data: { event: @event, turbo: true, controller: 'flatpickr', target: '_blank' } do |f| .container-fluid .card-header.bg-primary-subtle %legend Email All Ticket Holders + Tickets Holders Confirmed and Awaiting Payment: + %b #{count} %hr %h6 Subject - = f.text_field :subject, maxlength: 80, class: 'form-control', required: true + = f.text_field :subject, value: "#{@event.name}: ", maxlength: 80, class: 'form-control', required: true %hr %h6 Email Message - = f.text_area :message, rows: 30, cols: 80, class: 'form-control', required: true + %p + %i Format: Plain text and simple HTML are allowed. + = f.text_area :body, rows: 5, cols: 80, class: 'form-control', required: true = f.submit "▶︎ Send Emails", class: 'btn btn-primary btn-large', - id: 'submit-email', data: { disable_with: 'Submitting...' } \ No newline at end of file + id: 'submit-email', data: { disable_with: 'Submitting...' } + %br \ No newline at end of file diff --git a/app/views/events/active_guest_list.html.haml b/app/views/events/active_guest_list.html.haml deleted file mode 100644 index abe3c91a..00000000 --- a/app/views/events/active_guest_list.html.haml +++ /dev/null @@ -1,33 +0,0 @@ -= render partial: 'shared/nav_event', locals: { event: @event, active_tab: { active_guest_list: 'active' } } - -.card - .card-body - = render '/events/email_form', resource: @event - - %table.table.table-condensed - %thead - %tr - %th Ticket Requester - %th Their Guests - %tbody - - @ticket_requests.each do |ticket_request| - %tr - %td - - user = "#{ticket_request.user.name} <#{ticket_request.user.email}>" - - email = ticket_request.user.email - = link_to event_ticket_request_path(@event, ticket_request) do - %span= user - %td - - if ticket_request.guests.empty? - %span= "as themselves" - %br - - else - - ticket_request.guests.each do |guest| - - next unless guest.present? - - guest_email = guest.split(/[<>]/).last - - if guest == user || (guest_email.present? && guest_email == email) - %span= "as themselves" - %br - - else - %span= guest - %br diff --git a/app/views/events/active_ticket_requests.html.haml b/app/views/events/active_ticket_requests.html.haml new file mode 100644 index 00000000..79234562 --- /dev/null +++ b/app/views/events/active_ticket_requests.html.haml @@ -0,0 +1,17 @@ += render partial: 'shared/nav_event', locals: { event: @event, active_tab: { email_ticket_holders: 'active' } } + +.card + .card-body + - @tr_count = @ticket_requests.count + = render '/events/email_form', resource: @event, count: @tr_count + %table.table.table-condensed + %thead + %tr + %th Ticket Requesters (#{@tr_count}) + %tbody + - @ticket_requests.each do |ticket_request| + %tr + %td + - user = "#{ticket_request.user.name} <#{ticket_request.user.email}>" + = link_to event_ticket_request_path(@event, ticket_request) do + %span= user diff --git a/app/views/payment_mailer/payment_received.html.haml b/app/views/payment_mailer/payment_received.html.haml index c161aeb5..e446873a 100644 --- a/app/views/payment_mailer/payment_received.html.haml +++ b/app/views/payment_mailer/payment_received.html.haml @@ -4,7 +4,25 @@ Got ticket questions or think something is wrong with your order? We are still here for you, drop us a line at = succeed '.' do - = mail_to 'tickets@fnf.org' + = mail_to 'ticket-support@fnf.org' + +%p + + We care deeply about the health, safety, and comfort of attendees at our events and members + of our community. To help achieve this, we ask all of our members and guests to read, + understand, and share with each guest our + %b=link_to 'Code of Conduct', 'https://fnf.page.link/coc', target: '_blank', onclick: "popupWindow('https://fnf.page.link/coc', 'Code of Conduct', window, 800, 900); return false;" + +%p + We are a community driven by volunteerism in the service of the community. As such, we depend upon the energy + and vision of members and guests to make our events happen! + %br + Please (re)acquaint yourself with + %b=link_to 'The FnF Way', 'https://fnf.events/the-fnf-way/', target: '_blank', onclick: "popupWindow('https://fnf.events/the-fnf-way/', 'The FnF Way', window, 700, 900); return false;" + and get involved with helping make the event happen! + %br + %b=link_to 'Volunteer Signups', 'https://signup.app.fnf.org/' + %p %p Friends and Family reminds you to @@ -43,3 +61,5 @@ So soon! %br Your #{@event.name} Ticketing Team + = succeed '.' do + = mail_to 'ticket-support@fnf.org' diff --git a/app/views/payments/other.html.haml b/app/views/payments/other.html.haml index 895276b5..5b5aae35 100644 --- a/app/views/payments/other.html.haml +++ b/app/views/payments/other.html.haml @@ -33,4 +33,4 @@ %p When in doubt, contact us at - = mail_to 'tickets@fnf.org' + = mail_to 'ticket-support@fnf.org' diff --git a/app/views/payments/show.html.haml b/app/views/payments/show.html.haml index 7c5e249d..5e206775 100644 --- a/app/views/payments/show.html.haml +++ b/app/views/payments/show.html.haml @@ -10,4 +10,4 @@ %p If you have any other questions, don't hesitate to contact us at - = mail_to 'tickets@fnf.org' + = mail_to 'ticket-support@fnf.org' diff --git a/app/views/shared/_nav_event_tabs.html.haml b/app/views/shared/_nav_event_tabs.html.haml index 870fbb46..91722798 100644 --- a/app/views/shared/_nav_event_tabs.html.haml +++ b/app/views/shared/_nav_event_tabs.html.haml @@ -46,5 +46,5 @@ Guest List %li.nav-item - = link_to active_guest_list_event_path(event), class: "nav-link #{active_tab[:active_guest_list]}" do - Email Guests + = link_to active_ticket_requests_event_path(event), class: "nav-link #{active_tab[:email_ticket_holders]}" do + Email Ticket Holders diff --git a/app/views/ticket_request_mailer/email_ticket_holder.html.haml b/app/views/ticket_request_mailer/email_ticket_holder.html.haml new file mode 100644 index 00000000..f51a2789 --- /dev/null +++ b/app/views/ticket_request_mailer/email_ticket_holder.html.haml @@ -0,0 +1,27 @@ +%p + Hi #{@ticket_request.user.first_name}, + +%p + - if @payment_url.present? + Your tickets still need to be purchased. + = link_to @payment_url do + Buy your tickets now! +%p += @body + +%p + With love ❤️, + %br + Your FnF Ticket Team + +%p + - if @payment_url.present? + = link_to @payment_url do + Buy your tickets now! +%p + You can view the status of your request at any time by visiting + = link_to "#{@ticket_request_url}", @ticket_request_url + +%p +%p + %i This email was generated by a very friendly #{Faker::Creature::Animal.name} at: #{Time.now} \ No newline at end of file diff --git a/app/views/ticket_requests/_form.html.haml b/app/views/ticket_requests/_form.html.haml index 679cdf5b..9b1a7ad2 100644 --- a/app/views/ticket_requests/_form.html.haml +++ b/app/views/ticket_requests/_form.html.haml @@ -194,9 +194,10 @@ %br - unless is_update %p - Every year, every attendee, no matter how long they've been coming, must - acquaint themselves with our values and Code of Conduct. Please acknowledge - you've done so this year. + We care deeply about the health, safety, and comfort of attendees at our events and members + of our community. To help achieve this, we ask all everyone and their guests to read, + understand, and acknowledge that you have read both documents and + that you agree to follow and support these values. = f.label :agrees_to_terms, class: 'checkbox' do = f.check_box :agrees_to_terms I’ve read diff --git a/config/application.rb b/config/application.rb index 82f5a436..f75023e2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -88,5 +88,7 @@ class Application < Rails::Application idletime: 30.seconds config.cache_store = :mem_cache_store, '127.0.0.1:11211', { pool: { size: 10 } } + + config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" end end diff --git a/config/routes.rb b/config/routes.rb index 84c43dbc..ee0bdc05 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,8 +20,7 @@ post :add_admin post :remove_admin get :guest_list - get :active_guest_list - post :email_all_active + get :active_ticket_requests get :download_guest_list get :active_addons_passes get :active_addons_camping @@ -37,6 +36,7 @@ collection do get :download get :payment_reminder + get :email_ticket_holders end member do diff --git a/lib/mailer_previews/ticket_request_mailer_preview.rb b/lib/mailer_previews/ticket_request_mailer_preview.rb new file mode 100644 index 00000000..fba23a74 --- /dev/null +++ b/lib/mailer_previews/ticket_request_mailer_preview.rb @@ -0,0 +1,22 @@ +class TicketRequestMailerPreview < ActionMailer::Preview + def email_ticket_holder + ticket_request = TicketRequest.last + subject = 'Test Subject' + body = "This is my message test +

+We care deeply about the health, safety, and comfort of attendees at our events +and member of our community.
+To help achieve this, we ask all of our members and guests to read, +and abide by our Code Of Conduct +

+We ask that you share this with each of your guests whom you may bring to the event. +

+We are a community driven by volunteerism in the service of the community. +

+As such, we depend upon the energy and vision of members and guests to make our events happen!
+Please (re)acquaint yourself with The FnF Way, https://cfaea.net/the-fnf-way/,
+and get involved with helping make the event happen! +" + TicketRequestMailer.with(ticket_request: ticket_request).email_ticket_holder(ticket_request, subject, body) + end +end \ No newline at end of file From 1b400bfd58924f9699039a7cb9d7d0a0aa98a17b Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Tue, 10 Sep 2024 16:03:10 -0700 Subject: [PATCH 3/7] rubocop --- app/controllers/events_controller.rb | 1 - app/mailers/ticket_request_mailer.rb | 5 ++--- config/application.rb | 2 +- lib/mailer_previews/ticket_request_mailer_preview.rb | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 43384a92..0f1f9e7b 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -122,7 +122,6 @@ def download_guest_list type: 'text/csv') end - def active_addons_passes active_addons end diff --git a/app/mailers/ticket_request_mailer.rb b/app/mailers/ticket_request_mailer.rb index ee78474b..431724a9 100644 --- a/app/mailers/ticket_request_mailer.rb +++ b/app/mailers/ticket_request_mailer.rb @@ -152,9 +152,8 @@ def email_ticket_holder(ticket_request, subject, body) mail to: to_email, # The recipient of the email from: from_email, # The sender of the email reply_to: reply_to_email, # The email address that will receive replies - content_type: "text/html", - subject: subject # The subject of the email - + content_type: 'text/html', + subject: # The subject of the email end private diff --git a/config/application.rb b/config/application.rb index f75023e2..a6874654 100644 --- a/config/application.rb +++ b/config/application.rb @@ -89,6 +89,6 @@ class Application < Rails::Application config.cache_store = :mem_cache_store, '127.0.0.1:11211', { pool: { size: 10 } } - config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" + config.action_mailer.preview_paths << "#{Rails.root.join('lib/mailer_previews')}" end end diff --git a/lib/mailer_previews/ticket_request_mailer_preview.rb b/lib/mailer_previews/ticket_request_mailer_preview.rb index fba23a74..5b96c425 100644 --- a/lib/mailer_previews/ticket_request_mailer_preview.rb +++ b/lib/mailer_previews/ticket_request_mailer_preview.rb @@ -17,6 +17,6 @@ def email_ticket_holder Please (re)acquaint yourself with The FnF Way, https://cfaea.net/the-fnf-way/,
and get involved with helping make the event happen! " - TicketRequestMailer.with(ticket_request: ticket_request).email_ticket_holder(ticket_request, subject, body) + TicketRequestMailer.with(ticket_request:).email_ticket_holder(ticket_request, subject, body) end -end \ No newline at end of file +end From 4bd45266930b4e9b326ed2d203dace9b644c8cf4 Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Tue, 10 Sep 2024 16:03:42 -0700 Subject: [PATCH 4/7] rubocop II --- config/application.rb | 2 +- lib/mailer_previews/ticket_request_mailer_preview.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index a6874654..5eb4faff 100644 --- a/config/application.rb +++ b/config/application.rb @@ -89,6 +89,6 @@ class Application < Rails::Application config.cache_store = :mem_cache_store, '127.0.0.1:11211', { pool: { size: 10 } } - config.action_mailer.preview_paths << "#{Rails.root.join('lib/mailer_previews')}" + config.action_mailer.preview_paths << Rails.root.join('lib/mailer_previews').to_s end end diff --git a/lib/mailer_previews/ticket_request_mailer_preview.rb b/lib/mailer_previews/ticket_request_mailer_preview.rb index 5b96c425..7f9b0d24 100644 --- a/lib/mailer_previews/ticket_request_mailer_preview.rb +++ b/lib/mailer_previews/ticket_request_mailer_preview.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class TicketRequestMailerPreview < ActionMailer::Preview def email_ticket_holder ticket_request = TicketRequest.last From 0c8d368f288582d9dab61ae17cfc6770ede48b5e Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Wed, 11 Sep 2024 08:45:42 -0700 Subject: [PATCH 5/7] rubocop exclude html_safe mailer --- .rubocop_todo.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a6542f29..349be953 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -153,6 +153,10 @@ Rails/NotNullColumn: - 'db/migrate/20130226221916_add_user_to_ticket_request.rb' - 'db/migrate/20130311213508_add_event_id_to_ticket_request.rb' +Rails/OutputSafety: + Exclude: + - 'app/mailers/ticket_request_mailer.rb' + # Offense count: 22 # Configuration parameters: Include. # Include: db/**/*.rb From dbcc576083ba3d2442ade98e22fbe6325d212a95 Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Wed, 11 Sep 2024 15:11:47 -0700 Subject: [PATCH 6/7] remove limiter --- app/controllers/ticket_requests_controller.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/ticket_requests_controller.rb b/app/controllers/ticket_requests_controller.rb index 0387613f..06072bcc 100644 --- a/app/controllers/ticket_requests_controller.rb +++ b/app/controllers/ticket_requests_controller.rb @@ -270,13 +270,11 @@ def email_ticket_holders subject = params[:subject].strip body = params[:body].strip counter = 0 - limit = 1 @event.ticket_requests.active.find_each do |ticket_request| Rails.logger.debug { "email_ticket_holders: sending reminder for ticket request: #{ticket_request.inspect}" } TicketRequestMailer.email_ticket_holder(ticket_request, subject, body).deliver_later counter += 1 - break if counter >= limit end Rails.logger.debug { "email_ticket_holders: counter: #{counter}" } From 5c60a29a91308063cfc93a349233e4949381c9ba Mon Sep 17 00:00:00 2001 From: Matt Levy Date: Thu, 12 Sep 2024 21:06:31 -0700 Subject: [PATCH 7/7] bump version --- .version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.version b/.version index 9181bf79..4fc01ac9 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.3.18 +1.3.19