Sha256: 30e784226842cd0391a70f996ef06c9f04a442518d290d2ffab79c0360b43df5

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

# frozen_string_literal: true

module Thredded
  class NotificationsForFollowedTopics < ActiveRecord::Base
    belongs_to :user,
               class_name: Thredded.user_class_name,
               inverse_of: :thredded_notifications_for_followed_topics
    belongs_to :messageboard,
               # If messageboard is `nil`, these are the global preferences.
               optional: true
    belongs_to :user_preference,
               primary_key: :user_id,
               foreign_key: :user_id,
               inverse_of: :notifications_for_followed_topics

    validates :user_id, presence: true

    include Thredded::NotifierPreference

    def self.default(_notifier)
      # could be moved to  `notifier.defaults(:notifications_for_followed_topics)`
      Thredded::BaseNotifier::NotificationsDefault.new(true)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thredded-1.1.0 app/models/thredded/notifications_for_followed_topics.rb
thredded-1.0.1 app/models/thredded/notifications_for_followed_topics.rb
thredded-1.0.0 app/models/thredded/notifications_for_followed_topics.rb