Sha256: d3f6dfa6b081b0b8cbf7ab3a66b001975cbf05dd5cc28da0ec1dd3d378729d14
Contents?: true
Size: 718 Bytes
Versions: 5
Compression:
Stored size: 718 Bytes
Contents
# frozen_string_literal: true module Decidim module ParticipatoryProcesses # This query class filters participatory processes given a current_user. class VisibleParticipatoryProcessGroups < Rectify::Query def initialize(current_user) @current_user = current_user end def query processes = Decidim::ParticipatoryProcess.all if @current_user return processes if @current_user.admin processes = processes.visible_for(@current_user.id) else processes = processes.public_spaces end Decidim::ParticipatoryProcessGroup.where(id: processes.pluck(:decidim_participatory_process_group_id)) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems