Sha256: fa1fed63a9a24c9dc88bb49704e8064a51a62d62c8f439e72cd079265e4b8f2a
Contents?: true
Size: 719 Bytes
Versions: 14
Compression:
Stored size: 719 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
14 entries across 14 versions & 1 rubygems