Sha256: f98795729640508828b455b2bd71ff68d9314018bff1d6a55c715e44152c4634
Contents?: true
Size: 941 Bytes
Versions: 71
Compression:
Stored size: 941 Bytes
Contents
# frozen_string_literal: true module Decidim module Conferences class UpcomingConferenceNotificationJob < ApplicationJob queue_as :events def perform(conference_id, checksum) conference = Decidim::Conference.find(conference_id) send_notification(conference) if verify_checksum(conference, checksum) end def self.generate_checksum(conference) Digest::MD5.hexdigest("#{conference.id}-#{conference.start_date}") end private def send_notification(conference) Decidim::EventsManager.publish( event: "decidim.events.conferences.upcoming_conference", event_class: Decidim::Conferences::UpcomingConferenceEvent, resource: conference, followers: conference.followers ) end def verify_checksum(conference, checksum) self.class.generate_checksum(conference) == checksum end end end end
Version data entries
71 entries across 71 versions & 1 rubygems