Sha256: 74c57528c62756f1f6dbae513cfbe88dbc1e311ce2ec80a90d60151b76bbe781
Contents?: true
Size: 906 Bytes
Versions: 28
Compression:
Stored size: 906 Bytes
Contents
# frozen_string_literal: true module Decidim module Meetings class UpcomingMeetingNotificationJob < ApplicationJob queue_as :events def perform(meeting_id, checksum) meeting = Decidim::Meetings::Meeting.find(meeting_id) send_notification(meeting) if verify_checksum(meeting, checksum) end def self.generate_checksum(meeting) Digest::MD5.hexdigest("#{meeting.id}-#{meeting.start_time}") end private def send_notification(meeting) Decidim::EventsManager.publish( event: "decidim.events.meetings.upcoming_meeting", event_class: Decidim::Meetings::UpcomingMeetingEvent, resource: meeting, recipient_ids: meeting.followers.pluck(:id) ) end def verify_checksum(meeting, checksum) self.class.generate_checksum(meeting) == checksum end end end end
Version data entries
28 entries across 28 versions & 1 rubygems