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