Skip to content
Snippets Groups Projects
Commit 17ca9037 authored by Teal Bauer's avatar Teal Bauer
Browse files

fix: make handle_speaker_event public again

parent 6f56cc2d
Branches
No related tags found
No related merge requests found
Pipeline #39527 passed
...@@ -101,41 +101,6 @@ class NotificationsSubscriber ...@@ -101,41 +101,6 @@ class NotificationsSubscriber
Rails.logger.error(e.backtrace.join("\n")) Rails.logger.error(e.backtrace.join("\n"))
end end
private
def generate_notification_message(record, changes)
return "" unless record&.respond_to?(:title) && record&.respond_to?(:conference)
title = record.title || "Untitled"
# Generate URL for the record
url = begin
case record
when Session
conference_session_url(
record.conference,
record,
host: "rescheduled.c3lingo.org",
protocol: "https"
)
else
"https://rescheduled.c3lingo.org"
end
rescue => e
Rails.logger.error("Failed to generate URL: #{e.message}")
"https://rescheduled.c3lingo.org"
end
# Format changes safely
change_text = changes&.map do |attr, change_array|
next unless change_array.is_a?(Array) && change_array.length >= 2
from, to = change_array
"- #{attr}: #{from}#{to}"
end&.compact&.join("\n") || "No changes recorded"
"<b><a href=\"#{url}\">#{record.class.name}: #{title}</a></b>\n<b>updated</b>\n#{change_text}"
end
def handle_speaker_event(event) def handle_speaker_event(event)
Rails.logger.info("NotificationsSubscriber: Speaker event #{event.inspect}") Rails.logger.info("NotificationsSubscriber: Speaker event #{event.inspect}")
model_name, action = event.name.split(".") model_name, action = event.name.split(".")
...@@ -178,4 +143,39 @@ class NotificationsSubscriber ...@@ -178,4 +143,39 @@ class NotificationsSubscriber
end end
end end
end end
private
def generate_notification_message(record, changes)
return "" unless record&.respond_to?(:title) && record&.respond_to?(:conference)
title = record.title || "Untitled"
# Generate URL for the record
url = begin
case record
when Session
conference_session_url(
record.conference,
record,
host: "rescheduled.c3lingo.org",
protocol: "https"
)
else
"https://rescheduled.c3lingo.org"
end
rescue => e
Rails.logger.error("Failed to generate URL: #{e.message}")
"https://rescheduled.c3lingo.org"
end
# Format changes safely
change_text = changes&.map do |attr, change_array|
next unless change_array.is_a?(Array) && change_array.length >= 2
from, to = change_array
"- #{attr}: #{from}#{to}"
end&.compact&.join("\n") || "No changes recorded"
"<b><a href=\"#{url}\">#{record.class.name}: #{title}</a></b>\n<b>updated</b>\n#{change_text}"
end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment