Commit Graph

20453 Commits

Author SHA1 Message Date
Lucía Luzuriaga
42dda087a3 Update CONTRIBUTING and README with latest links and suggestions 2025-08-21 09:45:24 +02:00
Javi Martín
6f87a0912c Merge pull request #6063 from consuldemocracy/dependabot/bundler/activestorage-7.1.5.2
Bump activestorage from 7.1.5.1 to 7.1.5.2
2025-08-15 12:51:48 +02:00
dependabot[bot]
4f4bd0f715 Bump activestorage from 7.1.5.1 to 7.1.5.2
Bumps [activestorage](https://github.com/rails/rails) from 7.1.5.1 to 7.1.5.2.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v8.0.2.1/activestorage/CHANGELOG.md)
- [Commits](https://github.com/rails/rails/compare/v7.1.5.1...v7.1.5.2)

---
updated-dependencies:
- dependency-name: activestorage
  dependency-version: 7.1.5.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-15 10:21:10 +00:00
Javi Martín
7a76b30909 Merge pull request #6062 from consuldemocracy/allow_rails_security_updates
Relax Rails dependency to allow security updates
2025-08-15 12:19:06 +02:00
Javi Martín
24dcff3c1d Relax Rails dependency to allow security updates
Currently dependabot is failing to upgrade some gems that are part of
Rails. For example, when there's a security issue in ActiveRecord or
ActiveStorage, we get messages like:

```
Dependabot cannot update activestorage to a non-vulnerable version.

The latest possible version that can be installed is 7.1.5.1 because of
the following conflicting dependencies:

rails (7.1.5.1) requires activestorage (= 7.1.5.1) via actionmailbox (7.1.5.1)
rails (7.1.5.1) requires activestorage (= 7.1.5.1) via actiontext (7.1.5.1)
rails (7.1.5.1) requires activestorage (= 7.1.5.1)

The earliest fixed version is 7.1.5.2.
```

So we're relaxing the dependency in order to make it easier for
dependabot to upgrade gems that are part of Rails.

Note that, with this configuration, Dependabot wouldn't be able to
upgrade to Rails 7.1.6 if this releases fixed a security issues in a gem
that is part of Rails. We might still need to upgrade Rails manually in
this case.
2025-08-15 12:01:27 +02:00
Javi Martín
1108c61f01 Merge pull request #5540 from consuldemocracy/poll_form
Use checkboxes and radio buttons on poll forms
2025-08-14 14:13:26 +02:00
Javi Martín
4b7700b6f5 Add a border for each question in the poll form
This way polls look more similar to the way they did when the answers
were buttons instead of checkboxes or radio buttons.

Note the styling is tricky because we need to add a `float` property to
the legend so it's actually inside the fieldset. This forces us to add a
`::before` pseudo-element in order to add margin between the legend and
the first label. Another option would be:

```
legend {
  &:has(+ label) {
    margin-bottom: calc($line-height / 2);
  }

  + label {
    clear: $global-left;
  }
}
```

But the `:has` pseudo-class isn't universally supported yet, and we'd
still have to add `margin-top` to the first label when it comes after a
`.help-text` element.

Due to the presence of the border, we're increasing the margin between
elements a little bit.

Note that adding a pseudoelement to the label is a consequence of adding
the `float` property to the legend, so we're changing the order of the
code so the styles for `legend` appear before the styles in `label`.
2025-08-14 13:59:07 +02:00
Javi Martín
8deb1964bd Show errors when submitting too many answers
This could be the case when JavaScript is disabled.

Note that, in `Poll/WebVote` we're calling `given_answers` inside a
transaction. Putting this code before the transaction resulted in a test
failing sometimes, probably because of a bug that might be possible to
reproduce by doing simultaneous requests.
2025-08-14 13:06:43 +02:00
werdenktwas-gmbh
abf02808bf Disable other answers when reaching maximum votes
This is similar to the way we were disabling buttons in the old design.

Co-authored-by: Javi Martín <javim@elretirao.net>
2025-08-14 13:06:43 +02:00
Javi Martín
7ea4f63b07 Allow blank votes in polls via web
With the old interface, there wasn't a clear way to send a blank ballot.
But now that we've got a form, there's an easy way: clicking on "Vote"
while leaving the form blank.
2025-08-14 13:06:43 +02:00
Javi Martín
cd134ed44f Remove unused HTML class in polls callout
This class was added in commit 3d22c556e but was never used.
2025-08-14 13:06:43 +02:00
Javi Martín
34a1e65ca9 Extract methods in poll callout component 2025-08-14 13:06:43 +02:00
Javi Martín
b48682e3e4 Group code for the poll callout together
Some of the code was in its own component, while some of the code
remained in the polls/show view.

Note that we're re-structuring the code a little bit, so it's clear that
the "already voted" messages are only shown when users can vote. Also
note that now the `can?` condition involves the existence of a
`current_user` and that the poll is not expired, so we can simplify the
`voted_in_web` condition.
2025-08-14 13:06:43 +02:00
Javi Martín
5402cb6042 Move poll callout partial to a component
This way it'll be easier to refactor it.

Note there was a system test which tested both the callout and the form
when unverified users visit a poll. We've split this system test in two
component tests.
2025-08-14 13:06:43 +02:00
Javi Martín
a7e1b42b6c Use checkboxes and radio buttons on poll forms
Our original interface to vote in a poll had a few issues:

* Since there was no button to send the form, it wasn't clear that
  selecting an option would automatically store it in the database.
* The interface was almost identical for single-choice questions and
  multiple-choice questions, which made it hard to know which type of
  question we were answering.
* Adding other type of questions, like open answers, was hard since we
  would have to add a different submit button for each answer.

So we're now using radio buttons for single-choice questions and
checkboxes for multiple-choice questions, which are the native controls
designed for these purposes, and a button to send the whole form.

Since we don't have a database table for poll ballots like we have for
budget ballots, we're adding a new `Poll::WebVote` model to manage poll
ballots. We're using WebVote instead of Ballot or Vote because they
could be mistaken with other vote classes.

Note that browsers don't allow removing answers with radio buttons, so
once somebody has voted in a single-choice question, they can't remove
the vote unless they manually edit their HTML. This is the same behavior
we had before commit 7df0e9a96.

As mentioned in c2010f975, we're now adding the `ChangeByZero` rubocop
rule, since we've removed the test that used `and change`.
2025-08-14 13:06:37 +02:00
Javi Martín
fd14c55615 Make answer depend on the option in poll answer factory
Until now, when writing `create(:poll_answer, option: option)`, the
`answer` field would take the title of a random option instead of taking
the title from the `option` variable.

So now, if we're given the option, the `answer` field will be taken from
the option itself.

Note that writing something like:

```
option { question.question_options.find_by(title: answer) }
answer { option.title }
```

Would create an infinite loop when creating a poll answer if we don't
pass the `option` and/or the `answer` attributes.

So, instead, we're making the `option` depend on the `answer` attribute
exclusively when we pass the `answer` attribute to the factory.
2025-08-14 12:58:51 +02:00
Javi Martín
a5054089b8 Fix typo in poll voter test 2025-08-12 12:45:12 +02:00
Javi Martín
b81bbeaa96 Remove unused method Poll::Question.answerable_by
This method isn't used since commit 909114bcf.
2025-08-12 12:45:12 +02:00
Javi Martín
3ddba8660e Fix "more info" heading
We were using an <h3> tag when there was no <h2> tag before it.
2025-08-12 12:45:12 +02:00
Javi Martín
6c5b908ef5 Use a loop instead of with_collection to render questions
This is what we usually do in components.
2025-08-12 12:45:12 +02:00
Javi Martín
eccf906e45 Add component to render the form poll
Right now it just renders the questions as it used to.
2025-08-12 12:45:12 +02:00
Javi Martín
dae932b0d2 Fix radio and label margin in right-to-left layouts
We used `margin-left` in commit b4eba055c, but when using right-to-left
layout, the property we should use is `margin-right`. So we're using
`margin-#{$global-left}` as usual.
2025-08-12 12:43:15 +02:00
Javi Martín
b76eba4c2e Merge pull request #6041 from consuldemocracy/align_radio_buttons
Correctly align radio buttons with their labels
2025-08-08 12:58:54 +02:00
Javi Martín
b4eba055c7 Correctly align radio buttons with their labels
We were using a `height: $line-height` property for this task. One of
the disadvantages of this approach is that things don't look so great
when the label expands over more than one line.

Back when we added that property, browser support for flex layouts
wasn't that great. Now there's universal support for it, so we can use
it instead.
2025-08-07 15:24:51 +02:00
Javi Martín
d5b4e5b7b9 Use <legend> tags to group radio button fields
In a few places, we were using <label> tags that pointed to elements
that didn't exist.
2025-08-07 15:24:51 +02:00
Javi Martín
cb57b0c0c1 Extract methods in draft version form component
This way we don't get lines with 150+ characters.
2025-08-07 15:24:51 +02:00
Javi Martín
0f54e220ba Move draft version form partial to a component
This way changing it will be easier.

Note we're moving the `legislation-draft-versions-form` class into the
form component itself, which is wat we usually do in components.
2025-08-07 15:24:51 +02:00
Javi Martín
1d90f68088 Remove unused CSS in legislation draft version forms
This code isn't used since commit d679c1eb7.
2025-08-07 15:24:51 +02:00
Javi Martín
00eb1149b9 Move custom pages form partial to a component
This way changing it will be easier.

Note we're changing the name of the HTML class to follow our naming
conventions; the `edit_page` class wasn't used anywhere, so we don't
need to change anything else.
2025-08-07 15:24:51 +02:00
Javi Martín
2c0f7cf99d Move dashboard actions partial to a component
Note that, in order to be consistent with most form components, we're
also moving the `form_for` part of the code to the component.
2025-08-07 15:24:51 +02:00
Sebastia
c7a2389d6b Merge pull request #6022 from consuldemocracy/dependabot/bundler/capistrano3-puma-6.2.0
Bump capistrano3-puma from 6.0.0 to 6.2.0
2025-08-04 16:22:05 +02:00
Javi Martín
3504d9aeac Merge pull request #6048 from consuldemocracy/dependabot/bundler/ruby-saml-1.18.1
Bump ruby-saml from 1.18.0 to 1.18.1
2025-08-04 14:10:02 +02:00
dependabot[bot]
bebbe8b3a9 Bump ruby-saml from 1.18.0 to 1.18.1
Bumps [ruby-saml](https://github.com/saml-toolkits/ruby-saml) from 1.18.0 to 1.18.1.
- [Release notes](https://github.com/saml-toolkits/ruby-saml/releases)
- [Changelog](https://github.com/SAML-Toolkits/ruby-saml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/saml-toolkits/ruby-saml/compare/v1.18.0...v1.18.1)

---
updated-dependencies:
- dependency-name: ruby-saml
  dependency-version: 1.18.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-04 11:40:10 +00:00
Javi Martín
eba1c4443c Merge pull request #6010 from Anamika1608/saml
Add support for SAML authentication
2025-07-23 15:02:28 +02:00
Anamika Aggarwal
c9bf7797a0 Add multi-tenancy support for SAML 2025-07-23 14:43:45 +02:00
Anamika Aggarwal
5726bcef07 Update the omniauth-saml to 2.2.4 2025-07-23 14:43:44 +02:00
Anamika Aggarwal
26df59af02 Add SAML Integration doc to setup secrets file 2025-07-23 14:43:44 +02:00
Javi Martín
b3737ae973 Adjust spacing in OAuth documentation
We're also fixing a missing "/" in one URL.
2025-07-23 14:43:44 +02:00
taitus
fcbace069e Only load saml settings when we have related secrets
Without this change the IdpMetaParser would give an error
in the Devise initializer when starting the application.

I found it annoying to have to connect to the VPN so
I decided to add this condition.

Reviewer, feel free to consider this commit unnecessary
and ask to revert it.
2025-07-23 14:43:44 +02:00
Senén Rodero Rodríguez
5cb5f19e4f Use IDPMetadataParse to set up the Idp SAML settings
Co-authored-by: Anamika Aggarwal <anamikaagg18@gmail.com>
2025-07-23 14:43:44 +02:00
Javi Martín
6190d808ba Allow different times between IDP and SP machines
We were having an issue because there was a difference of about 11
seconds between the local times of our machines and the time of the IDP
server. Since right now we can't guarantee the time of these machines is
fully synchronized, for now we're adding a margin of error of one
minute.
2025-07-23 14:43:44 +02:00
taitus
a4709f9da0 Add omniauth saml section for sign in and sign up page
Co-authored-by: Anamika Aggarwal <anamikaagg18@gmail.com>
2025-07-23 14:43:44 +02:00
Sebastia
9d216084a7 Merge pull request #6044 from consuldemocracy/dependabot/bundler/thor-1.4.0
Bump thor from 1.3.2 to 1.4.0
2025-07-22 09:40:36 +02:00
Sebastia
22f2e4b5ca Merge pull request #6045 from consuldemocracy/dependabot/bundler/nokogiri-1.18.9
Bump nokogiri from 1.18.8 to 1.18.9
2025-07-22 09:17:16 +02:00
dependabot[bot]
c3c7ba339e Bump nokogiri from 1.18.8 to 1.18.9
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.8 to 1.18.9.
- [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.8...v1.18.9)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-22 05:30:09 +00:00
dependabot[bot]
18f7e88524 Bump thor from 1.3.2 to 1.4.0
Bumps [thor](https://github.com/rails/thor) from 1.3.2 to 1.4.0.
- [Release notes](https://github.com/rails/thor/releases)
- [Commits](https://github.com/rails/thor/compare/v1.3.2...v1.4.0)

---
updated-dependencies:
- dependency-name: thor
  dependency-version: 1.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-22 01:37:44 +00:00
Sebastia
f4189365ea Merge pull request #5955 from cyrillefr/ReplaceLinkWithButtonInVariousComponentsPartI
Replace link with button in various components part i
2025-07-09 15:26:38 +02:00
cyrillefr
f0e696b972 Replace link with button in letter verification 2025-07-09 13:48:58 +02:00
cyrillefr
c989210e74 Replace link with button in finish signup in registrations 2025-07-09 13:48:58 +02:00
cyrillefr
3eba2d27a4 Replace link with button in Topics show 2025-07-09 13:48:58 +02:00