Sha256: ed226b82e7c655d3f86f74f223fac177025e44bb18b729458ec85f706bfaaddc

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 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,
               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

10 entries across 10 versions & 1 rubygems

Version Path
thredded-0.12.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.12.0 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.11.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.11.0 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.10.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.10.0 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.9.4 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.9.3 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.9.2 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.9.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb