Skip to content

Commit d3296aa

Browse files
committed
Simply update proposal & program_session together
RK fork allows speakers to update their proposal even after program_session was created. Thus, we need to sync the contents when a speaker updated their accepted proposal.
1 parent 5a37d47 commit d3296aa

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

app/controllers/proposals_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ def update
108108
@proposal.update(confirmed_at: Time.current)
109109
redirect_to [@event, @proposal], flash: {success: 'Thank you for confirming your participation'}
110110
elsif @proposal.speaker_update_and_notify(proposal_params)
111+
if @proposal.program_session && ((@proposal.program_session.title != @proposal.title) || (@proposal.program_session.abstract != @proposal.abstract))
112+
@proposal.program_session.update title: @proposal.title, abstract: @proposal.abstract
113+
end
111114
redirect_to [@event, @proposal]
112115
else
113116
flash[:danger] = "There was a problem saving your proposal."

app/models/program_session.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ class ProgramSession < ApplicationRecord
7373
where(session_format_id: session_format.id)
7474
end
7575

76-
def title
77-
proposal&.title || super
78-
end
79-
80-
def abstract
81-
proposal&.abstract || super
82-
end
83-
8476
def self.create_from_proposal(proposal)
8577
self.transaction do
8678
ps = ProgramSession.create!(event_id: proposal.event_id,

0 commit comments

Comments
 (0)