diff --git a/app/controllers/legislation/processes_controller.rb b/app/controllers/legislation/processes_controller.rb index adb7906fa..6593821cb 100644 --- a/app/controllers/legislation/processes_controller.rb +++ b/app/controllers/legislation/processes_controller.rb @@ -4,7 +4,7 @@ class Legislation::ProcessesController < Legislation::BaseController def index @current_filter ||= 'open' - @processes = ::Legislation::Process.send(@current_filter).page(params[:page]) + @processes = ::Legislation::Process.send(@current_filter).published.page(params[:page]) end def show diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index eaa971016..4e6183a2a 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -19,7 +19,7 @@ module Abilities can [:read, :print], Budget::Investment can :read_results, Budget, phase: "finished" can :new, DirectMessage - can [:read, :debate, :draft_publication, :allegations, :result_publication], Legislation::Process + can [:read, :debate, :draft_publication, :allegations, :result_publication], Legislation::Process, published: true can [:read, :changes, :go_to_version], Legislation::DraftVersion can [:read], Legislation::Question can [:create], Legislation::Answer diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index 61dc1f7a0..59ab99433 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -21,6 +21,8 @@ class Legislation::Process < ActiveRecord::Base scope :next, -> { where("start_date > ?", Date.current).order('id DESC') } scope :past, -> { where("end_date < ?", Date.current).order('id DESC') } + scope :published, -> { where(published: true) } + def debate_phase Legislation::Process::Phase.new(debate_start_date, debate_end_date, debate_phase_enabled) end