Commit Graph

20065 Commits

Author SHA1 Message Date
taitus
108a05a66d Allow undo votes in favor against component 2023-10-09 07:21:49 +02:00
taitus
fd5fa2da79 Refactoring: Move 'vote' action to Votes Controllers
As far as possible I think the code is clearer if we use CRUD actions
rather than custom actions. This will make it easier to add the action
to remove votes in the next commit.

Note that we are adding this line as we need to validate it that a vote
can be created on a debate by the current user:

```authorize! :create, Vote.new(voter: current_user, votable: @debate)```

We have done it this way and not with the following code as you might
expect, as this way two votes are created instead of one.

```load_and_authorize_resource through: :debate, through_association: :votes_for```

This line tries to load the resource @debate and through the association
"votes_for" it tries to create a new vote associated to that debate.
Therefore a vote is created when trying to authorise the resource and
then another one in the create action, when calling @debate.vote_by (which
is called by @debate.register_vote).
2023-10-09 07:21:49 +02:00
taitus
c96e3b027f Replace Partials with Direct Component Rendering
In this commit, we have performed a refactoring to enhance code organization.
Several partials that were solely responsible for rendering components have been removed.

Instead, we are now directly rendering the components within the views where these
partials were previously used.
2023-10-06 18:13:45 +02:00
taitus
5009bf6c37 Add aria-pressed to in comments votes component
In order to the users using screen readers know whether the button is pressed
or not.
2023-10-06 18:13:45 +02:00
taitus
10cfa0e59f Refactor scss for in favor against component
In order to reduce the code used to add styles to the buttons,
we removed the classes that had been added and handled it with
the new aria-pressed attribute
2023-10-06 18:13:45 +02:00
taitus
daf9692753 Add aria-pressed to in favor against component
In order to the users using screen readers know whether the button is pressed
or not.
2023-10-06 07:14:07 +02:00
Javi Martín
4f747c9b53 Merge pull request #5272 from jensconsul/master
update readme file
2023-10-04 23:05:47 +02:00
jensconsul
85ddb367fc Merge pull request #1 from jensconsul/jensconsul-readme-edit
Update README.md
2023-10-04 10:50:24 +02:00
jensconsul
aa0667e7cf Update README.md
These are Jens Kimmel proposed changes to the README file so as to include a reference to the Foundation and the global user community
2023-10-04 09:56:20 +02:00
Javi Martín
5fda3f33ed Merge pull request #5263 from consuldemocracy/dependabot/bundler/knapsack_pro-5.7.0
Bump knapsack_pro from 5.6.0 to 5.7.0
2023-10-04 02:25:31 +02:00
dependabot[bot]
8480b5f31e Bump knapsack_pro from 5.6.0 to 5.7.0
Bumps [knapsack_pro](https://github.com/KnapsackPro/knapsack_pro-ruby) from 5.6.0 to 5.7.0.
- [Changelog](https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.6.0...v5.7.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-04 02:04:19 +02:00
Javi Martín
2d74ac0b61 Merge pull request #5264 from consuldemocracy/dependabot/bundler/groupdate-6.4.0
Bump groupdate from 6.2.1 to 6.4.0
2023-10-04 01:37:36 +02:00
dependabot[bot]
aabd5cf397 Bump groupdate from 6.2.1 to 6.4.0
Bumps [groupdate](https://github.com/ankane/groupdate) from 6.2.1 to 6.4.0.
- [Changelog](https://github.com/ankane/groupdate/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ankane/groupdate/compare/v6.2.1...v6.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-04 01:15:55 +02:00
Javi Martín
545e9a27e9 Merge pull request #5265 from consuldemocracy/dependabot/bundler/audited-5.4.0
Bump audited from 5.3.3 to 5.4.0
2023-10-04 00:15:33 +02:00
dependabot[bot]
4598af5256 Bump audited from 5.3.3 to 5.4.0
Bumps [audited](https://github.com/collectiveidea/audited) from 5.3.3 to 5.4.0.
- [Changelog](https://github.com/collectiveidea/audited/blob/main/CHANGELOG.md)
- [Commits](https://github.com/collectiveidea/audited/compare/v5.3.3...v5.4.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 21:46:13 +00:00
Javi Martín
50a3b9b451 Merge pull request #5266 from consuldemocracy/dependabot/bundler/rubocop-performance-1.19.1
Bump rubocop-performance from 1.19.0 to 1.19.1
2023-10-03 23:45:12 +02:00
dependabot[bot]
cc6668adfb Bump rubocop-performance from 1.19.0 to 1.19.1
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.19.0 to 1.19.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.19.0...v1.19.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 23:23:17 +02:00
Javi Martín
9077c060ed Merge pull request #5267 from consuldemocracy/dependabot/bundler/rubocop-1.56.4
Bump rubocop from 1.56.2 to 1.56.4
2023-10-03 22:45:41 +02:00
dependabot[bot]
3d094bbdc5 Bump rubocop from 1.56.2 to 1.56.4
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.56.2 to 1.56.4.
- [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.56.2...v1.56.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 20:13:35 +00:00
Javi Martín
ef4c438b96 Merge pull request #5269 from consuldemocracy/dependabot/bundler/rubocop-factory_bot-2.24.0
Bump rubocop-factory_bot from 2.23.1 to 2.24.0
2023-10-03 22:12:18 +02:00
dependabot[bot]
82e74969b9 Bump rubocop-factory_bot from 2.23.1 to 2.24.0
Bumps [rubocop-factory_bot](https://github.com/rubocop/rubocop-factory_bot) from 2.23.1 to 2.24.0.
- [Release notes](https://github.com/rubocop/rubocop-factory_bot/releases)
- [Changelog](https://github.com/rubocop/rubocop-factory_bot/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-factory_bot/compare/v2.23.1...v2.24.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 18:37:08 +00:00
Javi Martín
edcef9e8a8 Merge pull request #5270 from consuldemocracy/dependabot/bundler/view_component-3.6.0
Bump view_component from 3.5.0 to 3.6.0
2023-10-03 20:34:30 +02:00
dependabot[bot]
eb04ec1bf9 Bump view_component from 3.5.0 to 3.6.0
Bumps [view_component](https://github.com/viewcomponent/view_component) from 3.5.0 to 3.6.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.5.0...v3.6.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>
2023-10-03 17:54:46 +00:00
Javi Martín
8cc772f187 Merge pull request #5261 from consuldemocracy/dependabot/bundler/dalli-3.2.6
Bump dalli from 3.2.5 to 3.2.6
2023-10-03 19:53:17 +02:00
dependabot[bot]
5f9295db18 Bump dalli from 3.2.5 to 3.2.6
Bumps [dalli](https://github.com/petergoldstein/dalli) from 3.2.5 to 3.2.6.
- [Changelog](https://github.com/petergoldstein/dalli/blob/main/CHANGELOG.md)
- [Commits](https://github.com/petergoldstein/dalli/compare/v3.2.5...v3.2.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 17:31:14 +00:00
Javi Martín
a4441422f2 Merge pull request #5260 from consuldemocracy/dependabot/bundler/selenium-webdriver-4.13.1
Bump selenium-webdriver from 4.12.0 to 4.13.1
2023-10-03 19:15:27 +02:00
Sebastia
2e335df2f3 Merge pull request #5250 from consuldemocracy/content-block
Add new content block `footer_legal` to Footer
2023-10-03 14:03:50 +02:00
dependabot[bot]
7a587e2c12 Bump selenium-webdriver from 4.12.0 to 4.13.1
Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 4.12.0 to 4.13.1.
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
- [Commits](https://github.com/SeleniumHQ/selenium/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-01 22:04:37 +00:00
Javi Martín
0e696331b1 Merge pull request #5258 from consuldemocracy/fix_knapsack
Update bash script to run Knapsack Pro
2023-09-29 17:30:23 +02:00
Javi Martín
54cefb918e Update bash script to run Knapsack Pro
We made a few experiments with forked repositeries after applying commit
dc1e0209a and everything seems to work fine, but it looks like that
isn't the case. For instance, on pull requests opened by external
contributors, the tests aren't running.

The fix we're applying is mentioned on the Knapsack Pro repository [1]
(pull request 197).

[1] https://github.com/KnapsackPro/knapsack_pro-ruby
2023-09-29 16:10:25 +02:00
Javi Martín
a7136f71db Merge pull request #5251 from dnsos/intuitive-admin-menu-sections
Move customizations to more intuitive admin menu section
2023-09-29 14:48:47 +02:00
Dennis Ostendorf
b1bc068cb9 Remove unnecessary admin menu condition
Previously the condition was needed because _without it_ the Admin::Poll::Questions::Answers::ImagesController would have resulted in settings? evaluating to true. This was undesired because that controller was scoped under Polls, so only polls? should have evaluated to true. Now that we have moved the images link to the customization menu, this check is not necessary anymore.
2023-09-29 14:18:28 +02:00
Dennis Ostendorf
a902f9e11f Move customizations to more intuitive admin menu section
There were already some menu items to customization pages under the "Site content" menu. It therefore makes sense to move "Custom images" and "Custom content blocks" (which were previously
located under "Settings") to "Site content" as well.
2023-09-28 19:49:49 +02:00
taitus
c2f03f869a Add new footer content block
Include a new content block called 'footer_legal' for additional legal footer items.
2023-09-26 17:43:20 +02:00
Javi Martín
5e483f6d33 Merge pull request #5242 from consuldemocracy/go_back_test
Don't depend on the "Help" link in tests
2023-09-25 13:45:50 +02:00
taitus
7fd773773a Unify votes specs 2023-09-21 08:19:30 +02:00
Senén Rodero
d28ed1d17b Merge pull request #5232 from consuldemocracy/custom_concerns
Make model concerns customization easier
2023-09-18 15:48:05 +02:00
taitus
75c9b66375 Refactor footer legal links for cleaner code
Removed inline '&nbsp;|' used as a separator between footer legal links.
2023-09-14 09:51:51 +02:00
Javi Martín
b050bf39bd Add missing expectation in draft versions test
Without this expectation, the test was freezing sometimes.
2023-09-13 23:32:25 +02:00
Javi Martín
9a1dd9992a Don't depend on the "Help" link in tests
In order to leave the page using turbolinks and then going back, we were
clicking on the "Help" page link, but this link doesn't have to be
available on every Consul Democracy installation.

So we're using the link to the homepage instead.
2023-09-13 23:32:25 +02:00
Javi Martín
aa7262a1b8 Merge pull request #5235 from consuldemocracy/dependabot_interval
Update gem dependencies once a month
2023-09-13 16:15:33 +02:00
Javi Martín
40e920844b Update gem dependencies once a month
We originally set a daily interval because we hadn't updated our gem
dependencies for a year.

However, we usually wait a few days/weeks between the time a gem is
released and the moment we update it, and there are gems releasing new
versions every few days, so maintaining daily updates would become
tedious quickly.

So we're now doing it once a month. We're also increasing the limit of
open pull requests so we don't need to worry about whether dependabot is
opening pull requests for every dependency.
2023-09-12 16:20:49 +02:00
Javi Martín
cd7cec79f4 Merge pull request #5157 from consuldemocracy/ruby3.1
Upgrade Ruby to version 3.1.4
2023-09-12 16:20:16 +02:00
Javi Martín
dcb6450b23 Remove no longer needed --keep-file-descriptors option
We added this option in commit d17b2523c, but Bundler now keeps
descriptors by default. While this behavior was backported to Ruby
3.0.x, we're changing it now because, we've only noticed it now that
we're upgrading to Ruby 3.1.x, since it was first developed for that
version [1].

[1] https://github.com/rubygems/rubygems/pull/4812/commits/88b7a3e7e2
2023-09-12 15:21:47 +02:00
Javi Martín
584176adfa Add and apply Style/ArrayIntersect rubocop rule
The `intersect?` method has been added in Ruby 3.1, and it's more
readable than `(a & b).any?`.
2023-09-12 15:19:04 +02:00
Javi Martín
f87d4b589d Add and apply Naming/BlockForwarding rubocop rule
This syntax has been added in Ruby 3.1.

Not using a variable name might not be very descriptive, but it's just
as descriptive as using "block" as a variable name. Using just `&` we
get the same amount of information than using `&block`: that we're
passing a block.

We're still using `&action` in `around_action` methods because here we
aren't using a generic name for the variable, so (at least for now) we
aren't running this cop on controllers using `around_action`.
2023-09-12 15:17:28 +02:00
Javi Martín
fd9169e0d6 Update Style/HashSyntax Rubocop rule
Ruby 3.1 adds the option for hash shortcuts, so it's possible to write
`{ user: , poll: }` instead of `{ user: user, poll: poll }`.

By default, Rubocop expects the new syntax in Ruby 3.1. While right now
I absolutely hate this new syntax, we're allowing both the old and the
new styles because we might start adopting it once we get used to it.
2023-09-12 15:17:17 +02:00
Javi Martín
e74eff217b Upgrade Ruby to version 3.1.4
Note we updated the `mail` gem in commit 103742847, which is necesary
for Ruby 3.1 because it adds the net-smtp dependency. The net-smtp
library was removed from Ruby in Ruby 3.1, and if we don't include it,
we get an error:

```
cannot load such file -- net/smtp (LoadError)
```

We're also updating the Bundler version in the Gemfile.lock so it's the
one included in Ruby 3.1. Without updating it, we get a warning:

```
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)'
has been deprecated. Please call `DidYouMean.correct_error(error_nam e,
spell_checker)' instead.
```

Finally, in order to make Capistrano work, we need to add a couple more
changes:

* Make the net-ssh gem compatible with SSL 3.0; done in commit b2eec088b
* Explicitly allow aliases in the `deploy-secrets.yml` file because
  Psych 4.x (included in Ruby 3.1) doesn't load aliases without this
  option
2023-09-12 15:17:17 +02:00
Javi Martín
bf96136ccf Merge pull request #5151 from consuldemocracy/rails_6.1
Upgrade to Rails 6.1
2023-09-12 14:48:08 +02:00
Javi Martín
3527398db1 Remove no longer needed call to default_scoped
Automatically using `default_scoped` in this context is the default
behavior in Rails 6.1.
2023-09-11 23:40:37 +02:00