2016-12-16 21:51:52 +00:00
|
|
|
# frozen_string_literal: true
|
2017-11-25 19:23:47 +00:00
|
|
|
|
2017-01-24 00:30:13 +00:00
|
|
|
module Events
|
|
|
|
class TopicUpdated < Event
|
2017-11-25 19:23:47 +00:00
|
|
|
# after_create :notify_users!
|
2016-12-16 21:51:52 +00:00
|
|
|
|
2017-01-24 00:30:13 +00:00
|
|
|
def self.publish!(topic, user, meta)
|
|
|
|
create!(kind: 'topic_updated',
|
|
|
|
eventable: topic,
|
|
|
|
user: user,
|
|
|
|
meta: meta)
|
|
|
|
end
|
2017-11-25 19:23:47 +00:00
|
|
|
|
2017-02-11 05:20:42 +00:00
|
|
|
def notify_users!
|
|
|
|
NotificationService.notify_followers(eventable, 'topic_updated', self)
|
|
|
|
end
|
2016-12-16 21:51:52 +00:00
|
|
|
end
|
|
|
|
end
|