Commit Graph

13635 Commits

Author SHA1 Message Date
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
Senén Rodero Rodríguez
97974a8bc7 Set globalize fallbacks for requests
New version of globalize uses RequestStore gem to store I18n.locale and
Globalize.fallbacks in a per request basis to avoid collissions between
different requests. This gem update broke Globalize.fallback results
because it tries to fetch fallbacks from RequestStore, where there is no
locale fallbacks definition.
2019-04-17 17:40:57 +02:00
Julian Herrero
b36fdb5604 Add lib folder path to eager_load_paths
Because autoloading is disabled in production with Rails 5,
using autoload_paths will not load needed classes from
specified paths. The solution to this, is to ask Rails
to eager load classes.

https://sipsandbits.com/2017/02/14/upgrading-a-ruby-on-rails-application/
2019-04-17 17:40:56 +02:00
Julian Herrero
c9752e94be Change the way we retrireve the images urls
For some reason the paperclip method `attachment.exists?' was
returning nil even when `attachment.url(style)' was correctly
returning the url/path of the attachment.

Therefore returning `nil' was causing to raise an error in the
method `image_tag'.

With this change we make sure we return the image url it it's
available, or an empty string if it's not, but never a null value.
2019-04-17 17:40:56 +02:00
Julian Herrero
defbb25ec5 Fix Devise deprecation warning
DEPRECATION WARNING: [Devise] `DeviseHelper.devise_error_messages!`
is deprecated and it will be removed in the next major version.
To customize the errors styles please run `rails g devise:views` and
modify the `devise/shared/error_messages` partial.

We will render the resource errors instead fo calling the deprecated method.
2019-04-17 17:40:56 +02:00
Julian Herrero
65c30c8d2d Remove migrations warning
DEPRECATION WARNING: Directly inheriting from ActiveRecord::Migration
is deprecated. Please specify the Rails release the migration was
written for:

class MigrationClass < ActiveRecord::Migration[4.2]

(called from require at bin/rails:4)
2019-04-17 17:40:56 +02:00
Julian Herrero
5486835661 Regenerate DB schema 2019-04-17 17:40:56 +02:00
Angel Perez
385784d09d Fix failing migrations when running rake db:migrate task
This patch adds 2 missing colons (:) for 2 migrations that are failing when
the `rake db:migrate` task is ran. Whilst already-committed-to-source-control-
and-ran-on-production-environments migrations shouldn't be modified whatsoever,
this change does not modify in any way the current database schema so, technically,
it shouldn't affect forks that might have ran these migrations already and those
CONSUL installations that haven't done so should be able to without problems
2019-04-17 17:40:56 +02:00
Julian Herrero
9f97b87304 Upgrade gem devise to version 4.6.2
There was a security vulnerability with previous version

https://github.com/plataformatec/devise/issues/4981
2019-04-17 17:40:56 +02:00
Julian Herrero
6e88031537 Fix several rubocop warnings
Metrics/LineLength: Line is too long.
RSpec/InstanceVariable: Use let instead of an instance variable.
Layout/TrailingBlankLines: Final newline missing.
Style/StringLiterals: Prefer double-quoted strings.
2019-04-17 17:40:56 +02:00
Julian Herrero
83e129d5b7 Fix failing tests
If tests run very fast all votes are created within the last 24
hours, so hot_score has the same value if the creation date for the
votes is Time.current or 1.day.ago.

Creating the votes 48 hours ago we make sure hot_score has the
correct value and the tests pass correctly.
2019-04-17 17:40:56 +02:00
Julian Herrero
4b57c3d8eb Replace occurrences of ActiveRecord::Base on new models 2019-04-17 17:40:56 +02:00
Angel Perez
129411864e Replace occurrences of ActiveRecord::Base on new models 2019-04-17 17:40:56 +02:00
Angel Perez
26b213c186 Use Legislation::BaseController on instead of ApplicationController 2019-04-17 17:40:56 +02:00
Angel Perez
01c1ac2b10 Replace all occurrences of ActiveRecord::Base with ApplicationRecord 2019-04-17 17:40:56 +02:00