Sha256: 5d3775f33476bfc3ee6f5d55073462c05b80b476b3432722ef94a36bf39169c7

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 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_messageboard_notifications_for_followed_topics
    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

17 entries across 17 versions & 1 rubygems

Version Path
thredded-1.1.0 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-1.0.1 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-1.0.0 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.16 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.15 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.14 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.13 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.12 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.11 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.10 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.9 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.8 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.7 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.6 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.5 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.4 app/models/thredded/messageboard_notifications_for_followed_topics.rb
thredded-0.16.3 app/models/thredded/messageboard_notifications_for_followed_topics.rb