Module: Thredded::UserPermissions::Moderate::IfModeratorColumnTrue

Extended by:
ActiveSupport::Concern
Included in:
Thredded::UserExtender
Defined in:
app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb

Instance Method Summary collapse

Instance Method Details

#thredded_can_moderate_messageboard?(messageboard) ⇒ Boolean

Returns Whether the user can moderate the given messageboard.

Parameters:

Returns:

  • (Boolean)

    Whether the user can moderate the given messageboard.


16
17
18
19
# File 'app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb', line 16

def thredded_can_moderate_messageboard?(messageboard)
  scope = thredded_can_moderate_messageboards
  scope == Thredded::Messageboard.all || scope.include?(messageboard)
end

#thredded_can_moderate_messageboardsActiveRecord::Relation<Thredded::Messageboard>

Returns messageboards that the user can moderate.

Returns:


10
11
12
# File 'app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb', line 10

def thredded_can_moderate_messageboards
  send(Thredded.moderator_column) ? Thredded::Messageboard.all : Thredded::Messageboard.none
end