Sha256: 46a4e5aac1b698ac5b2496d06c82c589c4a175aa4e1321296d9e07cf1188e3f6

Contents?: true

Size: 772 Bytes

Versions: 58

Compression:

Stored size: 772 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # This cell is intended to be used on profiles.
  # Lists the pending join requests of the given user group.
  class UserGroupPendingRequestsListCell < Decidim::ViewModel
    include Decidim::CellsPaginateHelper
    include Decidim::ApplicationHelper
    include Decidim::Core::Engine.routes.url_helpers
    include Decidim::CardHelper

    def show
      return if requests.empty?
      return unless current_user_is_manager?

      render :show
    end

    def requests
      @requests ||= Decidim::UserGroupMembership.includes(:user).where(user_group: model, role: "requested")
    end

    def current_user_is_manager?
      Decidim::UserGroups::ManageableUserGroups.for(current_user).include?(model)
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.9 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.28.3 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.8 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.28.2 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.7 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.28.1 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.6 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.26.10 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.26.9 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.28.0 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.5 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.26.8 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.4 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.3 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.26.7 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.26.5 app/cells/decidim/user_group_pending_requests_list_cell.rb
decidim-core-0.27.2 app/cells/decidim/user_group_pending_requests_list_cell.rb