Commit Graph

18405 Commits

Author SHA1 Message Date
Javi Martín
edcef9e8a8 Merge pull request #5270 from consuldemocracy/dependabot/bundler/view_component-3.6.0
Bump view_component from 3.5.0 to 3.6.0
2023-10-03 20:34:30 +02:00
dependabot[bot]
eb04ec1bf9 Bump view_component from 3.5.0 to 3.6.0
Bumps [view_component](https://github.com/viewcomponent/view_component) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/viewcomponent/view_component/releases)
- [Changelog](https://github.com/ViewComponent/view_component/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/viewcomponent/view_component/compare/v3.5.0...v3.6.0)

---
updated-dependencies:
- dependency-name: view_component
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 17:54:46 +00:00
Javi Martín
8cc772f187 Merge pull request #5261 from consuldemocracy/dependabot/bundler/dalli-3.2.6
Bump dalli from 3.2.5 to 3.2.6
2023-10-03 19:53:17 +02:00
dependabot[bot]
5f9295db18 Bump dalli from 3.2.5 to 3.2.6
Bumps [dalli](https://github.com/petergoldstein/dalli) from 3.2.5 to 3.2.6.
- [Changelog](https://github.com/petergoldstein/dalli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/petergoldstein/dalli/compare/v3.2.5...v3.2.6)

---
updated-dependencies:
- dependency-name: dalli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 17:31:14 +00:00
Javi Martín
a4441422f2 Merge pull request #5260 from consuldemocracy/dependabot/bundler/selenium-webdriver-4.13.1
Bump selenium-webdriver from 4.12.0 to 4.13.1
2023-10-03 19:15:27 +02:00
Sebastia
2e335df2f3 Merge pull request #5250 from consuldemocracy/content-block
Add new content block `footer_legal` to Footer
2023-10-03 14:03:50 +02:00
dependabot[bot]
7a587e2c12 Bump selenium-webdriver from 4.12.0 to 4.13.1
Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 4.12.0 to 4.13.1.
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
- [Commits](https://github.com/SeleniumHQ/selenium/commits)

---
updated-dependencies:
- dependency-name: selenium-webdriver
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 22:04:37 +00:00
Javi Martín
0e696331b1 Merge pull request #5258 from consuldemocracy/fix_knapsack
Update bash script to run Knapsack Pro
2023-09-29 17:30:23 +02:00
Javi Martín
54cefb918e Update bash script to run Knapsack Pro
We made a few experiments with forked repositeries after applying commit
dc1e0209a and everything seems to work fine, but it looks like that
isn't the case. For instance, on pull requests opened by external
contributors, the tests aren't running.

The fix we're applying is mentioned on the Knapsack Pro repository [1]
(pull request 197).

[1] https://github.com/KnapsackPro/knapsack_pro-ruby
2023-09-29 16:10:25 +02:00
Javi Martín
a7136f71db Merge pull request #5251 from dnsos/intuitive-admin-menu-sections
Move customizations to more intuitive admin menu section
2023-09-29 14:48:47 +02:00
Dennis Ostendorf
b1bc068cb9 Remove unnecessary admin menu condition
Previously the condition was needed because _without it_ the Admin::Poll::Questions::Answers::ImagesController would have resulted in settings? evaluating to true. This was undesired because that controller was scoped under Polls, so only polls? should have evaluated to true. Now that we have moved the images link to the customization menu, this check is not necessary anymore.
2023-09-29 14:18:28 +02:00
Dennis Ostendorf
a902f9e11f Move customizations to more intuitive admin menu section
There were already some menu items to customization pages under the "Site content" menu. It therefore makes sense to move "Custom images" and "Custom content blocks" (which were previously
located under "Settings") to "Site content" as well.
2023-09-28 19:49:49 +02:00
taitus
c2f03f869a Add new footer content block
Include a new content block called 'footer_legal' for additional legal footer items.
2023-09-26 17:43:20 +02:00
Javi Martín
5e483f6d33 Merge pull request #5242 from consuldemocracy/go_back_test
Don't depend on the "Help" link in tests
2023-09-25 13:45:50 +02:00
Senén Rodero
d28ed1d17b Merge pull request #5232 from consuldemocracy/custom_concerns
Make model concerns customization easier
2023-09-18 15:48:05 +02:00
taitus
75c9b66375 Refactor footer legal links for cleaner code
Removed inline '&nbsp;|' used as a separator between footer legal links.
2023-09-14 09:51:51 +02:00
Javi Martín
b050bf39bd Add missing expectation in draft versions test
Without this expectation, the test was freezing sometimes.
2023-09-13 23:32:25 +02:00
Javi Martín
9a1dd9992a Don't depend on the "Help" link in tests
In order to leave the page using turbolinks and then going back, we were
clicking on the "Help" page link, but this link doesn't have to be
available on every Consul Democracy installation.

So we're using the link to the homepage instead.
2023-09-13 23:32:25 +02:00
Javi Martín
aa7262a1b8 Merge pull request #5235 from consuldemocracy/dependabot_interval
Update gem dependencies once a month
2023-09-13 16:15:33 +02:00
Javi Martín
40e920844b Update gem dependencies once a month
We originally set a daily interval because we hadn't updated our gem
dependencies for a year.

However, we usually wait a few days/weeks between the time a gem is
released and the moment we update it, and there are gems releasing new
versions every few days, so maintaining daily updates would become
tedious quickly.

So we're now doing it once a month. We're also increasing the limit of
open pull requests so we don't need to worry about whether dependabot is
opening pull requests for every dependency.
2023-09-12 16:20:49 +02:00
Javi Martín
cd7cec79f4 Merge pull request #5157 from consuldemocracy/ruby3.1
Upgrade Ruby to version 3.1.4
2023-09-12 16:20:16 +02:00
Javi Martín
dcb6450b23 Remove no longer needed --keep-file-descriptors option
We added this option in commit d17b2523c, but Bundler now keeps
descriptors by default. While this behavior was backported to Ruby
3.0.x, we're changing it now because, we've only noticed it now that
we're upgrading to Ruby 3.1.x, since it was first developed for that
version [1].

[1] https://github.com/rubygems/rubygems/pull/4812/commits/88b7a3e7e2
2023-09-12 15:21:47 +02:00
Javi Martín
584176adfa Add and apply Style/ArrayIntersect rubocop rule
The `intersect?` method has been added in Ruby 3.1, and it's more
readable than `(a & b).any?`.
2023-09-12 15:19:04 +02:00
Javi Martín
f87d4b589d Add and apply Naming/BlockForwarding rubocop rule
This syntax has been added in Ruby 3.1.

Not using a variable name might not be very descriptive, but it's just
as descriptive as using "block" as a variable name. Using just `&` we
get the same amount of information than using `&block`: that we're
passing a block.

We're still using `&action` in `around_action` methods because here we
aren't using a generic name for the variable, so (at least for now) we
aren't running this cop on controllers using `around_action`.
2023-09-12 15:17:28 +02:00
Javi Martín
fd9169e0d6 Update Style/HashSyntax Rubocop rule
Ruby 3.1 adds the option for hash shortcuts, so it's possible to write
`{ user: , poll: }` instead of `{ user: user, poll: poll }`.

By default, Rubocop expects the new syntax in Ruby 3.1. While right now
I absolutely hate this new syntax, we're allowing both the old and the
new styles because we might start adopting it once we get used to it.
2023-09-12 15:17:17 +02:00
Javi Martín
e74eff217b Upgrade Ruby to version 3.1.4
Note we updated the `mail` gem in commit 103742847, which is necesary
for Ruby 3.1 because it adds the net-smtp dependency. The net-smtp
library was removed from Ruby in Ruby 3.1, and if we don't include it,
we get an error:

```
cannot load such file -- net/smtp (LoadError)
```

We're also updating the Bundler version in the Gemfile.lock so it's the
one included in Ruby 3.1. Without updating it, we get a warning:

```
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)'
has been deprecated. Please call `DidYouMean.correct_error(error_nam e,
spell_checker)' instead.
```

Finally, in order to make Capistrano work, we need to add a couple more
changes:

* Make the net-ssh gem compatible with SSL 3.0; done in commit b2eec088b
* Explicitly allow aliases in the `deploy-secrets.yml` file because
  Psych 4.x (included in Ruby 3.1) doesn't load aliases without this
  option
2023-09-12 15:17:17 +02:00
Javi Martín
bf96136ccf Merge pull request #5151 from consuldemocracy/rails_6.1
Upgrade to Rails 6.1
2023-09-12 14:48:08 +02:00
Javi Martín
3527398db1 Remove no longer needed call to default_scoped
Automatically using `default_scoped` in this context is the default
behavior in Rails 6.1.
2023-09-11 23:40:37 +02:00
Javi Martín
08b12a78ff Directly delete the "organization is invalid" error
We were getting a warning since upgrading to Rails 6.1:

DEPRECATION WARNING: Calling `delete` to an ActiveModel::Errors messages
hash is deprecated. Please call `ActiveModel::Errors#delete` instead.

So we're deleting the error instead of deleting the message.
2023-09-11 23:40:37 +02:00
Javi Martín
f03ea9d817 Don't include extensions when rendering templates
We were getting a deprecation warning:

DEPRECATION WARNING: Rendering actions with '.' in the name is
deprecated: welcome/_recommended_carousel.html.erb
2023-09-11 23:40:37 +02:00
Javi Martín
b2c8fee059 Ignore dots in slugs when rendering custom pages
We were getting a warning in one of the tests:

DEPRECATION WARNING: Rendering actions with '.' in the name is
deprecated: application/nonExistentJavaScript.js

I haven't found a case where the behavior on production environments is
different due to this change; the application seems to behave the same
way as it used to. So I'm not adding tests for this change.
2023-09-11 23:40:37 +02:00
Javi Martín
633ccf80f6 Use Rails 6.1 defaults and overwrite them
We can remove the `new_framework_defaults_6_1` file by using Rails 6.1
default options and overwriting the one we haven't enabled.

We've experienced problems while running the tests (probably the same
would happen on production) when enabling the `has_many_inversing`
option. For example, after creating a legislation answer for a question
with no answers, calling `question.answers_count` would then return `2`
instead of `1`.

So we aren't enabling this option.
2023-09-11 23:40:37 +02:00
Javi Martín
b4da795f79 Preload CSS and JavaScript files
This is the default setting in Rails 6.1, and generates an extra tag in
the HTML which tells the browser to download and cache these files as
soon as possible, even before they're needed.

This might not be that relevant in our application, since on most pages
we only generate one CSS and one JS file. But it might make it easier to
move the `javascript_include_tag` statement to the bottom of the page in
the future if we detect that doing so increases performance.
2023-09-11 23:40:37 +02:00
Javi Martín
4984ac44d3 Use the default job queue to deliver emails
This is the default in Rails 6.1 for Action Mailer, just like it's the
default for Active Storage.
2023-09-11 23:40:37 +02:00
Javi Martín
50dc9dee69 Disable legacy database connection handling
Since we aren't using the old way to handle multiple databases (because
we don't use multiple databases), we can safely enable this option
without breaking anything.
2023-09-11 23:40:37 +02:00
Javi Martín
fe94d84e81 Use 308 as SSL default redirect status
This way user agents will know that the redirection from HTTP to HTTPS
is permanent and not temporary, which is the case if we activate the
`force_ssl` option (which we do by default).
2023-09-11 23:40:37 +02:00
Javi Martín
05eecaf46c Return UTC offests in the utc_to_local method
We don't use this method anywhere, so we might use the new default in
Rails 6.1, which was added when Rails started using tzinfo 2.
2023-09-11 23:40:37 +02:00
Javi Martín
4fe9d4cbcf Use URL-safe CSRF tokens and SameSite in cookies
These measures increase protection against CSRF ataks. The only reason
Rails provides them as a configuration option is there are complex
applications that run one version of the code in some servers while
running an old version of the code in other servers might run into
issues because the the old version won't handle the tokens or cookies
generated by the new version.

Since most Consul applications use just one server and the ones with
more servers would only face this issue for a few seconds (while
upgrading to a new version of Consul Democracy), we can safely enable
these configuration options.
2023-09-11 23:40:37 +02:00
Javi Martín
e8c8b00e94 Skip after callbacks if terminated in active job
Not sure this configuration option does anything, though, since it's
been removed in Rails 7.0 because it was not halting the callbacks.

But, if it does nothing, it's the same as disabling it, which is what we
were doing until now, so in the end using the Rails 6.1 default value
does no harm.
2023-09-11 23:40:37 +02:00
Javi Martín
8a6b9dcb46 Delete action mailbox options since we don't use it
Simply uncommeting them raised an exception.
2023-09-11 23:40:37 +02:00
Javi Martín
8e2b7e231f Configure "retry jitter" option in active job
This way, when several jobs fail at the same time, not all of them will
be retried at the same time.
2023-09-11 23:40:37 +02:00
Javi Martín
600bc793a1 Store Active Storage variants in the database
This mostly benefit people using external services, as now there's no
need to query the service to check whether a variant exists.

For most Consul Democracy installations, this will probably not be
relevant, so we're sticking wih the default value.
2023-09-11 23:40:37 +02:00
Javi Martín
1f67318f84 Delete configuration options that are now redundant
These options are the default options in Rails 6.1, so we no longer need
to customize them.
2023-09-11 23:40:37 +02:00
Javi Martín
13eebe4d7a Remove Wicked PDF monkey patch
This patch was added in commit baefc249f because both ViewComponent and
Wicked PDF monkey-patched the `render` method and so they were
incompatible.

However, Rails 6.1 includes the patch used by ViewComponent, meaning
ViewComponent doesn't monkey-patch the `render` method anymore, and so
it's compatible with Wicked PDF.
2023-09-11 23:40:37 +02:00
Javi Martín
6e9df3be5a Upgrade to Rails 6.1
Note that `Capybara.app_host` now returns `nil` by default and that
breaks tests using `lvh.me` or our custom `app_host` method, so we're
setting `Capybara.app_host` to the value it had in earlier versions of
Rails. I also haven't found a way to remove the code to set the
integration session host in relationable tests which I mentioned in
commit ffc14e499.

Also note that we now filter more parameters, and that they match
regular expressions, so filtering `:passw` means we're filtering
`passwd`, `password`, ...
2023-09-11 23:40:37 +02:00
Javi Martín
6f1e845fbb Move time zone option to its right place
It is supposed to be set in the place where there's a comment related to
it, but we were setting it in another section of the configuration file.
2023-09-11 23:40:37 +02:00
Javi Martín
f329537adc Merge pull request #5233 from consuldemocracy/dependabot/bundler/sprockets-4.2.1
Bump sprockets from 4.2.0 to 4.2.1
2023-09-11 20:31:38 +02:00
dependabot[bot]
0dae07123a Bump sprockets from 4.2.0 to 4.2.1
Bumps [sprockets](https://github.com/rails/sprockets) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/rails/sprockets/releases)
- [Changelog](https://github.com/rails/sprockets/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rails/sprockets/compare/v4.2.0...v4.2.1)

---
updated-dependencies:
- dependency-name: sprockets
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 17:33:09 +00:00
Javi Martín
bf5be5cd92 Merge pull request #5234 from consuldemocracy/dependabot/bundler/web-console-4.2.1
Bump web-console from 4.2.0 to 4.2.1
2023-09-11 17:53:16 +02:00
Javi Martín
f05785a8f8 Merge pull request #5152 from consuldemocracy/remove_ie8_warning
Remove alert for Internet Explorer 8 and below
2023-09-11 16:36:35 +02:00