Commit Graph

85 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
7df0e9a961 Allow to remove poll answers 2022-10-18 11:04:40 +02:00
Julian Herrero
4c8f247de7 Don't allow to modify answer's documents for started polls 2022-09-20 17:50:49 +02:00
Julian Herrero
245594f32b Don't allow to modify answer's images for started polls
Note that the `create` action doesn't create an image but updates an
answer instead. We're removing the references to `:create` in the
abilities since it isn't used.

In the future we might change the form to add an image to an answer
because it's been broken for ages since it shows all the attached
images.
2022-09-20 17:50:49 +02:00
Javi Martín
4b42a68b6a Use the vote action to vote featured proposals
The action and the views were almost identical, with the supports
progress and the HTML classes of the success message element being the
only exceptions; we can use CSS for the styles instead.
2022-02-21 18:47:13 +01:00
Javi Martín
0bacd5baf3 Remove unused legislation proposals index action
The `legislation_proposals#index` action was never used because it used
the same URL as `legislation_processes#proposals`.

In commit 702bfec24 we removed the view, but we forgot to remove the
controller action, the route, and some partials which were rendered from
the index view.
2022-02-21 18:47:13 +01:00
Javi Martín
c34fc7f0b8 Remove unneeded lines restricting permissions
In the past, users had permission to edit their own legislation
proposals. However, that changed in commit ebfa3fb01, where we replaced
the `can` method with `cannot`.

An easier way to remove this permission is to simply remove the whole
statement, since by default users don't have permissions to do anything.

We're also adding a test checking users can't edit their own legislation
proposals, since it was missing.
2021-12-30 18:25:45 +01:00
Javi Martín
5980df0b31 Remove redundant permissions to edit/create records
The `edit` action is automatically authorized with the rules used for
`:update`, the same way the `new` action is authorized with the rules
used for `:create`.

So we don't need to authorize the edit and new actions.

These changes make it easier for institutions customizing Consul to
notice what they need to change if (for instance) they want users to be
able to edit investments under certain conditions.
2021-12-30 17:26:57 +01:00
decabeza
a851048d56 Allow users to remove their support on investments
Note we don't cast negative votes when users remove their support. That
way we provide compatibility for institutions who have implemented real
negative votes (in case there are / will be any), and we also keep the
database meaningful: it's not that users downvoted something; they
simply removed their upvote.

Co-Authored-By: Javi Martín <javim@elretirao.net>
Co-Authored-By: Julian Nicolas Herrero <microweb10@gmail.com>
2021-06-14 14:46:54 +02:00
Javi Martín
758cdaf8d7 Extract controllers to support investments
Since we're going to add an action to remove supports, having a separate
controller makes things easier.

Note there was a strange piece of code which assumed users were not
verified if they couldn't vote investments. Now the code is also
strange, since it assumes users are not verified if they can't create
votes. We might need to revisit these conditions if our logic changes in
the future.
2021-06-14 14:42:03 +02:00
Julian Herrero
0698c0ff4f Allow users to delete their own comments 2021-04-13 20:04:04 +02:00
Javi Martín
d7ad1a769f Make sure users can only delete their own follows
Since we're defining abilities with cancancan and using
`load_and_authorize_resource`, we're also modifying the `create` action
for consistency.
2021-04-13 13:52:18 +02:00
Javi Martín
af7c37634d Remove poll votation types
Unfortunately this feature wasn't properly reviewed and tested, and it
had many bugs, some of them critical and hard to fix, like validations
being skipped in concurrent requests.

So we're removing it before releasing version 1.1. We might add it back
in the future if we manage to solve the critical issues.

This commit reverts commit 836f9ba7.
2019-10-30 18:48:55 +01:00
Javi Martín
a727dcc031 Apply Style/SymbolProc rubocop rule
This style is much more concise.
2019-10-26 20:10:32 +02:00
denialtorres
bb627a7117 Edit Budget Investment only in accepting phase (#3716)
This way users who made a typo can fix it before the investment is reviewed.
2019-10-18 13:59:14 +02:00
Javi Martín
ad14636255 Use Tag instead of ActsAsTaggableOn::Tag
It's shorter, it's easier to extend its behaviour, and it's easier to
integrate with other parts of our application, like translations.
2019-10-05 03:38:44 +02:00
Javi Martín
9fe8c47528 Apply Rails/SafeNavigation rubocop rule 2019-09-10 21:43:39 +02:00
lalo
c6e4b2480f Add public changes to create and vote Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Julian Herrero
54e59a8a58 LegacyLegislation migration cleanup
These legacy models are not used anymore.
2019-02-06 17:07:38 +01:00
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
Juan Salvador Pérez García
f875ded0be Bugfixing and enhancements
* Fixed common ability: Retired draft proposal can't be published.
* Fixed proposal dashboard view: progress graph is not available for
draft proposals.
2018-09-13 18:22:59 +02:00
Juan Salvador Pérez García
6cc1ddb9af Fixes #231
Implements a poster feature for the proposals dashboard
2018-07-31 12:50:25 +02:00
Juan Salvador Pérez García
8876b285ce Fixes #229
Adds email feature for proposals dashboard
2018-07-25 13:28:44 +02:00
Angel Perez
bcb0b9fbfa Enable moderation abilities for Budget::Investment model 2018-07-20 18:03:11 -04:00
Juan Salvador Pérez García
f439fc7371 Fixes #218
Added check in poll card that allows setting the value of
results_enabled flag.

Access to stats/results now is controlled with abilities.

Polls related to proposals will be accessible to the proposal author
like they were administrators.
2018-07-17 17:59:12 +02:00
Juan Salvador Pérez García
3c3f60dfcc Implements #173
Public view for suggested actions as well as resources has been
completelly redesigned.

Private side for this feature has been adapted as well in order to meet
the requirements.
2018-07-17 17:58:22 +02:00
Juan Salvador Pérez García
2ce9f95283 Polls in the dashboard
A reduced version of polls has been added to the dashboard
2018-07-17 17:57:30 +02:00
Juan Salvador Pérez García
706fdae6d5 %i arrays of symbols
%i arrays of symbols have been replaced by standard arrays of symbols in
order to keep the consistency.
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
212c088d35 Implements #144
Creates the basic layout for the dashboard
2018-07-17 17:47:40 +02:00
Juan Salvador Pérez García
77dd60427d Implements story #136
Adds draft state for proposals
2018-07-17 17:46:54 +02:00
Angel Perez
31c16406c0 Move disable recommendations permissions to Abilities::Common model 2018-07-15 21:28:58 -04:00
María Checa
b556617a80 Changed permissions to vote Legislation Proposals and Answers 2017-10-25 16:43:25 +02:00
María Checa
841ef2a3a2 Merge branch 'master' into 1856-legislation_processes_proposals_phase 2017-10-09 17:19:07 +02:00
Senén Rodero Rodríguez
2993ef8707 Remove documents single uploads 2017-09-27 11:04:56 +02:00
Senén Rodero Rodríguez
eef8ad1b73 Remove images single uploads 2017-09-27 10:41:48 +02:00
Senén Rodero Rodríguez
f8d78ec4ab Remove new_nested action from images controller. Use cocoon gem to manage new nested fields creation on images. 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
88a7a29d27 Remove new_nested action from documents controller. Use cocoon gem to manage new nested fields creation on documents. 2017-09-26 13:57:13 +02:00
Senén Rodero Rodríguez
826385f659 Extract ajax upload and destroy_upload actions from images and documents controllers and place them at new controllers to manage direct uploads 2017-09-26 13:55:28 +02:00
Senén Rodero Rodríguez
d1d2a31876 Remove permissions of obsolete actions. Add missing image managment abilities to common and administrator specs. 2017-09-26 13:55:03 +02:00
Senén Rodero Rodríguez
6f71da07ee Duplicate documentable code and rename for imageable 2017-09-26 13:55:03 +02:00
Senén Rodero Rodríguez
4469aa9b32 Allow to remove budget investment image from edit image page to authors and administrators. 2017-09-26 13:53:42 +02:00
Senén Rodero Rodríguez
acc79cbe31 Add edit_image and update_image action to budget/investments controller. 2017-09-26 13:53:42 +02:00
María Checa
ebfa3fb011 Disallow users to edit their legislation proposals 2017-09-22 11:39:17 +02:00
iagirre
4db2584f87 The tags are suggested based on the entries the user makes.
Cambios para hacer commit:
	modificado:    app/assets/javascripts/tag_autocomplete.js.coffee
	modificado:    app/assets/stylesheets/autocomplete_overrides.scss
	nuevo archivo: app/controllers/tags_controller.rb
	modificado:    app/models/abilities/common.rb
	modificado:    app/views/debates/_form.html.erb
	modificado:    app/views/proposals/_form.html.erb
	modificado:    config/initializers/acts_as_taggable_on.rb
	modificado:    config/routes.rb
	modificado:    spec/lib/acts_as_taggable_on_spec.rb
2017-09-21 18:21:45 +02:00
María Checa
393e9f2b6a Added permissions for Legislation:Proposal 2017-09-14 17:38:42 +02:00
taitus
64774b0d2d Refactor topics controller. Add Common abilities. Add destroy action. 2017-09-06 13:30:12 +02:00
Senén Rodero Rodríguez
0fbffdc73e Fix abilities definition and related specs 2017-08-25 18:34:53 +02:00
Senén Rodero Rodríguez
cc89907bff Add nested documents to proposal form. 2017-08-25 18:34:52 +02:00
Senén Rodero Rodríguez
c92827e89e Add abilities to documentable authors and admins to create and destroy documents. 2017-08-25 17:27:37 +02:00