Commit Graph

18694 Commits

Author SHA1 Message Date
Javi Martín
6bb587c7da Remove link to gitter chat
We're replacing gitter with GitHub Discussions.
2024-03-22 16:39:10 +01:00
Sebastia
9e5344b5d7 Merge pull request #5276 from consuldemocracy/order-cards
Allow sorting homepage cards
2024-03-22 10:56:33 +01:00
Javi Martín
692d509cf5 Merge pull request #5398 from consuldemocracy/readme_badges
Update badges in README files
2024-03-22 03:05:13 +01:00
taitus
bce1474527 Only render position field on table when cards rendered are not headers 2024-03-21 19:00:56 +01:00
coslajohn
529357c980 Merge pull request #5390 Geozone Admin maps
This makes it easier to see if Geojson has been imported correctly.
2024-03-21 18:47:37 +01:00
taitus
4e9d5d8c5a Allow sorting widget_cards on custom pages 2024-03-21 18:27:49 +01:00
taitus
f795c18bec Allow sorting widget_cards on sdg section 2024-03-21 18:27:49 +01:00
taitus
7c85daac3f Allow sorting widget_cards on homepage
Note that we keep :created_at order as complement to new :order field.

We do this so that current installations will not notice any change in the
sorting of their cards when upgrading, as the default "order" field will always
be 1, so it will continue to sort by the "created_at".
2024-03-21 18:27:49 +01:00
taitus
6059aab674 Allow saving a position when create a widget card
We are ensuring that only position field is rendered only on
non-header cards.

Note that we have 3 sections that use widget cards:
- Homepage (cards and header cards)
- Custompages (only have cards)
- Sdg Homepage (cards and header cards)
2024-03-21 18:15:50 +01:00
taitus
9dd10cac19 Add order field to widget cards
We will use this field to enter the position where the cards will be shown to the
user in the homepage.
2024-03-21 18:10:26 +01:00
taitus
e9a7731f49 Do not render "Number of colums" when create a sdg header card
Co-authored-by: Javi Martín <javim@elretirao.net>
2024-03-21 18:08:25 +01:00
Javi Martín
82c24a7ef3 Merge pull request #5428 from consuldemocracy/release_2.1.1
Release version 2.1.1
2024-03-21 15:08:54 +01:00
Javi Martín
e7cc823c87 Reorganize badges in README
So now related badges are together. First paragraph, legal stuff.
Second paragraph, technical tools and status. Third paragraph, links
related to collaboration.
2024-03-21 14:25:01 +01:00
Javi Martín
e32818b3fc Remove Rocket Validator badge
We haven't used this service for at least four and a half years.
2024-03-21 14:24:46 +01:00
Javi Martín
b9e939d375 Release version 2.1.1 2024-03-20 03:38:59 +01:00
Javi Martín
31f42a2c76 Merge pull request #5432 from consuldemocracy/fix_unsafe_spec_warning
Sanitize the output of a dummy component class
2024-03-19 15:24:55 +01:00
Javi Martín
669472c800 Sanitize the output of a dummy component class
After commit 52ec5094f, we started to get a warning when running out
test suite:

```
WARNING: The #<Class:0x00007958c06fb8e0> component rendered HTML-unsafe
output. The output will be automatically escaped, but you may want to
investigate.
```

The reason is that, for security reasons, since version 3.9.0,
ViewComponent no longer renders unsafe output in the `call` method, so
we need to make sure the rendered text is safe. This is similar to what
Rails automatically does in views with `<%= %>`.

While this change doesn't affect the application (this class is only
used in a test), with it we avoid the warning.
2024-03-19 14:54:06 +01:00
Javi Martín
42eff36bdd Merge pull request #5421 from consuldemocracy/rails6.1_rubocop_rules
Add rubocop rules affecting Rails 6.1
2024-03-18 16:29:54 +01:00
Javi Martín
d0fae3377e Add and apply Rails/WhereMissing rubocop rule
So now we know where to use the `where.missing` method which was
introduced in Rails 6.1.

Note this rule didn't detect all cases where the new method can be used.
2024-03-18 16:05:07 +01:00
Javi Martín
86cf674d0c Add Rails/DeprecatedActiveModelErrorsMethods rule
Even though we're already applying this rule since commit 08b12a78f,
it's very useful to have it so we don't accidentally introduce code that
won't work with Rails 7.

After upgrading to Rails 7, this rule will no longer be necessary, since
the code using the deprecated syntax will not work and so we'll notice
it immediately.
2024-03-18 16:05:07 +01:00
Javi Martín
77505db337 Merge pull request #5389 from CoslaDigital/render_geojson
Allow whitespace between square brackets in GeoJSON polygons
2024-03-18 16:03:59 +01:00
Javi Martín
0658edbea2 Merge pull request #5395 from consuldemocracy/fix_new_window_typo
Fix link to debates help
2024-03-18 15:47:59 +01:00
Javi Martín
1a22db8b17 Fix link to debates help
This link used to open in a new window, and we accidentally changed that
behavior while refactoring it in commit c2710de5f.

Since we're adding a test for this case, and the Proposals::NewComponent
class is similar, we're adding a test for that class too. In the case of
proposals, we need to sign in a user because the proposals form contains
fields to attach image, that currently rely on a user being signed in.
2024-03-18 15:29:46 +01:00
Javi Martín
0972bcbbe9 Merge pull request #5422 from consuldemocracy/fix_polls_test
Prevent "Unable to autoload constant" error in tests
2024-03-18 15:28:26 +01:00
Javi Martín
c7ea55ae35 Merge pull request #5431 from consuldemocracy/rubocop_capybara_code_climate
Update Code Climate Rubocop version
2024-03-18 15:23:07 +01:00
Javi Martín
8ba37b295a Temporarily disable a test that fails sometimes
This test is failing often due to an "Unable to autoload constant"
error, that will be fixed after switching to zeitwerk.

Just like it happened in the the "Polls can be listed" test, the reason
seems to be accessing a page containing several ActiveStorage
attachments. However, since this test only makes sense when two or more
images are displayed on the page, we can't change the test so create
just one image.

So, for now, we're commenting the test, and we'll uncomment it again
when we enable zeitwerk in version 2.2.0.
2024-03-18 15:09:17 +01:00
Javi Martín
bbac39e976 Merge pull request #5426 from consuldemocracy/fix_comment_votes_html
Fix invalid HTML in comment votes
2024-03-18 15:02:25 +01:00
Javi Martín
d921eee30d Update Code Climate Rubocop version
Code Climate was failing to analyze our repo because their rubocop 1.31
doesn't support rubocop-capybara.

Since we're using rubocop 1.56.4 in our code, we're going to use
version 1.56.3 for Code Climate which, at the time of writing, is the
latest available version in Code Climate.
2024-03-18 14:54:46 +01:00
Javi Martín
a670b77e75 Merge pull request #5399 from consuldemocracy/dependabot/bundler/view_component-3.11.0
Bump view_component from 3.6.0 to 3.11.0
2024-03-18 14:49:00 +01:00
Javi Martín
8006227bb4 Merge pull request #5403 from consuldemocracy/missing_spanish_translations
Add missing Spanish translations
2024-03-08 15:51:21 +01:00
Javi Martín
3d63238ef6 Add missing Spanish translations
These texts were added in English in commit 7070b0915, but we forgot to
add the texts in Spanish as well.
2024-03-08 15:15:34 +01:00
CoslaJohn
8b3ec8fc79 Applied patch to tidy whitespace and add tests 2024-03-07 12:08:17 +00:00
Javi Martín
a101608ebe Fix invalid HTML in comment votes
We forgot to change the `span` tag when we replaced links with buttons
in commit ba0d21b46.
2024-03-05 00:41:53 +01:00
Javi Martín
deb8b374e7 Simplify creating a proposal poll in a test
This way we avoid variables starting with underscores, which we don't
use almost anywhere else.
2024-03-02 23:43:44 +01:00
Javi Martín
c480cdd918 Don't create records after a visit in polls tests
Creating records after starting the browser with the `visit` method
sometimes results in database corruption and failing tests on our CI.

Splitting some tests or merging them together solves the issue.
2024-03-02 23:43:26 +01:00
Javi Martín
2af1fc72f3 Prevent Unable to autoload constant error in tests
When running these tests, under certain conditions, we get a warning
followed by an error:

```
activesupport-6.1.7.7/lib/active_support/dependencies.rb:502:
warning: already initialized constant ActiveStorage::Representations

activesupport-6.1.7.7/lib/active_support/dependencies.rb:502:
warning: previous definition of Representations was here

Failure/Error: raise LoadError, "Unable to autoload constant
'#{qualified_name}', expected #{file_path} to define it"

LoadError: Unable to autoload constant
ActiveStorage::Representations::RedirectController, expected
activestorage-6.1.7.7/app/controllers/active_storage/representations/redirect_controller.rb
to define it
```

The error seems to take place when we request a page in a test that
loads two (or more) ActiveStorage images if ActiveStorage hasn't loaded
yet, although it's a flaky error and so the test doesn't always behave
like this.

We've tested that switching to zeitwerk solves the issue but, since we
aren't switching to zeitwerk in version 2.1.1 and we'd like this version
to run all tests correctly, for now we're changing the tests so they
don't load two records with images.

On of these tests ("Polls Index Polls can be listed") fails on my
machine when run individually. I haven't been able to consistently
reproduce the other ones.
2024-03-02 22:06:25 +01:00
Javi Martín
1d955b7a20 Simplify using helper methods in components
The `use_helpers` method was added in ViewComponent 3.8.0, and it's
included by default in all components since version 3.11.0.

Note we sometimes delegated the `can?` method to the controller instead
of the helpers, for no particularly reason. We're unifying that code as
well.
2024-03-02 17:34:25 +01:00
dependabot[bot]
52ec5094f0 Bump view_component from 3.6.0 to 3.11.0
Bumps [view_component](https://github.com/viewcomponent/view_component) from 3.6.0 to 3.11.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.6.0...v3.11.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>
2024-03-02 17:34:25 +01:00
Javi Martín
8ac1acc5ea Merge pull request #5374 from consuldemocracy/dependabot/bundler/bullet-7.1.6
Bump bullet from 7.0.7 to 7.1.6
2024-03-02 17:31:59 +01:00
dependabot[bot]
331784e926 Bump bullet from 7.0.7 to 7.1.6
Bumps [bullet](https://github.com/flyerhzm/bullet) from 7.0.7 to 7.1.6.
- [Changelog](https://github.com/flyerhzm/bullet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/flyerhzm/bullet/compare/7.0.7...7.1.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-02 03:00:10 +00:00
Javi Martín
a6f3952c3b Merge pull request #5361 from consuldemocracy/dependabot/bundler/pdf-reader-2.12.0
Bump pdf-reader from 2.11.0 to 2.12.0
2024-03-02 03:43:06 +01:00
dependabot[bot]
ac9472cc0b Bump pdf-reader from 2.11.0 to 2.12.0
Bumps [pdf-reader](https://github.com/yob/pdf-reader) from 2.11.0 to 2.12.0.
- [Changelog](https://github.com/yob/pdf-reader/blob/main/CHANGELOG)
- [Commits](https://github.com/yob/pdf-reader/compare/v2.11.0...v2.12.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-02 03:19:02 +01:00
Javi Martín
8ec1edca30 Merge pull request #5373 from consuldemocracy/dependabot/bundler/faker-3.2.3
Bump faker from 3.2.1 to 3.2.3
2024-03-02 03:15:19 +01:00
dependabot[bot]
518eb333b4 Bump faker from 3.2.1 to 3.2.3
Bumps [faker](https://github.com/faker-ruby/faker) from 3.2.1 to 3.2.3.
- [Release notes](https://github.com/faker-ruby/faker/releases)
- [Changelog](https://github.com/faker-ruby/faker/blob/main/CHANGELOG.md)
- [Commits](https://github.com/faker-ruby/faker/compare/v3.2.1...v3.2.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-02 02:00:07 +00:00
Javi Martín
a30917b746 Merge pull request #5356 from consuldemocracy/dependabot/bundler/factory_bot_rails-6.4.3
Bump factory_bot_rails from 6.2.0 to 6.4.3
2024-03-02 02:58:19 +01:00
dependabot[bot]
56311eeefb Bump factory_bot_rails from 6.2.0 to 6.4.3
Bumps [factory_bot_rails](https://github.com/thoughtbot/factory_bot_rails) from 6.2.0 to 6.4.3.
- [Release notes](https://github.com/thoughtbot/factory_bot_rails/releases)
- [Changelog](https://github.com/thoughtbot/factory_bot_rails/blob/main/NEWS.md)
- [Commits](https://github.com/thoughtbot/factory_bot_rails/compare/v6.2.0...v6.4.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-02 01:21:14 +00:00
Javi Martín
70edfbe624 Merge pull request #5290 from consuldemocracy/dependabot/bundler/mdl-0.13.0
Bump mdl from 0.12.0 to 0.13.0
2024-03-02 02:15:00 +01:00
dependabot[bot]
99b9167e72 Bump mdl from 0.12.0 to 0.13.0
Bumps [mdl](https://github.com/mivok/markdownlint) from 0.12.0 to 0.13.0.
- [Changelog](https://github.com/markdownlint/markdownlint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mivok/markdownlint/compare/v0.12.0...v0.13.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-02 00:51:07 +00:00
Javi Martín
5624e0fead Merge pull request #5420 from consuldemocracy/update_upload_artifact_action_to_version_4
Update upload artifact action to version 4
2024-03-02 01:28:43 +01:00
Javi Martín
7ae8df8af7 Merge pull request #5362 from consuldemocracy/dependabot/bundler/rubocop-rails-2.23.1
Bump rubocop-rails from 2.21.2 to 2.23.1
2024-03-02 01:18:06 +01:00