Commit Graph

19791 Commits

Author SHA1 Message Date
Sebastia
5251fbadd9 Merge pull request #5698 from consuldemocracy/dependabot/bundler/omniauth-google-oauth2-1.2.0
Bump omniauth-google-oauth2 from 1.1.1 to 1.2.0
2024-10-24 15:13:56 +02:00
dependabot[bot]
1b0b03d52f Bump omniauth-google-oauth2 from 1.1.1 to 1.2.0
Bumps [omniauth-google-oauth2](https://github.com/zquestz/omniauth-google-oauth2) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/zquestz/omniauth-google-oauth2/releases)
- [Changelog](https://github.com/zquestz/omniauth-google-oauth2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zquestz/omniauth-google-oauth2/compare/v1.1.1...v1.2.0)

---
updated-dependencies:
- dependency-name: omniauth-google-oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-24 12:49:35 +00:00
Sebastia
389e2c410e Merge pull request #5567 from consuldemocracy/dependabot/bundler/omniauth-rails_csrf_protection-1.0.2
Bump omniauth-rails_csrf_protection from 1.0.1 to 1.0.2
2024-10-24 14:47:36 +02:00
Sebastia
b299e3a2d6 Merge pull request #5524 from consuldemocracy/dependabot/npm_and_yarn/blueimp-file-upload-10.32.0
Bump blueimp-file-upload from 9.34.0 to 10.32.0
2024-10-24 14:47:20 +02:00
Javi Martín
126e7bb2a9 Merge pull request #5754 from consuldemocracy/wait_for_suggestions
Wait for suggestions in multitenancy and document tests
2024-10-24 11:49:37 +02:00
dependabot[bot]
5b7cceba75 Bump blueimp-file-upload from 9.34.0 to 10.32.0
Dependabot couldn't find the original pull request head commit, d43fa0a66e16638f88de33f362c21d50f527c219.
2024-10-24 07:08:00 +00:00
Javi Martín
9da582cb91 Wait for suggestions in multitenancy and document tests
In commit f638e5017 we introduced some methods to avoid race conditions
in tests that created debates, proposals or investments.

However, since we don't have a way to effectively make sure we use these
methods in new code, we forgot to do so when adding tests in commits
c483c6036 and 84b88c0ec.

So we're using them now.

There's a chance that this is what was causing multitenancy tests to
fail sometimes; if we don't wait for the request to get the suggestions
to finish, the application might still be dealing with this request when
we make another request to a different subdomain, or when the test has
finished and the tenant has already been deleted.

On my machine, the test "Creating content in one tenant doesn't affect
other tenants" failed about 5% of the time without these changes, and I
haven't been able to reproduce this failure after applying them. Having
said that, it's possible that this is a coincidence and that this test
will fail for a different reason in the future (like `login_as` not
working properly with subdomains).
2024-10-23 21:04:06 +02:00
Javi Martín
ea3f3225de Merge pull request #5552 from consuldemocracy/dependabot/bundler/omniauth-facebook-10.0.0
Bump omniauth-facebook from 9.0.0 to 10.0.0
2024-10-23 19:05:22 +02:00
dependabot[bot]
4baa95318f Bump omniauth-facebook from 9.0.0 to 10.0.0
Bumps [omniauth-facebook](https://github.com/simi/omniauth-facebook) from 9.0.0 to 10.0.0.
- [Release notes](https://github.com/simi/omniauth-facebook/releases)
- [Changelog](https://github.com/simi/omniauth-facebook/blob/master/CHANGELOG.md)
- [Commits](https://github.com/simi/omniauth-facebook/commits)

---
updated-dependencies:
- dependency-name: omniauth-facebook
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-23 14:05:32 +00:00
dependabot[bot]
93cfb67d15 Bump omniauth-rails_csrf_protection from 1.0.1 to 1.0.2
Bumps [omniauth-rails_csrf_protection](https://github.com/cookpad/omniauth-rails_csrf_protection) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/cookpad/omniauth-rails_csrf_protection/releases)
- [Commits](https://github.com/cookpad/omniauth-rails_csrf_protection/compare/v1.0.1...v1.0.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-23 12:43:27 +02:00
taitus
41f1243379 Bump graphql from 1.13.22 to 2.0.31 2024-10-17 17:18:15 +02:00
Sebastia
0cc6de088e Merge pull request #5743 from consuldemocracy/release_2.2.2
Release version 2.2.2
2024-10-15 16:41:16 +02:00
taitus
64e9d28479 Release version 2.2.2 2024-10-15 16:11:09 +02:00
Javi Martín
a3bdf04a4c Merge pull request #5747 from consuldemocracy/disable_turbolinks_previews_in_tests
Make sure requests finish in ballots back link tests
2024-10-15 16:10:59 +02:00
Javi Martín
27a4dc1471 Check page content in ballots specs
Even after disabling the turbolinks previews in the previous commit
(which is still necessary, even with the changes in this commit), these
tests were still finishing before the "Go back" requests did. To
reproduce an issue caused by this behavior, run:

```
rspec spec/system/budgets/ballots_spec.rb:425 spec/system/users_auth_spec.rb:701 --seed 40358
```

Apparently, a `have_current_path` expectation isn't enough to check that
the request has finished and it only checks that the request to that
path has started or it's being processed.

Adding an additional expectation to check that the content of the page
has changed solves the issue.
2024-10-15 15:55:15 +02:00
Javi Martín
b870e29170 Disable turbolinks previews in the test environment
When clicking the browser's back button, browsers usually don't reload
the page but show a cached version of the page.

Turbolinks takes this one step further. When clicking on a link to a
page that's already cached, turbolinks displays the cached version of
the page and then it reloads it.

I don't really like this behavior but, since it affects the whole
application and we're about to release a patch version :), for now we're
keeping it this way in the development and production environments.

In the test environment, however, we're disabling these previews because
they might lead to requests leaking between tests.

For example, a test that visits the investments index, then goes to
"check my votes", then clicks on "Go back" and finishes by checking some
content on this page will result in those checks being done against the
cached version of the page. If these checks pass before turbolinks
reloads the page, the "Go back" request will finish during the test that
runs immediately after this one, resulting in unpredictable results.

Disabling the previews solves the issue.
2024-10-15 14:44:26 +02:00
Javi Martín
62d2f9e180 Merge pull request #5742 from consuldemocracy/legislation-proposals-videos
Fix crash in legislation proposals with videos
2024-10-15 10:34:29 +02:00
taitus
93189d3ecd Allow use embedded_video_component in legislation proposals
Since the PR "Do not use third-party cookies in embedded videos #5548", the logic from
"embed_videos_helper" was extracted to the "embedded_video_component" and the
"videoable" model concern.

However, during this refactor, the "regex" method, which uses record.class:: to handle
video embeds, was left inaccessible for Legislation Proposals.

This commit fixes the issue by including the concern in the Legislation Proposal model.
2024-10-14 15:24:29 +02:00
Javi Martín
53688863cd Merge pull request #5741 from consuldemocracy/ubuntu-24.04-github-actions
Make github actions workflows compatible with Ubuntu 24.04
2024-10-14 14:36:53 +02:00
Javi Martín
1e6ff7838f Merge pull request #5738 from consuldemocracy/dashboard_factories
Fix default dashboard actions factories
2024-10-14 14:14:53 +02:00
Javi Martín
13481fdf32 Use Ubuntu 24.04 in our workflows
This is what github actions currently uses when using ubuntu-latest, and
what we recommend for new Consul Democracy installations.
2024-10-14 14:02:28 +02:00
Javi Martín
26ebe619e3 Use a specific version of Ubuntu in workflows
Using ubuntu-latest might result in incompatibilities when this image
changes to a different version of Ubuntu. For example, the Ubuntu 24.04
image no longer includes imagemagick, meaning that we'll have to install
it manually when using Ubuntu 24.04.
2024-10-14 13:47:30 +02:00
Sebastia
6876441eaa Merge pull request #5627 from consuldemocracy/dependabot/bundler/savon-2.15.1
Bump savon from 2.15.0 to 2.15.1
2024-10-14 09:28:27 +02:00
Javi Martín
e2d9d0f2b4 Fix default dashboard actions factories
We had a trait called `:admin_request` for actions that are requests to
administrators, but the default factories were also requests to
administrators.

The tests checking that the "Request" button is not present, which
shouldn't pass with the wrong default factories, were passing by
coincidence. The issue was that we weren't checking whether that the
request had finished before checking that the "Request" button wasn't
present. That meant that we were checking that the "Request" button
wasn't there right at the moment we pressed the link, before the request
was finished.

So we're now checking that the request is finished before checking that
the button isn't there.

On the other hand, the tests checking for the "Request resource" link
being present were checking a behavior that's no longer there since
commit 9d85b3935, when we changed the conditions affecting that link.
2024-10-11 15:05:24 +02:00
Sebastia
d3a039040c Merge pull request #5722 from consuldemocracy/dependabot/bundler/rubocop-rails-2.26.2
Bump rubocop-rails from 2.25.1 to 2.26.2
2024-10-10 15:03:08 +02:00
Sebastia
c529fec80f Merge pull request #5705 from consuldemocracy/dependabot/bundler/rubocop-1.66.1
Bump rubocop from 1.64.1 to 1.66.1
2024-10-10 15:01:56 +02:00
Sebastia
a51bf2fa48 Merge pull request #5716 from consuldemocracy/dependabot/bundler/exiftool_vendored-12.97.0
Bump exiftool_vendored from 12.80.0 to 12.97.0
2024-10-10 15:01:14 +02:00
Sebastia
7015e9e070 Merge pull request #5735 from consuldemocracy/dependabot/bundler/groupdate-6.5.1
Bump groupdate from 6.4.0 to 6.5.1
2024-10-10 15:00:53 +02:00
dependabot[bot]
79f474ddbf Bump savon from 2.15.0 to 2.15.1
Bumps [savon](https://github.com/savonrb/savon) from 2.15.0 to 2.15.1.
- [Release notes](https://github.com/savonrb/savon/releases)
- [Changelog](https://github.com/savonrb/savon/blob/main/CHANGELOG.md)
- [Commits](https://github.com/savonrb/savon/compare/v2.15.0...v2.15.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 08:27:46 +00:00
taitus
29df39b2fa Add an apply Rails/CompactBlank rubocop rule
In rubocop-rails 2.26.0, the Rails/CompactBlank rule was modified to handle
cases where select(&:present?) is used. After identifying three occurrences
in our code, we've decided to apply this rule as it encourages the use of the
more efficient and clearer method, compact_blank.

By using compact_blank, we improve code clarity and performance, as this method performs the same operation but in a more optimized way.
2024-10-10 10:02:22 +02:00
taitus
c50452aec6 Add and apply Rails/EnumHash rubocop rule
In rubocop-rails 2.26.0, support was added for Rails 7 syntax in the
Rails/EnumHash rule. We took this opportunity to ensure consistency
by converting all enums to hash with integer values. This format minimizes
the risk of data consistency issues in the database when adding new values.
2024-10-10 09:56:44 +02:00
taitus
3d4f78a424 Add an apply Rails/EnumSyntax rubocop rule
This rule was added in rubocop-rails 2.26.0. Applying it allows
us to anticipate the deprecation of the current enum syntax
using keyword arguments, which is set to be removed in Rails
8.0, as mentioned in the rule's own documentation:

https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsenumsyntax
2024-10-10 09:55:48 +02:00
dependabot[bot]
9283b8b422 Bump rubocop-rails from 2.25.1 to 2.26.2
Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.25.1 to 2.26.2.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.25.1...v2.26.2)

---
updated-dependencies:
- dependency-name: rubocop-rails
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 09:55:44 +02:00
taitus
4dcac5bed5 Add and apply Naming/RescuedExceptionsVariableName rubocop rule
This rule was introduced in RuboCop 0.67.2, but now after seeing a fix in version 1.65.1,
we have decided to add it. The reason for adding it is to ensure consistency in how we
reference exceptions throughout the project, by following a standard naming convention
for exception variables.
2024-10-10 09:47:47 +02:00
taitus
6b15a073a2 Add and apply Style/RedundantRegexpArgument RuboCop rule
This rule was introduced in RuboCop 1.53.0. After adding the
Style/RedundantRegexpCharacterClass rule in the previous commit,
RuboCop started detecting redundant regular expression arguments.
Therefore, we apply this rule to remove them and prevent future
occurrences.
2024-10-10 09:47:47 +02:00
Sebastia
4382861cd5 Merge pull request #5717 from consuldemocracy/dependabot/bundler/rubocop-rspec-3.1.0
Bump rubocop-rspec from 3.0.3 to 3.1.0
2024-10-10 09:23:41 +02:00
dependabot[bot]
edee2afc1e Bump exiftool_vendored from 12.80.0 to 12.97.0
Bumps [exiftool_vendored](https://github.com/exiftool-rb/exiftool_vendored.rb) from 12.80.0 to 12.97.0.
- [Commits](https://github.com/exiftool-rb/exiftool_vendored.rb/compare/v12.80.0...v12.97.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-09 13:15:39 +00:00
dependabot[bot]
c8eda160d4 Bump groupdate from 6.4.0 to 6.5.1
Bumps [groupdate](https://github.com/ankane/groupdate) from 6.4.0 to 6.5.1.
- [Changelog](https://github.com/ankane/groupdate/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ankane/groupdate/compare/v6.4.0...v6.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-09 10:25:44 +00:00
taitus
d94eed8628 Add and apply Style/RedundantRegexpCharacterClass rubocop rule
This rule was introduced in RuboCop 0.93.0, but now after seeing a fix in version 1.65,
we have decided to add it. The reason for adding it is to simplify our regular
expressions. This enforcement will help us maintain better regular expression
practices across the project.
2024-10-09 09:33:35 +02:00
taitus
9300fe5a58 Add an apply RSpec/StringAsInstanceDoubleConstant rubocop rule
This rule was added in 3.1.0. Applying it allows you to start defining a way of doing
this in the project, helping to maintain consistency.
2024-10-08 18:43:07 +02:00
dependabot[bot]
0b9aeedbcc Bump rubocop from 1.64.1 to 1.66.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.64.1 to 1.66.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.64.1...v1.66.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-08 16:29:52 +00:00
Sebastia
2158644ca7 Merge pull request #5719 from consuldemocracy/dependabot/bundler/rubocop-performance-1.22.1
Bump rubocop-performance from 1.21.1 to 1.22.1
2024-10-08 18:28:40 +02:00
dependabot[bot]
a679bb8bf3 Bump rubocop-performance from 1.21.1 to 1.22.1
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.21.1 to 1.22.1.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.21.1...v1.22.1)

---
updated-dependencies:
- dependency-name: rubocop-performance
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-08 17:54:04 +02:00
Javi Martín
349cdbfebe Merge pull request #5731 from consuldemocracy/video_url_warning
Fix warning in hidden proposals spec
2024-10-07 16:51:12 +02:00
Javi Martín
af0911a8d2 Fix warning in hidden proposals spec
We were checking the proposal video URL, but its value was `nil` since
commit bedcb5bca2. This resulted in a warning:

```
Checking for expected text of nil is confusing and/or pointless since it
will always match. Please specify a string or regexp instead.
spec/system/admin/hidden_proposals_spec.rb:14
```
2024-10-07 16:37:13 +02:00
Javi Martín
aa5c244414 Merge pull request #5530 from consuldemocracy/unify_database_config_files
Unify database configuration files
2024-10-07 15:44:45 +02:00
Javi Martín
170530e52e Unify database configuration files
We had three files that were almost identical, and we can use
environment variables to specify the differences.

Note we're using the `PGUSER` and `PGPASSWORD` variables, since these
variables will automatically be used by the PostgreSQL client when we
have a blank `username` and `password` keys in the `database.yml` file
(which we did until now). The difference between these variables and the
`POSTGRES_USER` and `POSTGRES_PASSWORD` variables is that the `PG`
variables are used by the client connecting to the database, while the
`POSTGRES_` variables are used by the Docker postgresql image when
creating the database superuser.

For consistency with the code in our github workflows (and everywhere
else in the postgres world), we're respecting this double standard. The
fact that there are two different names for what's basically the same
thing makes the code confusing, though, particularly when running the
docker-compose commands, since we get the password from an environment
variable but we have to assign two different environment variables with
it.

So we're accepting both `PGPASSWORD` and `POSTGRES_PASSWORD` variables
in the database configuration file. This way, developers using
docker-compose can use `POSTGRES_PASSWORD` for everything and it'll work
fine. We're also making `PGPASSWORD` default to `POSTGRES_PASSWORD` so
we don't get a warning if we only set `POSTGRES_PASSWORD`:

```
WARN[0000] The "PGPASSWORD" variable is not set. Defaulting to a blank
string.
```

Also note we're using `DB_HOST` instead of `PGHOST` because that's the
variable Rails currently uses by default for new applications [1].

Finally, note we're using `.presence` in the `ENV` calls in the
database.yml file. The `PGPASSWORD` variable was set to an empty string
when running docker-compose, so using `ENV["PGPASSWORD"] ||` wouldn't
work.

[1] https://github.com/rails/rails/blob/c90a8701e5/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt#L22
2024-10-07 15:23:40 +02:00
Javi Martín
58bdd8b31c Merge pull request #5657 from consuldemocracy/dependabot/bundler/paranoia-3.0.0
Bump paranoia from 2.6.3 to 3.0.0
2024-10-06 03:18:51 +02:00
Javi Martín
1781b9bee2 Merge pull request #5520 from consuldemocracy/dependabot/npm_and_yarn/jquery-ui-1.13.3
Bump jquery-ui from 1.13.2 to 1.13.3
2024-10-06 03:05:18 +02:00
dependabot[bot]
8c217e8158 Bump paranoia from 2.6.3 to 3.0.0
Bumps [paranoia](https://github.com/rubysherpas/paranoia) from 2.6.3 to 3.0.0.
- [Release notes](https://github.com/rubysherpas/paranoia/releases)
- [Changelog](https://github.com/rubysherpas/paranoia/blob/core/CHANGELOG.md)
- [Commits](https://github.com/rubysherpas/paranoia/compare/v2.6.3...v3.0.0)

---
updated-dependencies:
- dependency-name: paranoia
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-06 00:56:57 +00:00