Sha256: d8d4f9b283e476d63eb098552b0a897420d75cd67a11ddbd364f88f4c9c512d3

Contents?: true

Size: 928 Bytes

Versions: 23

Compression:

Stored size: 928 Bytes

Contents

# frozen_string_literal: true
module Thredded
  module UserPermissions
    module Moderate
      module IfModeratorColumnTrue
        extend ActiveSupport::Concern
        included { extend ClassMethods }

        # @return [ActiveRecord::Relation<Thredded::Messageboard>] messageboards that the user can moderate
        def thredded_can_moderate_messageboards
          send(Thredded.moderator_column) ? Thredded::Messageboard.all : Thredded::Messageboard.none
        end

        module ClassMethods
          # Users that can moderate the given messageboards.
          #
          # @param _messageboards [Array<Thredded::Messageboard>]
          # @return [ActiveRecord::Relation<Thredded.user_class>] users that can moderate the given messageboards
          def thredded_messageboards_moderators(_messageboards)
            where(Thredded.moderator_column => true)
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
thredded-0.12.1 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.12.0 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.11.1 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.11.0 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.10.1 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.10.0 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.9.4 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.9.3 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.9.2 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.9.1 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.8.4 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.8.2 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.7.0 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.6.3 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.6.2 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.6.1 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.6.0 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.5.1 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.5.0 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb
thredded-0.4.0 app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb