Sha256: 3be6e2fc29bb70167a07bed7c841a7aba891c14552d79dd1e2c5b2bc204bdafa

Contents?: true

Size: 1.03 KB

Versions: 25

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Thredded
  class MessageboardNotificationsForFollowedTopics < ActiveRecord::Base
    belongs_to :user_preference,
               primary_key: :user_id,
               foreign_key: :user_id,
               inverse_of: :messageboard_notifications_for_followed_topics
    belongs_to :user,
               class_name: Thredded.user_class_name,
               inverse_of: :thredded_user_messageboard_preferences
    belongs_to :messageboard
    scope :for_messageboard, ->(messageboard) { where(messageboard_id: messageboard.id) }

    validates :user_id, presence: true
    validates :messageboard_id, presence: true

    def self.in(messageboard)
      where(messageboard_id: messageboard.id)
    end

    include Thredded::NotifierPreference

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

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
thredded-0.16.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.0 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.15.5 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.15.4 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.15.3 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.15.2 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.15.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb
threddedDANIEL-0.14.5 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.14.4 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.14.3 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.14.2 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.14.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.14.0 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.13.8 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.13.7 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.13.6 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.13.5 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.13.4 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.13.3 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.13.2 app/models/thredded/messageboard_notifications_for_followed_topics.rb