Commit Graph

20065 Commits

Author SHA1 Message Date
Javi Martín
4e010708e5 Update list of maintainers 2024-12-19 14:46:16 +01:00
Javi Martín
ce131ea650 Merge pull request #5817 from consuldemocracy/bookworm_in_docker
Use Debian Bookworm in our Dockerfile
2024-12-18 16:45:20 +01:00
Javi Martín
bf4e79d42b Merge pull request #5823 from consuldemocracy/dependabot/npm_and_yarn/nanoid-3.3.8
Bump nanoid from 3.3.7 to 3.3.8
2024-12-17 17:53:15 +01:00
dependabot[bot]
f5e45ee1c5 Bump nanoid from 3.3.7 to 3.3.8
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-14 23:20:14 +00:00
Javi Martín
b6ba27fe47 Use Debian Bookworm in our Dockerfile
Debian Bookworm was released in version 10 June 2023, and Bullseye
already received its final point release on August 2024 [1].

[1] https://lists.debian.org/debian-release/2024/07/msg00231.html
2024-12-09 14:13:46 +01:00
Javi Martín
dc832f1adb Merge pull request #5815 from consuldemocracy/dependabot/npm_and_yarn/cross-spawn-7.0.6
Bump cross-spawn from 7.0.3 to 7.0.6
2024-12-05 17:51:09 +01:00
dependabot[bot]
9da846f73c Bump cross-spawn from 7.0.3 to 7.0.6
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-05 16:25:25 +00:00
Javi Martín
a664ccfa5a Merge pull request #5812 from consuldemocracy/dependabot/bundler/rails-html-sanitizer-1.6.1
Bump rails-html-sanitizer from 1.6.0 to 1.6.1
2024-12-05 17:24:44 +01:00
dependabot[bot]
a8096102d6 Bump rails-html-sanitizer from 1.6.0 to 1.6.1
Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/rails/rails-html-sanitizer/releases)
- [Changelog](https://github.com/rails/rails-html-sanitizer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rails/rails-html-sanitizer/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: rails-html-sanitizer
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-02 22:20:33 +00:00
Sebastia
2e8eb6abf7 Merge pull request #5797 from consuldemocracy/reduce-tests
Make nested imageable specs faster
2024-11-26 19:01:49 +01:00
taitus
fdee159185 Remove show_caption_for? method
The `show_caption_for?` method was used to determine whether to check for the
presence of a `figcaption` element, but its only purpose was to skip the check
when the factory was `:budget.

The reason we skip the `figcaption` check for `:budget` is that it is the only case
where the test is verifying the form's edit page, where displaying a `figcaption` does
not make sense.
2024-11-26 18:10:28 +01:00
taitus
3fd2a1f498 Remove redirected_to_resource_show_or_navigate_to method
This method was removed as its logic was redundant or unnecessary:

- For "Proposal" new:
After creating a proposal, we are redirected to the "created" page, where the text
"Not now, go to my proposal" is not present, leading to a constant
`rescue Capybara::ElementNotFound`.

Instead, the "created" page shows a preview of how the proposal will look when
published and a link saying "No, I want to publish the proposal".  Since the click's
purpose was to navigate to the proposal's "show" page, and this can already be
verified on the "created" page, no additional handling is needed for this case.

- For "Proposal" edit:
After updating the proposal, we are directly redirected to the proposal's "show" page,
so no click_link logic is necessary here either.

- For "Budget":
The redirection is now handled directly with:
  `visit edit_admin_budget_path(imageable) if factory == :budget`.
2024-11-26 18:10:28 +01:00
taitus
08c4ecbed2 Remove unnecessary method 2024-11-26 18:10:28 +01:00
taitus
84bec1241f Remove redundant "loading-bar.errors"
In the imageable_attach_new_file method used in this tests the:
> expect(page).to have_css ".loading-bar.errors"
is already being checked.

Therefore, to leave only the line:
> imageable_attach_new_file(file_fixture("logo_header.png"), false)
in the test, since there is another test that verifies it,
I think we can remove the test altogether.
2024-11-26 18:10:28 +01:00
taitus
c80641e5f2 Regroup tests for edit path 2024-11-26 18:10:28 +01:00
taitus
e450186122 Regroup tests for link visibility and upload images 2024-11-26 18:10:28 +01:00
taitus
71e758f71c Remove redundant ".loading-bar.complete"
In the imageable_attach_new_file method used in these tests the:
> expect(page).to have_css ".loading-bar.complete"
is already being checked, so there is no need to verify it twice.
2024-11-26 18:10:28 +01:00
taitus
3877479b69 Extract proposal edit from shared nested imageable specs to system specs 2024-11-26 18:10:26 +01:00
taitus
cdfaec5217 Extract management budget investment from shared nested imageable specs to system specs 2024-11-26 17:58:10 +01:00
taitus
9d7fa9d0f8 Unify notice responders for budget investments create action 2024-11-26 17:58:10 +01:00
taitus
1cf85560dd Extract poll question option images from shared nested imageable specs to system specs
This is the only it_behaves_like "nested imageable" call where the has_many_images parameter is set to true.

Previously, the shared example skipped or altered expectations based on this parameter. Now, this behavior is
moved to the factory level (:future_poll_question_option).

Since this is an administrative section, a related administrator is created for the user.
2024-11-26 17:58:10 +01:00
taitus
2212a2a2f4 Extract budget investment from shared nested imageable specs to system specs 2024-11-26 17:58:10 +01:00
taitus
add50d68f6 Extract proposal new from shared nested imageable specs to system specs
Make `path`, `fill_resource_method_name`, `submit_button`, and
`imageable_success_notice` dynamic based on the factory.

Also adjusted the user. The proposals no longer require the user to be an
administrator but do require them to be a level 2 user.

Note that we are adding the Style/CaseLikeIf rubocop rule.
2024-11-26 17:57:01 +01:00
taitus
fb98cb61ac Extract budgets from shared nested imageable specs to system specs
Removed `imageable_path_arguments`, `has_many_images`, and `management` parameters
because they are not used by budgets.

Hardcoded `path`, `fill_resource_method_name`, `submit_button`, and
`imageable_success_notice`parameters for budgets. These remain fixed for now until dynamic
values are required in the next commits.
2024-11-20 16:27:53 +01:00
Javi Martín
e81d376aca Merge pull request #5791 from emmanuel-ferdman/master
Update OS guides references
2024-11-14 17:43:06 +01:00
Emmanuel Ferdman
e844204cf4 Update OS guides references
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2024-11-14 07:24:18 -08:00
Javi Martín
6ab51b0367 Remove the ahoy_events table
We stopped using ahoy events in commit f7e2d724d.
2024-11-13 15:55:20 +01:00
Javi Martín
10e66006c8 Remove the campaigns table
We stopped using the Campaign model in commit 448775a5e.
2024-11-13 15:55:20 +01:00
Javi Martín
59b98db5e5 Merge pull request #5745 from consuldemocracy/image_alt
Add missing alt attributes to images
2024-11-13 15:50:51 +01:00
Javi Martín
360a181c18 Use aria-hidden when rendering SVG avatars
It looks like not all screen readers identify SVG images with empty aria
labels as a decorative image, as reported by the Axe accessibility
engine.

So we're using `aria-hidden` instead, since we don't want the text of
the SVG to be read by screen readers. We're using `aria-hidden` instead
of the `presentation` role for the reasons mentioned in commit
35659d441.
2024-11-12 18:25:20 +01:00
Javi Martín
815a4078d5 Check the alt attribute in XSS tests
Not doing so was causing a test to fail when checking that all rendered
image contain an `alt` attribute.
2024-11-12 18:25:20 +01:00
Javi Martín
a6e6a90bef Add alt test to proposal images in mail 2024-11-12 18:25:20 +01:00
Javi Martín
6d6c067296 Use an empty alt attribute for decorative images
This way people using screen readers will know that the image is a
decorative one.
2024-11-12 18:25:20 +01:00
Javi Martín
597a21eca9 Add alt attribute to map images
We were using it on the map displayed on the sidebar, but we weren't
using it in the other places were the map is rendered.
2024-11-12 18:25:20 +01:00
Javi Martín
96e4ed4c36 Merge pull request #5744 from consuldemocracy/select_name
Associate all select fields with labels
2024-11-12 16:22:37 +01:00
Javi Martín
8130e4fbc8 Add an aria-label to the "choose your booth" select
We're using the `aria-label` attribute instead of a label because this
is a page where only one field is rendered and the text of the label is
the same as the text of the <h1> tag.

We're using `aria-label` instead of `aria-labelledby` because the former
is supported by Capybara.
2024-11-12 15:58:36 +01:00
Javi Martín
39d620539c Remove unused tabindex attribute
In order for this attribute to be applied, due to the syntax of the
`select` method, it should be in a separate hash.

We're removing it instead of correctly applying it because we never use
the `tabindex` attribute with a positive value, since it might break
keyboard navigation.
2024-11-12 15:58:36 +01:00
Javi Martín
ddaf320d8a Add proper labels to shift date selectors
We were using one label for both date selectors, but it wasn't
associated with any of them.

So we're now rendering one label per control and, just like we only show
one of these date selectors at a time, we're only showing one label at a
time.
2024-11-12 15:58:26 +01:00
Javi Martín
79b7ec91dd Simplify passing polls in shifts form component 2024-11-12 15:17:20 +01:00
Javi Martín
5915194fc4 Simplify passing the booth in shift form component
Since we're using helpers instead of components, the booth is now a
method and we don't need to pass it around.
2024-11-12 15:17:20 +01:00
Javi Martín
ee34ead4ee Move poll shifts form partial to a component
Thanks to it, we can move a few helper methods to the component.
2024-11-12 15:17:16 +01:00
Javi Martín
9ab6c15975 Remove unused method in shifts helper
We don't use this method since commit 452723628.
2024-11-12 15:16:23 +01:00
Javi Martín
d254fcd7ca Fix missing "for" attribute in user segments label
Since the attribute was missing, the label wasn't correctly associated
with its field.
2024-11-12 15:15:34 +01:00
Javi Martín
b68047f265 Fix missing "for" attribute in officer assignment label
Since this attribute was missing, the label wasn't correctly associated
with its field.
2024-11-12 15:15:34 +01:00
Javi Martín
3b7948a139 Use a date field to select the date of birth
The default `date_select` used in fields presents an accessibility
issue, because in generates three select controls but only one label.
That means that there are two controls without a label.

So we're using a date field instead. This type is field is supported by
about 99% of the browsers, and we've already got JavaScript code
converting this field to a jQuery UI datepicker in case the browser
doesn't support date fields.

Note that, since we no longer need to parse the three date fields into
one, we can simplify the code in both the models and the tests.

Another slight improvement is that, previously, we couldn't restrict the
month and day controls in order to set the minimum date, so the maximum
selectable date was always the 31st of December of the year set by the
minimum age setting. As seen in the component test, now that we use only
one field, we can set a specific date as the maximum one.
2024-11-12 15:15:34 +01:00
Javi Martín
6af8ddd324 Extract component to render the date of birth
We reduce code duplication thanks to that, and make it easier
to change this field.

Note that there was one place where the "16.years" value was
hardcoded. We're moving the test for this case to the
component and changing it so the test doesn't use the default
age.

We're also removing the redundant helper method that had the
same code as a method in the User class which is called
everywhere else.
2024-11-12 15:15:34 +01:00
Javi Martín
ab673557c4 Merge pull request #5788 from consuldemocracy/hide_money_expectation
Add missing expectation in hide money test
2024-11-11 16:08:49 +01:00
Javi Martín
64bb42b288 Add missing expectation in hide money test
All the expectations checked after the `click_link "Check my votes"`
action were already true before clicking the link, meaning the test
could finish before the request did.

It's possible that this request caused a test run 8274, job 2 [1], since
a multitenancy test failed and a possible cause could have been
simultaneous requests to both a tenant subdomain and the application's
main domain. The failure was:

```
1) Multitenancy PostgreSQL extensions work for tenants
     Failure/Error: expect(page).to have_content "Proposal created
successfully."
       expected to find text "Proposal created successfully." in
       "Language: \n
       \nEnglish\nDeutsch\nEspañol\nFrançais\nNederlands\nPortuguês
       brasileiro\n中文\n       Notifications\nMy content\nMy account\nSign
       out\nDebates\nYou are in\nProposals\nVoting\nCollaborative
       legislation\nParticipatory budgeting\nSDG\nHelp\nProposals\nCreate new
       proposal\nHow do citizen proposals work?\nRecommendations for creating a
       proposal\nDo not use capital letters for the proposal title or for whole
       sentences. On the internet, this is considered shouting. And nobody
       likes being shouted at.\nAny proposal or comment suggesting illegal
       action will be deleted, as well as those intending to sabotage the
       debate spaces. Anything else is allowed.\nEnjoy this space and the
       voices that fill it. It belongs to you too.\n×\n1 error prevented this
       Proposal from being saved.\nPlease check the marked fields to know how
       to correct them:\nREQUIRED FIELDS\nProposal title\nProposal
       summary\n(maximum 200 characters)\ntsvector for María the
       Martian\nProposal text\n    Format\n    ◢\n  If you are human, ignore
       this field\nOPTIONAL FIELDS\nExternal video URL\nYou may add a link to
       YouTube or Vimeo\nDescriptive image\nYou can upload one image of
       following content types: jpg, up to 1 MB.\nAdd image\nDocuments\nYou can
       upload up to a maximum of 3 documents of following content types: pdf,
       up to 3 MB per file.\nAdd new document\nTags\nTag this proposal. You can
       choose from proposed categories or add your own\nCategories\n\nFull name
       of the person submitting the proposal\n(individually or as
       representative of a collective; will not be displayed publically)\ncan't
       be blank, is too short (minimum is 6 characters)\nSustainable
       Development Goals and Targets\nYou can choose one or several SDGs
       aligned with your citizen proposal\nGoals and Targets\nYou can introduce
       the code of a specific goal/target or a text to find one. For more
       information visit the SDG help page.\nI agree to the Privacy Policy and
       the Terms and conditions of use\nOpen government\nThis portal uses the
       CONSUL DEMOCRACY application which is open-source
       software.\nParticipation\nDecide how to shape the city you want to live
       in.\nCONSUL DEMOCRACY, 2024 Privacy Policy Terms and conditions of use
       Accessibility"
```

Note the `can't be blank, is too short` reference to the responsible
name, which is only checked when user verification is not skipped. In
this test, the `mars` tenant skips the verification while the default
tenant does not. The mentioned possibility of simultaneous requests
might have caused the issue.

[1] https://github.com/consuldemocracy/consuldemocracy/actions/runs/11747689680/job/32730131655
2024-11-11 15:53:43 +01:00
Javi Martín
6f81215425 Merge pull request #5786 from consuldemocracy/stats_turbolinks_reload
Include stat graphs JavaScript in all admin stats actions
2024-11-11 15:46:15 +01:00
Javi Martín
c34cab282a Merge pull request #5509 from consuldemocracy/labels_everywhere
Associate all form inputs with labels
2024-11-11 15:21:25 +01:00