Commit Graph

20436 Commits

Author SHA1 Message Date
Javi Martín
04ccbea04e Split budget executions test
This way we avoid consecutive calls to `visit` to the same page.
2025-03-26 16:27:07 +01:00
Javi Martín
7870952dff Remove duplicate expectations in executions test
We were checking the same thing twice.
2025-03-26 16:27:07 +01:00
Javi Martín
bdc53ffe02 Remove unneeded consecutive calls to visit
This way we're 100% sure we won't have simultaneous requests which could
cause flaky tests. Besides that, we make these tests slightly faster.
2025-03-26 16:27:07 +01:00
dependabot[bot]
29ea8b9857 Bump nokogiri from 1.18.3 to 1.18.4
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.3 to 1.18.4.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.3...v1.18.4)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-26 15:15:28 +00:00
Sebastia
f06bf6b967 Merge pull request #5926 from consuldemocracy/fix-ci-tests
Use old Chrome in CI tests
2025-03-26 15:11:57 +00:00
taitus
772dc50ee4 Use old Chrome in CI tests
Our tests are failing fairly consistently on CI. We
believe that this started when the most recent Github Actions
ubuntu-latest image was released[1]. Though, we don't 100% understand
why. There's some speculation[2] that the root of the issue has
something to do with Chrome/Chromedriver version 134 (which is the
version bundled with that new ubuntu-latest).

[1]: https://github.com/actions/runner-images PR#11761
[2]: https://github.com/teamcapybara/capybara Issue#2800

We've largely copied what the signon team did to get
their CI back up-and-running[^3].

[^3]: https://github.com/alphagov/signon PR#3663

In this commit we remove the version of Chrome that the
actions/runner-images image bundles for us, so that Selenium
doesn't try to use it and install an old version of Chrome and
Chromedriver.
2025-03-19 09:50:52 +01:00
Javi Martín
8d0bf87a75 Merge pull request #5905 from consuldemocracy/dependabot/bundler/graphql-2.4.11
Bump graphql from 2.3.18 to 2.4.11
2025-03-17 16:00:24 +01:00
Javi Martín
9fa416738b Merge pull request #5918 from consuldemocracy/dependabot/bundler/rack-2.2.13
Bump rack from 2.2.12 to 2.2.13
2025-03-11 12:24:27 +01:00
dependabot[bot]
25f23a8c54 Bump rack from 2.2.12 to 2.2.13
Bumps [rack](https://github.com/rack/rack) from 2.2.12 to 2.2.13.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v2.2.12...v2.2.13)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-11 02:44:24 +00:00
Javi Martín
fe1a9c65ae Merge pull request #5889 from consuldemocracy/exclude_es_in_crowdin
Don't update Spanish in Crowdin
2025-03-10 13:23:32 +01:00
Javi Martín
27ce9c24b6 Exclude Spanish in Crowdin configuration
We update the texts in Spanish ourselves, just like we update the
English texts. However, every time we get a pull request to update
translations from Crowdin, we get a bunch of texts in Spanish that we
ignore.

Hopefully excluding the Spanish language will solve the issue.
2025-03-07 17:31:35 +01:00
dependabot[bot]
0777bb917f Bump graphql from 2.3.18 to 2.4.11
Bumps [graphql](https://github.com/rmosolgo/graphql-ruby) from 2.3.18 to 2.4.11.
- [Release notes](https://github.com/rmosolgo/graphql-ruby/releases)
- [Changelog](https://github.com/rmosolgo/graphql-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rmosolgo/graphql-ruby/compare/v2.3.18...v2.4.11)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-07 16:19:05 +00:00
Javi Martín
c04dac38bd Merge pull request #5892 from consuldemocracy/html_indentation
Add a linter to check indentation in ERB+HTML files
2025-03-07 17:17:30 +01:00
Javi Martín
96e99ce6c8 Make HTML Beautifier fail on nesting errors
This way we're also checking mistakes like closing tags that don't match
their opening element, which we detected by manually running HTML
Beautifier with the `-e` option, and fixed two commits ago.

Note there was a false positive in the mailer layout. We don't know the
cause. Maybe closing the ERB tag right before the HTML opening tag and
the lack of other attributes on the tag made HTML Beautifier think the
tag wasn't correctly open, but on the other hand, we have the exact same
line in other layouts where HTML Beautifier works fine. We're fixing it
by adding an HTML id attribute to the element.
2025-03-07 16:56:29 +01:00
Javi Martín
b51aa31e6a Use HTML beautifier to indent ERB files
We had inconsistent indentation in many places. Now we're fixing them
and adding a linter to our CI so we don't accidentally introduce
inconsistent indentations again.
2025-03-07 16:31:08 +01:00
Javi Martín
b4b33926cf Fix HTML closing tags
In some places, we accidentally opened the same tag twice instead of
closing it, while in some other places we closed a tag without opening
it in the first place.

We've detected these issues thanks to the HTML Beautifier gem, which
we're about to start using for indentation purposes.
2025-03-07 16:02:07 +01:00
Javi Martín
291620abf7 Use tag.attributes to set conditional HTML attributes
Using an `if..else` block made the code harder to follow since the
opening tag was inside the block but the closing tag was outside it.
Moreover, it didn't work well with HTML Beautifier (a gem we're going to
introduce to manage ERB indentations).
2025-03-07 16:02:07 +01:00
Javi Martín
1389d45646 Simplify like/unlike buttons styles on small screens
Since we're now using a flex layout, the styles are more robust when we
keep the percentages below each button even on small screens.
2025-03-07 16:00:41 +01:00
Javi Martín
5e8a61adee Merge pull request #5891 from consuldemocracy/invalid_html_in_dev_settings
Fix invalid HTML caused by the dev seeds
2025-03-07 12:52:54 +01:00
Javi Martín
720a717a51 Merge pull request #5906 from consuldemocracy/dependabot/bundler/launchy-3.1.1
Bump launchy from 3.1.0 to 3.1.1
2025-03-07 00:04:30 +01:00
dependabot[bot]
50f57c2376 Bump launchy from 3.1.0 to 3.1.1
Bumps [launchy](https://github.com/copiousfreetime/launchy) from 3.1.0 to 3.1.1.
- [Changelog](https://github.com/copiousfreetime/launchy/blob/main/HISTORY.md)
- [Commits](https://github.com/copiousfreetime/launchy/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: launchy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 22:13:31 +00:00
Javi Martín
0436d75272 Merge pull request #5807 from consuldemocracy/dependabot/bundler/recipient_interceptor-0.3.3
Bump recipient_interceptor from 0.3.2 to 0.3.3
2025-03-06 19:23:47 +01:00
dependabot[bot]
74e543e2c8 Bump recipient_interceptor from 0.3.2 to 0.3.3
Bumps [recipient_interceptor](https://github.com/croaky/recipient_interceptor) from 0.3.2 to 0.3.3.
- [Release notes](https://github.com/croaky/recipient_interceptor/releases)
- [Commits](https://github.com/croaky/recipient_interceptor/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 18:05:54 +00:00
Javi Martín
11816f833d Use a flex layout to render participation processes lists
This way we simplify the HTML, which had some `if...else` blocks that
were hard to follow because there were opening tags inside these blocks
while the closing tags were outside these blocks.

We're also making the CSS container-dependent instead of
window-dependent. Since there are between one and three elements inside
the panel, we accomplish this by making the element with the content
take its own line if the width of the panel is smaller than 35rem.

Note we're trying to keep the layout similar to what it was; since we're
no longer using negative margins (like the ones in the `.row` selector),
the votes element now gets a width of 22.5% instead of 25%.

Also note we're using the column-gap property for flexbox because the
`flex-with-gap` mixin doesn't work so well with elements that have
borders. Since the column-gap property for flexbox is now supperted by
more than 98% of the browsers (which wasn't the case when we started
using the `flex-with-gap` mixin), the `flex-with-gap` mixin has become
obsolete.

Finally, note we're removing the `max-width: 12rem` rule in the images.
I'm not sure why we introduced this rule in the first place, and it
didn't play so well to the new layout. I considered using code like
`max-width: min(100%, 12rem)`, but, since I'm not sure why `12rem` was
there in the first place, I'm not sure whether this approach was better,
and it sure made things more complex.
2025-03-06 18:49:39 +01:00
Javi Martín
6b81799cf9 Remove redundant CSS rule
The exact same rule was already present in the block preceding it.
2025-03-06 18:27:29 +01:00
Javi Martín
b7c07e804e Remove border in proposals and debates supports
This way, it's consistent with the investments list, where we don't use
a border in the elements used for supporting or voting investments.
2025-03-06 18:26:33 +01:00
Javi Martín
1ae4caa0ef Only render successful icon on successful proposals
Not doing so made it trickier to define a flex layout, since the
icon-successful element is given a `position: absolute`, but only for
successful proposals, while for unsuccessful proposals it was taking
the standard `position: static` value.

We're also reusing the `successful?` method instead of rewriting it in
the view, and fixing a small issue where the icon wasn't displayed for
proposals having the exact needed votes (we were using `>` instead of
`>=` in the condition).

Note that legislation proposals use the method
`Proposal.votes_needed_for_success`, which is probaby a mistake caused
by copying the code from the proposal view. Fixing this issue is out of
the scope of this commit (and pull request), though.
2025-03-06 18:25:45 +01:00
Javi Martín
717d1cd2fc Use a one-line if condition in proposals index
With the multiline condition, HTML Beautifier (which we're about to
introduce in order to manage ERB indentation) gets confused. In this
context, a one-line condition is also more readable.
2025-03-06 18:25:45 +01:00
Javi Martín
53ff81dfdf Unify code applying the colors of a process
We had some duplication because the `css_for_process_header` was using
an instance variable, and so it couldn't be called from a partial where
this instance variable wasn't available.

Using a local variable and passing it as a parameter (as we should
always do) solves the issue and lets us simplify the code.
2025-03-06 18:25:45 +01:00
Javi Martín
a1352de9eb Remove duplicate external URL
The external URL is already rendered in the `investment_detail` partial,
so we were rendering it twice in the valuation area.
2025-03-06 18:25:45 +01:00
Javi Martín
064a7490c6 Remove empty and unused file
This file was added in commit 826385f65, but it was never used.
2025-03-06 18:25:45 +01:00
Javi Martín
e8184e169b Remove commented code in devise shared link
This code was commented in commit eedd91942, shortly after the project
started.
2025-03-06 18:25:45 +01:00
Javi Martín
65e3d4b6cf Fix invalid HTML caused by the dev seeds
These settings are used in links, and were generating invalid `href`
attributes that contained spaces.
2025-03-06 18:24:57 +01:00
Javi Martín
4be2336308 Merge pull request #5890 from consuldemocracy/remove_obsolete_initializers
Remove initializers no longer in Rails
2025-03-06 18:21:04 +01:00
Javi Martín
b04d36bf5d Merge pull request #5908 from consuldemocracy/upgrading_docs
Update instructions to upgrade Consul Democracy
2025-03-06 18:20:36 +01:00
Javi Martín
10a86fd5a4 Update instructions to upgrade Consul Democracy
We now strongly recommend to upgrade one version at a time and to run
the tests before and after upgrading.

Note we use a `release` branch instead of an `upgrade` branch because
we've been mentioning the `release` branch in the release notes of every
release for years.
2025-03-06 17:22:47 +01:00
Javi Martín
d8c866c5e6 Remove initializers no longer in Rails
These initializers either don't contain any code at all or contain code
that we never use. Since this was the case in most Rails applications,
they're no longer generated in new Rails applications [1].

So we're removing them as well.

[1] See pull requests 42538 and 43237 in https://github.com/rails/rails
2025-03-06 12:11:51 +01:00
Javi Martín
f1f3724365 Merge pull request #5888 from consuldemocracy/remove_bin_update_script
Remove obsolete bin/update script
2025-03-06 11:32:23 +01:00
Javi Martín
21c28bdb81 Merge pull request #5912 from consuldemocracy/dependabot/bundler/uri-1.0.3
Bump uri from 1.0.2 to 1.0.3
2025-03-05 20:05:57 +01:00
dependabot[bot]
d5fdbb9c24 Bump uri from 1.0.2 to 1.0.3
Bumps [uri](https://github.com/ruby/uri) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/ruby/uri/releases)
- [Commits](https://github.com/ruby/uri/compare/v1.0.2...v1.0.3)

---
updated-dependencies:
- dependency-name: uri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 18:38:54 +00:00
Sebastia
6cd10cd550 Merge pull request #5844 from consuldemocracy/remove-unused-css
Remove unused CSS
2025-03-05 16:48:05 +00:00
taitus
e094dc17d6 Remove unused CSS
* The `gender-and-channel` class isn't use since commit e3063cd24f
* The `first-comment` class added in commit e5fb90f954 was never used
* The `additional-info` class added in commit d47ce39b37 was never used
* The `title-quote` class isn't use since commit f317514258
* The `big-number` class added in commit aa1ed87725 was never used
* The `big-number-stat` class isn't used since commit cf32dcd6d5
* The `budget-investment-amount` and `budget-investment-description`
classes added in commit 4ade8325d7 were never used
* The `debate-quiz` class isn't use since commit d679c1eb79
* The `enquiries-list` class isn't use since commit 6aa96c4471
* The `investment-project-content` class isn't use since commit d0b8fef6b3
* The `leave-comment` class isn't use since commit ff6285d114
* The `poll-question-show` class isn't use since commit 8277e3cc2b
* The `questions-callout` class isn't use since commit ddf8d5f811
* The `budget-investments-inner` class isn't used since commit c6a9ffc19
* The `map-attributtion` class isn't use since commit 5a09b79da4
* The `postfix` class isn't use since commit 3752f3a53b
* The `translation-locale` added in commit a6e8fecc16 was never used
* The `changes-link`, `comment-advice`, `show-comments` and `comment-votes-number`
classes aren't use since commit d679c1eb79
2025-03-05 17:24:53 +01:00
Javi Martín
0e2d008d9e Remove obsolete bin/update script
This script was removed from Rails in Rails 6.0 [1] because the
`bin/setup` script is now idempotent and can be used to update the
application as well.

[1] See https://github.com/rails/rails/commit/8927eba83c
2025-03-05 16:47:31 +01:00
Sebastia
d84044cd73 Merge pull request #5886 from consuldemocracy/forks_list
Add list of open source forks and modifications
2025-03-05 15:30:27 +00:00
Javi Martín
2300f861b8 Merge pull request #5901 from consuldemocracy/downgrade_sass_to_1.77.5
Downgrade Sass to version 1.77.5
2025-03-05 16:13:29 +01:00
Javi Martín
dc05ff0fd6 Downgrade Sass to version 1.77.5
In commit 64bcedc8b, we upgraded Sass from version 1.70 to version 1.80.
However, since then we've noticed a couple of inconvenient things.

First, we're getting some deprecation warnings when compiling the
assets, related to a usage of `map-has-key` in Foundation which is
deprecated since Sass 1.80. Even with the `quiet_deps` flag, these
warnings aren't silenced.

Second, version 1.79 changed the way color functions work [1]. In
particular, functions like `color.adjust` or `darken` would now generate
RGB colors that include float numbers [2]. Browser support for float values
in RGB colors is about 98% at the time of writing [3], meaning some
browsers that are at least 5 or 6 years old will not render these
colors, sometimes resulting in white text over a white background, which
is of course impossible to read.

Finally, we get some deprecation warnings in our code when we remove the
`quiet_deps` flag, caused by the breaking change in mixed declaration
[4] from version 1.77.7 [5]. This warning is tricky; consider the following
code:

```
@mixin normal-selection {
  &::selection,
  *::selection {
    @include background-with-text-contrast($brand, brand, $check-invert-selection: false);
  }
}

.button.hollow {
  @include normal-selection;
  border: 1px solid;
}
```

In this scenario, since normal-selection is a mixin that generates a
nested rule, we're doing a declaration after a nested rule, which is now
deprecated.

The situation gets even more complicated when we define mixins that have
both nested rules and rules that apply to the element itself. Currently,
we sometimes include a mixin and then override some of the properties
the mixin defines, but we wouldn't be able to do so if we can't define
properties after including the mixin.

Right now, the solution seems to be adding `& { }` selectors
after including a mixin, like this:

```
.button.hollow {
  @include normal-selection;

  & {
    border: 1px solid;
  }
}
```

Which is incredibly cumbersome.

So, for now, we're downgrading to version 1.77.5 (we would downgrade to
version 1.77.6, but the sass-embedded gem skipped that version). That
version was released in June 2024, so it isn't very old yet. In the
future, we'll see what to do about the issues mentioned above, since
we'll have to upgrade at some point.

Note we're removing the `silence_deprecations` flag because Sass 1.77
doesn't raise warnings about using `import`.

[1] https://sass-lang.com/documentation/breaking-changes/color-functions/
[2] https://sass-lang.com/documentation/modules/color/#adjust
[3] https://caniuse.com/mdn-css_types_color_rgb_float_values
[4] https://sass-lang.com/documentation/breaking-changes/mixed-decls/
[5] https://sass-lang.com/documentation/js-api/interfaces/deprecations/#mixed_decls
2025-03-05 15:40:03 +01:00
Javi Martín
4dbc20f799 Merge pull request #5910 from consuldemocracy/dependabot/bundler/rspec-rails-7.1.1
Bump rspec-rails from 7.0.1 to 7.1.1
2025-03-05 15:39:10 +01:00
Javi Martín
1905d42578 Merge pull request #5900 from consuldemocracy/sass_calc_warnings
Fix Sass warnings in divisions without calc()
2025-03-05 15:31:26 +01:00
dependabot[bot]
3035855f4e Bump rspec-rails from 7.0.1 to 7.1.1
Note we aren't updating concurrent-ruby (which Dependabot would have
updated) due to an incompatibility with Rails 7.0.

Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 7.0.1 to 7.1.1.
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v7.0.1...v7.1.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 15:23:35 +01:00
Javi Martín
3334362c55 Merge pull request #5911 from consuldemocracy/dependabot/bundler/rack-2.2.12
Bump rack from 2.2.11 to 2.2.12
2025-03-05 15:23:06 +01:00