From 2c36ceb10c1c2932d6ba79f03a115c94f7f09415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Wed, 30 Dec 2015 14:18:44 +0100 Subject: [PATCH] adds abilities for SpendingProposals --- app/controllers/moderation/users_controller.rb | 2 +- app/models/abilities/common.rb | 3 +++ app/models/abilities/everyone.rb | 1 + app/views/proposals/_form.html.erb | 4 +--- spec/models/abilities/common_spec.rb | 3 +++ spec/models/abilities/everyone_spec.rb | 3 +++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/controllers/moderation/users_controller.rb b/app/controllers/moderation/users_controller.rb index 6ff22f94a..3255bb6cc 100644 --- a/app/controllers/moderation/users_controller.rb +++ b/app/controllers/moderation/users_controller.rb @@ -30,4 +30,4 @@ class Moderation::UsersController < Moderation::BaseController Activity.log(current_user, :block, @user) end -end +end \ No newline at end of file diff --git a/app/models/abilities/common.rb b/app/models/abilities/common.rb index 181238d2c..b95e5f5b4 100644 --- a/app/models/abilities/common.rb +++ b/app/models/abilities/common.rb @@ -17,9 +17,12 @@ module Abilities proposal.editable_by?(user) end + can :read, SpendingProposal + can :create, Comment can :create, Debate can :create, Proposal + can :create, SpendingProposal can [:flag, :unflag], Comment cannot [:flag, :unflag], Comment, user_id: user.id diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index 122d5db2a..377ef7440 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -6,6 +6,7 @@ module Abilities can :read, Debate can :read, Proposal can :read, Comment + can :read, SpendingProposal can :read, Legislation can :read, User can [:search, :read], Annotation diff --git a/app/views/proposals/_form.html.erb b/app/views/proposals/_form.html.erb index 4c14730fe..97e1ecb6b 100644 --- a/app/views/proposals/_form.html.erb +++ b/app/views/proposals/_form.html.erb @@ -79,6 +79,4 @@ <%= f.submit(class: "button radius", value: t("proposals.#{action_name}.form.submit_button")) %> -<% end %> - - +<% end %> \ No newline at end of file diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb index 4775cd1ee..a24b5f2d9 100644 --- a/spec/models/abilities/common_spec.rb +++ b/spec/models/abilities/common_spec.rb @@ -28,6 +28,9 @@ describe "Abilities::Common" do it { should_not be_able_to(:vote, Proposal) } it { should_not be_able_to(:vote_featured, Proposal) } + it { should be_able_to(:index, SpendingProposal) } + it { should be_able_to(:create, SpendingProposal) } + it { should_not be_able_to(:comment_as_administrator, debate) } it { should_not be_able_to(:comment_as_moderator, debate) } it { should_not be_able_to(:comment_as_administrator, proposal) } diff --git a/spec/models/abilities/everyone_spec.rb b/spec/models/abilities/everyone_spec.rb index dacac25e4..3f1e57278 100644 --- a/spec/models/abilities/everyone_spec.rb +++ b/spec/models/abilities/everyone_spec.rb @@ -23,4 +23,7 @@ describe "Abilities::Everyone" do it { should_not be_able_to(:unflag, Proposal) } it { should be_able_to(:show, Comment) } + + it { should be_able_to(:index, SpendingProposal) } + it { should_not be_able_to(:create, SpendingProposal) } end