Commit Graph

13999 Commits

Author SHA1 Message Date
voodoorai2000
e139057001 Disable dashboard email deliveries
We have to doble check all emails deliveries from the dashboard.

Using a setting to skip all dashboard email deliveries for now.

Note that a rake task to activated the `Setting["dashboard.emails"]` will need to be addded when we want to activate deliveries of these emails.
2019-04-29 15:43:46 +02:00
voodoorai2000
6f3b213612 Refactor proposal poll routes
Moving routes from custom file to the proposal's routes file.
2019-04-29 15:43:25 +02:00
voodoorai2000
34834889d8 Fix Answer's class conflict
We have two models called `Answer`: The `Answer` model and the `Poll::Answer` model.

This conflict ocurrs when trying to create a user generated poll for a proposal. from the Dashboard. In that case we are getting an exception, only in the development environment, as the class `Answer` is loaded before the class `Poll::Answer` which is the one we want to use.

With this commit we are explicitly requiring the correct model, solving the class conflict.
2019-04-29 15:43:06 +02:00
voodoorai2000
93972eeb33 Use custom url for proposal poll results 2019-04-29 15:42:27 +02:00
voodoorai2000
93ff173a0d Use a custom url for proposal polls
Before we used the standard poll url (vota/:id) for a user generated poll.

However this url is considered too important for this kind of polls, so we are changing it to a namespaced url (proposals/:proposal_id/polls/:id)
2019-04-29 15:42:04 +02:00
decabeza
99023a01c9 Fix merge conflicts 2019-04-29 14:22:22 +02:00
decabeza
51ced318e0 Merge branch 'master' into proposal-dashboard 2019-04-29 13:48:23 +02:00
Javier Martín
e13c4d8d10 Merge pull request #3460 from consul/backport-fix_remove_ballot_spec
Fix flaky spec: Ballots Groups Change my heading
2019-04-25 22:22:30 +02:00
Javier Martín
e0484e45ec Merge pull request #3459 from consul/backport-fix_cross_origin_exception
Fix InvalidCrossOriginRequest response
2019-04-25 22:01:51 +02:00
Javier Martín
95ce139e0a Merge pull request #3458 from consul/backport-fix_access_denied_exception
Handle AccessDenied in management sessions
2019-04-25 21:53:15 +02:00
Javi Martín
ca40e657fb Check page after an AJAX call removing a ballot
We were sending a new request without checking the previous one had
finished, and if it hadn't finished, the test failed.

This test started to fail after upgrading to Rails 5, since we removed
the change done in commit eda47eff which set `config.allow_concurrency`
to `false` in the test environment.

While we could re-introduce that configuration option, which might have
side effects, an easier solution is to check an AJAX request has been
completed before sending a new request depending on the previous one
seems to be a more solid option.

Note this test failed with two possible errors: "undefined method
`heading' for nil:NilClass" and "stale element reference: element is not
attached to the page document". This change fixes the second error; it
might fix the first error as well, but since I couldn't reproduce it
locally, we'll only be sure when this test stops failing in travis
builds.
2019-04-25 20:57:19 +02:00
Javi Martín
d90efa15e4 Fix InvalidCrossOriginRequest response
When requesting files like `/hackattempt.js`, the pages controller was
responding with 404 status code.

However, since the request was considered a JavaScript request (because
of the `.js` extension), the response was also considered to be a
JavaScript one, and since the request wasn't an AJAX request, our
protection from forgery was preventing a potential security issue by
raising an InvalidCrossOriginRequest exception.

By setting HTML as content type, we correctly respond with a 404 status
code.

More info:

https://die-antwort.eu/techblog/2018-08-avoid-invalid-cross-origin-request-with-catch-all-route/
2019-04-25 20:48:38 +02:00
Javi Martín
286e0ca878 Handle AccessDenied in management sessions
We were raising a `CanCan::AcessDenied` and were getting a 500 Internal
Server Error.

I've chosen to do the same thing we do in the ApplicationController.
There are other options to handle this request, like redirecting to the
login page or returning a 401 Unauthorized HTTP status.
2019-04-25 20:36:50 +02:00
Javier Martín
b33401ca0f Merge pull request #3452 from consul/backport-fix_interpolation_share_message
Update share messages interpolation variables
2019-04-25 20:13:18 +02:00
Javier Martín
488dd66806 Merge pull request #3454 from consul/fix_rails5_forgery_protection
Fix Invalid Authenticity Token with Rails 5
2019-04-25 20:12:43 +02:00
Javier Martín
b087cf4621 Merge pull request #3453 from consul/update_recent_migrations
Use Rails 5 conventions in ballot migrations
2019-04-25 20:10:47 +02:00
Juanjo Bazán
c63c06b7ec protect_from_forgery is not prepended by default
so it has to appear before devise's auth methods
2019-04-25 14:22:19 +02:00
Javi Martín
4b1cbb7db6 Use Rails 5 conventions in ballot migrations
These migrations and models were added after the Rails 5 branch was
created but before it was merged.
2019-04-24 19:24:01 +02:00
decabeza
0994ef2342 Hide request to admin button for archived proposals 2019-04-24 14:08:22 +02:00
decabeza
aa960ac50a Prevent long action content break dashboard layout 2019-04-24 14:08:15 +02:00
decabeza
0a40c747a3 Add default actions list on admin dashboard actions index 2019-04-24 14:05:05 +02:00
decabeza
7b6619528c Temporally not send dashboard's notifications 2019-04-24 14:04:45 +02:00
decabeza
f0305e36a6 Replace capistrano task restart file 2019-04-24 14:04:01 +02:00
decabeza
467d05ab98 Replace poll summary to title on social meta tags 2019-04-24 14:03:39 +02:00
decabeza
534ad75206 Downgrade autoprefixer-rails gem
We need update Node version before upgrade this gem version.
2019-04-24 14:02:46 +02:00
decabeza
b53a2f8012 Fix button text on dashboard polls form 2019-04-24 14:02:07 +02:00
decabeza
5bbf325c1f Remove copy link on dashboard polls 2019-04-24 14:01:08 +02:00
decabeza
07fd5084f7 Show request to admins and short description only for resources 2019-04-24 14:01:04 +02:00
decabeza
17d4af31ae Remove duplicated content on model poll 2019-04-24 14:00:58 +02:00
decabeza
18f0697ef7 Fix proposal dashboard settings 2019-04-24 14:00:48 +02:00
decabeza
4100bf2ddf Update dashboard specs 2019-04-24 14:00:38 +02:00
decabeza
c76b465ce8 Show message when request a resource to admins 2019-04-24 13:58:42 +02:00
decabeza
5b8fe4bb98 Add truncate to proposed action description
The show description link only appears if the description is longer than defined length.
2019-04-24 13:58:37 +02:00
decabeza
41e692737b Add expanded class to dashboard resources buttons 2019-04-24 13:58:32 +02:00
decabeza
19c158f4eb Add pending and done filters to dashboard administrator tasks 2019-04-24 13:58:27 +02:00
decabeza
b3d285573c Fix cancel action on link fields form 2019-04-24 13:58:22 +02:00
decabeza
2cff3767c1 Remove open in new tab option for links 2019-04-24 13:58:13 +02:00
decabeza
050896d1d3 Add autocomplete off to dashboard poll dates form 2019-04-24 13:57:27 +02:00
decabeza
1c705cfc63 Fix admin dashboard actions form layout 2019-04-24 13:57:22 +02:00
decabeza
f8b34f7066 Make cursor not change on has-tip css class 2019-04-24 13:57:16 +02:00
decabeza
90ca78a0bd Show actions section only if there is any action 2019-04-24 13:57:12 +02:00
decabeza
4064fea1e5 Remove button to remove image
This image still can be removed with edit button.
2019-04-24 13:57:08 +02:00
decabeza
0517ae04a6 Remove consul logo 2019-04-24 13:57:04 +02:00
decabeza
21e6e8097f Update i18n texts 2019-04-24 13:56:49 +02:00
decabeza
14d85406c3 Fix merge conflicts 2019-04-23 23:38:08 +02:00
Javi Martín
a71928ae31 Update share message interpolation variables
Having translations with the old interpolation variables was causing the
application to crash.
2019-04-23 20:06:24 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
Raimond Garcia
b230cd29ab Merge pull request #3414 from consul/upgrade_to_rails_5
Upgrade to rails 5
2019-04-23 16:26:14 +02:00
Javi Martín
4adf712c26 Prepend custom assets to CONSUL assets
Rails 5 changed the initialization order, and now our initializers were
running before the `append_assets_path` initializer for each engine,
which prepended application assets to the custom assets we prepended in
the initializer.

Moving the code to the `config.after_initialize` code didn't work
either, since the paths added there were ignored by the application.

Adding another initializer to the Rails Engine is a hack, but solves the
problem.
2019-04-17 17:40:57 +02:00
Julian Herrero
58b9899406 Require conflicting dependencies
spec/lib/tasks/dev_seed_spec.rb:8
This test was failing and we could see messages like:

db/dev_seeds/polls.rb:147:
warning: toplevel constant Answer referenced by Poll::Answer

Resulting in the error:

rake db:dev_seed seeds the database without errors
  Failure/Error: expect { run_rake_task }.not_to raise_error
    expected no Exception, got #<ActiveModel::UnknownAttributeError:
    unknown attribute 'question_id' for Answer

Apparently the lookup was not correclty being performed, due to
conflicting names.

"Naming conflicts of this kind are rare in practice, but if one
occurs, require_dependency provides a solution by ensuring that
the constant needed to trigger the heuristic is defined in the
conflicting place."

https://guides.rubyonrails.org/v5.0/autoloading_and_reloading_constants.html
2019-04-17 17:40:57 +02:00