Sha256: 1d6a6f8091d6841acce7b6bdbead30b15087c59567ab21c01f8b6c4b455aa5c1

Contents?: true

Size: 471 Bytes

Versions: 40

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module Thredded
  module NotifierPreference
    extend ActiveSupport::Concern

    included do
      delegate :human_name, to: :notifier, prefix: true

      def self.detect_or_default(prefs, notifier)
        (prefs && prefs.find { |pref| pref.notifier_key == notifier.key }) || default(notifier)
      end
    end

    def notifier
      @notifier ||= Thredded.notifiers.find { |notifier| notifier.key == notifier_key }
    end
  end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
thredded-1.0.0 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.16 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.15 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.14 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.13 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.12 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.11 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.10 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.9 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.8 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.7 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.6 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.5 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.4 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.3 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.1 app/models/concerns/thredded/notifier_preference.rb
thredded-0.16.0 app/models/concerns/thredded/notifier_preference.rb
thredded-0.15.5 app/models/concerns/thredded/notifier_preference.rb
thredded-0.15.4 app/models/concerns/thredded/notifier_preference.rb
thredded-0.15.3 app/models/concerns/thredded/notifier_preference.rb