Sha256: 2ce1d06aaf1f6dba938c894a8edf05a85f4f21cf2d2072790a6d5a33ea49cfff
Contents?: true
Size: 967 Bytes
Versions: 33
Compression:
Stored size: 967 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) return if meeting.hidden? || meeting.withdrawn? return unless verify_checksum(meeting, checksum) send_notification(meeting) 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, followers: meeting.followers ) end def verify_checksum(meeting, checksum) self.class.generate_checksum(meeting) == checksum end end end end
Version data entries
33 entries across 33 versions & 1 rubygems