metamaps--metamaps/app/models/events/topic_added_to_map.rb

22 lines
630 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Events
class TopicAddedToMap < Event
2017-02-09 21:47:41 +00:00
after_create :notify_users!
def self.publish!(topic, map, user, meta)
create!(kind: 'topic_added_to_map',
eventable: topic,
map: map,
user: user,
meta: meta)
end
2017-02-09 21:47:41 +00:00
def notify_users!
# in the future, notify followers of both the topic, and the map
NotificationService.notify_followers(eventable, 'topic_added_to_map', self)
# NotificationService.notify_followers(map, 'topic_added_to_map', self)
end
handle_asynchronously :notify_users!
end
end