diff --git a/app/models/topic.rb b/app/models/topic.rb index 5fe6a17bd70..8087c8492ad 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -10,6 +10,16 @@ class Topic < ActiveRecord::Base include ActionView::Helpers::SanitizeHelper include RateLimiter::OnCreateRecord include Trashable + extend Forwardable + + def_delegator :featured_users, :user_ids, :featured_user_ids + def_delegator :featured_users, :choose, :feature_topic_users + + def_delegator :notifier, :watch!, :notify_watch! + def_delegator :notifier, :tracking!, :notify_tracking! + def_delegator :notifier, :regular!, :notify_regular! + def_delegator :notifier, :muted!, :notify_muted! + def_delegator :notifier, :toggle_mute, :toggle_mute def self.max_sort_order 2**31 - 1 @@ -21,14 +31,6 @@ class Topic < ActiveRecord::Base @featured_users ||= TopicFeaturedUsers.new(self) end - def featured_user_ids - featured_users.user_ids - end - - def feature_topic_users(args={}) - featured_users.choose(args) - end - def trash!(trashed_by=nil) update_category_topic_count_by(-1) if deleted_at.nil? super(trashed_by) @@ -561,34 +563,12 @@ class Topic < ActiveRecord::Base @topic_notifier ||= TopicNotifier.new(self) end - # notification stuff - def notify_watch!(user) - notifier.watch! user - end - - def notify_tracking!(user) - notifier.tracking! user - end - - def notify_regular!(user) - notifier.regular! user - end - - def notify_muted!(user) - notifier.muted! user - end - def muted?(user) if user && user.id notifier.muted?(user.id) end end - # Enable/disable the mute on the topic - def toggle_mute(user_id) - notifier.toggle_mute user_id - end - def auto_close_days=(num_days) @ignore_category_auto_close = true set_auto_close(num_days)