Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
981ce24
Add tentative_acceptance_code
Ethan-Stone1 Apr 13, 2026
f1260f4
Small changes
Ethan-Stone1 Apr 13, 2026
d2d7db6
Modify Email after clicking tentative_accept
Ethan-Stone1 Apr 13, 2026
35c6042
Get request patched
Ethan-Stone1 Apr 13, 2026
c38016d
Reroute back to events page
Ethan-Stone1 Apr 13, 2026
7a3dbf3
Make tentative accept page read only, use preset and 'committee feedb…
Ethan-Stone1 Apr 13, 2026
4815b6d
Can reject a tentatively accepted event
Ethan-Stone1 Apr 14, 2026
9cae742
Change unable to send email message
Ethan-Stone1 Apr 14, 2026
a580661
Renaming buttons, changing some text
Ethan-Stone1 Apr 14, 2026
3b9d51f
Email no longer shows up if unable to send it
Ethan-Stone1 Apr 14, 2026
e3b58e1
Indentation fixes
Ethan-Stone1 Apr 14, 2026
2e8d3e7
Bug fix
Ethan-Stone1 Apr 14, 2026
4782ebe
update ruby version
Ethan-Stone1 Apr 14, 2026
a2eb1ad
Add tests
Ethan-Stone1 Apr 20, 2026
b96238a
Small refactor, add new route and remove if patch
Ethan-Stone1 Apr 22, 2026
89100a3
Render properly
Ethan-Stone1 Apr 22, 2026
7ac0219
Remove @conference
Ethan-Stone1 Apr 22, 2026
8957dc5
Update tests because new routes
Ethan-Stone1 Apr 24, 2026
97d6b5b
Asynchronous tests again
Ethan-Stone1 Apr 24, 2026
9ceb825
Rubocop
Ethan-Stone1 Apr 24, 2026
fe10ea5
Update ruby to 3.3.10
Ethan-Stone1 Apr 24, 2026
e092041
Merge branch 'main' into tentative_accept
Ethan-Stone1 Apr 24, 2026
8a4bc56
fix rubocop offenses
sikesbc Apr 24, 2026
67fac4d
update conference specs for tentatively_accepted state
sikesbc Apr 24, 2026
cc42290
fix hash alignment in conference spec
sikesbc Apr 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ GEM
turbolinks-source (5.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2025.3)
tzinfo-data (1.2026.1)
tzinfo (>= 1.0.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
Expand Down Expand Up @@ -832,7 +832,7 @@ DEPENDENCIES
whenever

RUBY VERSION
ruby 3.3.8p144
ruby 3.3.10p183

BUNDLED WITH
2.5.6
32 changes: 16 additions & 16 deletions app/controllers/admin/conferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ def new
source = Conference.find_by(short_title: params[:duplicate_from])
if source && can?(:read, source)
@conference = Conference.new(
description: source.description,
timezone: source.timezone,
start_hour: source.start_hour,
end_hour: source.end_hour,
color: source.color,
custom_css: source.custom_css,
ticket_layout: source.ticket_layout,
description: source.description,
timezone: source.timezone,
start_hour: source.start_hour,
end_hour: source.end_hour,
color: source.color,
custom_css: source.custom_css,
ticket_layout: source.ticket_layout,
registration_limit: source.registration_limit,
booth_limit: source.booth_limit,
organization_id: source.organization_id
booth_limit: source.booth_limit,
organization_id: source.organization_id
)
@duplicate_from_source = source.short_title
else
Expand All @@ -98,14 +98,14 @@ def create
source = Conference.find_by(short_title: params[:duplicate_from])
if source && can?(:read, source)
@conference.assign_attributes(
description: source.description,
custom_css: source.custom_css,
ticket_layout: source.ticket_layout,
description: source.description,
custom_css: source.custom_css,
ticket_layout: source.ticket_layout,
registration_limit: source.registration_limit,
booth_limit: source.booth_limit,
color: source.color,
start_hour: source.start_hour,
end_hour: source.end_hour
booth_limit: source.booth_limit,
color: source.color,
start_hour: source.start_hour,
end_hour: source.end_hour
)
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/admin/emails_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ def index

def email_params
params.require(:email_settings).permit(:send_on_registration,
:send_on_accepted, :send_on_rejected, :send_on_confirmed_without_registration,
:send_on_accepted, :send_on_tentative_accepted, :send_on_rejected, :send_on_confirmed_without_registration,
:send_on_submitted_proposal,
:submitted_proposal_subject, :submitted_proposal_body,
:registration_subject, :accepted_subject, :rejected_subject, :confirmed_without_registration_subject,
:registration_body, :accepted_body, :rejected_body, :confirmed_without_registration_body,
:registration_subject, :accepted_subject, :tentative_accepted_subject, :rejected_subject, :confirmed_without_registration_subject,
:registration_body, :accepted_body, :tentative_accepted_body, :rejected_body, :confirmed_without_registration_body,
:send_on_conference_dates_updated, :conference_dates_updated_subject, :conference_dates_updated_body,
:send_on_conference_registration_dates_updated, :conference_registration_dates_updated_subject, :conference_registration_dates_updated_body,
:send_on_venue_updated, :venue_updated_subject, :venue_updated_body,
Expand Down
40 changes: 40 additions & 0 deletions app/controllers/admin/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,46 @@ def new
@superevents = @program.events.where(superevent: true)
end

def preview_tentative_accept
email_settings = @conference.email_settings
@tentative_subject = email_settings.tentative_accepted_subject.presence
default_body = email_settings.tentative_accepted_body.presence
@missing_committee_review = @event.committee_review.blank?
@tentative_body = EmailTemplateParser.parse_template(default_body, email_settings.get_values(@conference, @event.submitter, @event)) unless @missing_committee_review
render :tentative_accept
end

def tentative_accept
email_settings = @conference.email_settings

if @event.committee_review.blank?
flash.now[:alert] = 'Committee feedback is required before sending a tentative acceptance email.'
@tentative_subject = email_settings.tentative_accepted_subject.presence
email_settings.tentative_accepted_body.presence
@missing_committee_review = true
render :tentative_accept and return
end

@tentative_subject = email_settings.tentative_accepted_subject.presence
default_body = email_settings.tentative_accepted_body.presence
@missing_committee_review = false
@tentative_body = EmailTemplateParser.parse_template(default_body, email_settings.get_values(@conference, @event.submitter, @event))
send_mail = email_settings.send_on_tentative_accepted

begin
@event.tentatively_accept(send_mail: send_mail, subject: @tentative_subject, body: @tentative_body)
@event.save!
flash[:notice] = 'Event tentatively accepted!'
redirect_to admin_conference_program_events_path(conference_id: @conference.short_title) and return
rescue ActiveRecord::RecordInvalid => e
flash.now[:error] = "Could not save tentative acceptance: #{e.record.errors.full_messages.join(', ')}"
render :tentative_accept
rescue Transitions::InvalidTransition => e
flash.now[:error] = "Update state failed. #{e.message}"
render :tentative_accept
end
end

def accept
send_mail = @event.program.conference.email_settings.send_on_accepted
subject = @event.program.conference.email_settings.accepted_subject.blank?
Expand Down
16 changes: 13 additions & 3 deletions app/helpers/events_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def difficulty_dropdown(event, difficulties, conference_id)
end

# TODO-SNAPCON: Move to admin helper
# rubocop:disable Metrics/MethodLength
def state_dropdown(event, conference_id, email_settings)
selection = event.state.humanize
options = []
Expand All @@ -123,6 +124,12 @@ def state_dropdown(event, conference_id, email_settings)
]
end
end
if event.transition_possible? :tentatively_accept
options << [
'Tentatively Accept',
preview_tentative_accept_admin_conference_program_event_path(conference_id, event), :get
]
end
if event.transition_possible? :reject
options << [
'Reject',
Expand Down Expand Up @@ -159,6 +166,7 @@ def state_dropdown(event, conference_id, email_settings)
end
active_dropdown(selection, options)
end
# rubocop:enable Metrics/MethodLength

# TODO-SNAPCON: Move to admin helper
def event_switch_checkbox(event, attribute, conference_id)
Expand Down Expand Up @@ -318,9 +326,10 @@ def active_dropdown(selection, options)
#
# Selection is the string to show by default, which is clicked to expose the
# dropdown options.
# Options is a list of 2-item lists; for each entry:
# Options is a list of lists; for each entry:
# * [0] is the text of the option,
# * [1] is the link url for the options
# * [1] is the link url for the option,
# * [2] is the optional HTTP method symbol (defaults to :patch)
content_tag('div', class: 'dropdown') do
content_tag(
'a',
Expand All @@ -333,7 +342,8 @@ def active_dropdown(selection, options)
end +
content_tag('ul', class: 'dropdown-menu') do
options.collect do |option|
content_tag('li', link_to(option[0], option[1], method: :patch))
method = option[2] || :patch
content_tag('li', link_to(option[0], option[1], method: method))
end.join.html_safe
end
end
Expand Down
10 changes: 10 additions & 0 deletions app/mailers/mailbot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ def acceptance_mail(event)
mail(subject: @conference.email_settings.accepted_subject, cc: @speakers)
end

def tentative_acceptance_mail(event, subject: nil, body: nil)
@user = event.submitter
@conference = event.program.conference
@speakers = event.speakers.map(&:email)
@email_body = body.presence || @conference.email_settings.generate_event_mail(event, @conference.email_settings.tentative_accepted_body)
email_subject = subject.presence || @conference.email_settings.tentative_accepted_subject

mail(subject: email_subject, cc: @speakers)
end

def submitted_proposal_mail(event)
@user = event.submitter
@speakers = event.speakers.map(&:email)
Expand Down
2 changes: 1 addition & 1 deletion app/models/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ def copy_associations_from(source)
new_room_id = old_room_id ? room_id_map[old_room_id] : nil
program.tracks.create!(
t.attributes.slice('name', 'short_name', 'description', 'color', 'state', 'relevance', 'start_date', 'end_date', 'cfp_active').merge(
guid: SecureRandom.urlsafe_base64,
guid: SecureRandom.urlsafe_base64,
room_id: new_room_id
)
)
Expand Down
3 changes: 3 additions & 0 deletions app/models/email_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
# send_on_registration :boolean default(FALSE)
# send_on_rejected :boolean default(FALSE)
# send_on_submitted_proposal :boolean default(FALSE)
# send_on_tentative_accepted :boolean default(FALSE)
# send_on_venue_updated :boolean default(FALSE)
# submitted_proposal_body :text
# submitted_proposal_subject :string
# tentative_accepted_body :text
# tentative_accepted_subject :string
# venue_updated_body :text
# venue_updated_subject :string
# created_at :datetime
Expand Down
31 changes: 23 additions & 8 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class Event < ApplicationRecord

scope :confirmed, -> { where(state: 'confirmed') }
scope :unconfirmed, -> { where(state: 'unconfirmed') }
scope :tentatively_accepted, -> { where(state: 'tentatively_accepted') }
scope :canceled, -> { where(state: 'canceled') }
scope :withdrawn, -> { where(state: 'withdrawn') }
scope :highlighted, -> { where(is_highlight: true) }
Expand All @@ -120,6 +121,7 @@ class Event < ApplicationRecord
state :new
state :withdrawn
state :unconfirmed
state :tentatively_accepted
state :confirmed
state :canceled
state :rejected
Expand All @@ -131,7 +133,10 @@ class Event < ApplicationRecord
transitions to: :withdrawn, from: %i[new unconfirmed confirmed]
end
event :accept do
transitions to: :unconfirmed, from: [:new], on_transition: :process_acceptance
transitions to: :unconfirmed, from: %i[new tentatively_accepted], on_transition: :process_acceptance
end
event :tentatively_accept do
transitions to: :tentatively_accepted, from: [:new], on_transition: :process_tentative_acceptance
end
event :confirm do
transitions to: :confirmed, from: :unconfirmed, on_transition: :process_confirmation
Expand All @@ -140,17 +145,18 @@ class Event < ApplicationRecord
transitions to: :canceled, from: %i[unconfirmed confirmed]
end
event :reject do
transitions to: :rejected, from: [:new], on_transition: :process_rejection
transitions to: :rejected, from: %i[new tentatively_accepted], on_transition: :process_rejection
end
end

COLORS = {
new: '#0000FF', # blue
withdrawn: '#FF8000', # orange
unconfirmed: '#FFFF00', # yellow
confirmed: '#00FF00', # green
canceled: '#848484', # grey
rejected: '#FF0000' # red
new: '#0000FF', # blue
withdrawn: '#FF8000', # orange
unconfirmed: '#FFFF00', # yellow
tentatively_accepted: '#FFA500', # amber
confirmed: '#00FF00', # green
canceled: '#848484', # grey
rejected: '#FF0000' # red
}.freeze

##
Expand Down Expand Up @@ -245,6 +251,15 @@ def process_acceptance(options)
end
end

def process_tentative_acceptance(options)
if program.conference.email_settings.send_on_tentative_accepted &&
program.conference.email_settings.tentative_accepted_body &&
program.conference.email_settings.tentative_accepted_subject &&
options[:send_mail].present?
Mailbot.tentative_acceptance_mail(self, subject: options[:subject], body: options[:body]).deliver_later
end
end

def process_rejection(options)
if program.conference.email_settings.send_on_rejected &&
program.conference.email_settings.rejected_body &&
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def for_registration(conference)
scope :comment_notifiable, lambda { |conference|
joins(users_roles: :role)
.where(roles: { resource_type: 'Conference',
resource_id: conference.id,
name: %i[organizer cfp] })
resource_id: conference.id,
name: %i[organizer cfp] })
.where(
Role.arel_table[:name]
.eq('cfp')
Expand Down
16 changes: 16 additions & 0 deletions app/views/admin/emails/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@
'data-body-text' => "Dear {name}\n\nWe are very pleased to inform you that your submission {eventtitle} has been accepted for the conference {conference}.\n\nThe public page of your submission can be found at:\n{proposalslink}\nIf you haven´t already registered for {conference}, please do as soon as possible:\n{registrationlink}\n\nFeel free to contact us with any questions or concerns.\n\nWe look forward to seeing you there.\n\nBest wishes\n\n{conference} Team" } Load Template
%a.btn.btn-link.control_label.template_help_link{ 'data-name' => 'accepted_help' } Show Help
= render partial: 'shared/help', locals: { id: 'accepted_help', show_event_variables: true, show_ticket_variables: false }
.checkbox
%label
= f.check_box :send_on_tentative_accepted, data: { name: 'email_settings_tentative_accepted_subject' }, class: 'send_on_radio'
Send an email to the submitter when the proposal is tentatively accepted?
.form-group
= f.label :tentative_accepted_subject, 'Subject'
= f.text_field :tentative_accepted_subject, class: 'form-control'
.form-group
= f.label :tentative_accepted_body, 'Body'
= f.text_area :tentative_accepted_body, rows: 10, cols: 20, class: 'form-control'
%a.btn.btn-link.control_label.load_template{ 'data-subject-input-id' => 'email_settings_tentative_accepted_subject',
'data-subject-text' => 'Your submission has been tentatively accepted',
'data-body-input-id' => 'email_settings_tentative_accepted_body',
'data-body-text' => "Dear {name}\n\nWe are pleased to inform you that your submission {eventtitle} has been tentatively accepted for the conference {conference}, pending the following changes:\n\n{committee_review}\n\nPlease update your proposal accordingly and let us know when you are ready for final approval.\n\nIf you haven't already registered for {conference}, please do so as soon as possible:\n{registrationlink}\n\nBest wishes\n\n{conference} Team" } Load Template
%a.btn.btn-link.control_label.template_help_link{ 'data-name' => 'tentative_accepted_help' } Show Help
= render partial: 'shared/help', locals: { id: 'tentative_accepted_help', show_event_variables: true, show_ticket_variables: false }
.checkbox
%label
= f.check_box :send_on_rejected, data: { name: 'email_settings_rejected_subject'}, class: 'send_on_radio'
Expand Down
28 changes: 28 additions & 0 deletions app/views/admin/events/preview_tentative_accept.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
%h2 Tentative Acceptance
- if @event.program.conference.email_settings.send_on_tentative_accepted
.alert.alert-success
Email sending is enabled for tentative acceptance.
- if @missing_committee_review
.alert.alert-warning
Committee feedback is required before sending a tentative acceptance email.
%br
Please add committee feedback on the event before continuing.
- else
.panel.panel-default
.panel-heading
%h3 Email preview
.panel-body
.form-group
%label Email subject
%p.form-control-static= @tentative_subject
.form-group
%label Email body
= simple_format(@tentative_body)
- else
.alert.alert-warning
Email sending is currently disabled for tentative acceptance.

= form_with url: tentative_accept_admin_conference_program_event_path(@conference.short_title, @event), method: :patch, local: true do |f|
.form-group
= f.submit 'Tentatively Accept', class: 'btn btn-primary', disabled: @missing_committee_review
= link_to 'Cancel', admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-default'
28 changes: 28 additions & 0 deletions app/views/admin/events/tentative_accept.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
%h2 Tentative Acceptance
- if @event.program.conference.email_settings.send_on_tentative_accepted
.alert.alert-success
Email sending is enabled for tentative acceptance.
- if @missing_committee_review
.alert.alert-warning
Committee feedback is required before sending a tentative acceptance email.
%br
Please add committee feedback on the event before continuing.
- else
.panel.panel-default
.panel-heading
%h3 Email preview
.panel-body
.form-group
%label Email subject
%p.form-control-static= @tentative_subject
.form-group
%label Email body
= simple_format(@tentative_body)
- else
.alert.alert-warning
Email sending is currently disabled for tentative acceptance.

= form_with url: tentative_accept_admin_conference_program_event_path(@conference.short_title, @event), method: :patch, local: true do |f|
.form-group
= f.submit 'Tentatively Accept', class: 'btn btn-primary', disabled: @missing_committee_review
= link_to 'Cancel', admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-default'
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
get :registrations
post :comment
patch :accept
get :preview_tentative_accept
patch :tentative_accept
patch :confirm
patch :cancel
patch :reject
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddTentativeAcceptedToEmailSettings < ActiveRecord::Migration[5.0]
def change
add_column :email_settings, :send_on_tentative_accepted, :boolean, default: false
add_column :email_settings, :tentative_accepted_subject, :string
add_column :email_settings, :tentative_accepted_body, :text
end
end
Loading
Loading