Commit Graph

18194 Commits

Author SHA1 Message Date
Javi Martín
96a0aa2a88 Add and apply LineContinuationSpacing rubocop rule
So now we're consistent when separating multiline strings.
2023-08-18 14:56:17 +02:00
Javi Martín
f5c2a3d4ef Add and apply BlockAlignment rubocop rule
This will make it easier to run rubocop with `--autocorrect` when
dealing with the LineLength rule.
2023-08-18 14:56:17 +02:00
Javi Martín
30befbc08a Remove obsolete code about banner images and styles
We forgot to remove it in commit 8066b96fe. We're removing it now
because these methods didn't follow the Layout/BlockAlignment rubocop
rule, which we're about to add.
2023-08-18 14:56:16 +02:00
Javi Martín
1a098dfcab Add and apply MultilineMethodCallBraceLayout rule
In order for this rule to work effectively when running `--autocorrect`,
we also need to enable the `ClosingParenthesisIndentation` rule.
2023-08-18 14:56:16 +02:00
Javi Martín
5b6de96241 Add and apply MultilineMethodCallIndentation rule 2023-08-18 14:56:16 +02:00
Javi Martín
629e208e9d Add and apply ArgumentAlignment rubocop rule
We're choosing the default `with_first_argument` style because it's the
one we use the most.
2023-08-18 14:56:16 +02:00
Javi Martín
32b1fc53e1 Add and appy MultilineOperationIndentation rule
This way it's easier to see when lines are part of multiline
statements and when they belong to `if` statements.
2023-08-18 14:56:16 +02:00
Javi Martín
8b13daad95 Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
2023-08-18 14:56:16 +02:00
Javi Martín
97aca0cf95 Add and apply rules for multi-line arrays
We were already applying these rules in most cases.

Note we aren't enabling the `MultilineArrayLineBreaks` rule because
we've got places with many elements whire it isn't clear whether
having one element per line would make the code more readable.
2023-08-18 14:56:16 +02:00
Javi Martín
1cb6268d4e Add and apply Layout/ClosingHeredocIndentation rule 2023-08-18 14:56:16 +02:00
Javi Martín
09c63e354c Add and apply Layout/DotPosition rule
Since IRB has improved its support for multiline, the main argument
towars using a trailing dot no longer affects most people.

It still affects me, though, since I use Pry :), but I agree
leading dots are more readable, so I'm enabling the rule anyway.
2023-08-18 14:56:16 +02:00
Javi Martín
fd71ae5333 Merge pull request #5177 from consuldemocracy/release_2.0.1
Release version 2.0.1
2023-08-18 13:15:28 +02:00
Senén Rodero
e064475d69 Merge pull request #5176 from consuldemocracy/i18n_crowdin
Update translations from Crowdin
2023-08-18 12:00:52 +02:00
Javi Martín
20e577d7c8 Release version 2.0.1 2023-08-17 21:13:48 +02:00
Consul Bot
582f8506c5 Update translations from Crowdin 2023-08-17 18:17:19 +02:00
Javi Martín
74b07def8f Merge pull request #5156 from consuldemocracy/fix_rubocop
Fix Rubocop convention offenses
2023-08-09 13:35:56 +02:00
Javi Martín
89d0dc0541 Merge pull request #5165 from consuldemocracy/custom_translations_in_components
Use custom translations in components
2023-08-09 13:34:43 +02:00
Javi Martín
f77c414e23 Merge pull request #5169 from consuldemocracy/fix_robots
Fix syntax in robots.txt
2023-08-09 13:32:35 +02:00
Javi Martín
7996925644 Allow current way to write respond_to blocks
Not sure exactly since when, but we've started to get rubocop failures
when using the pattern:

respond_to do |format|
  format.js
end

We've been using this pattern for ages, so maybe a recent version of
Rubocop introduced a change that made it report it.

In any case, this is easier to read than respond_to(&:js), so we're
allowing it.
2023-08-07 21:22:27 +02:00
Javi Martín
1bb8c71832 Fix syntax in robots.txt
We added the `user_id` rule in commit edaf420f5. To be honest, I'm not
sure what we meant, since I haven't found URLs containing the user id.

So we're treating it as if it was a typo and we wanted to do the same
thing we did with other parameters.
2023-08-07 14:42:13 +02:00
Javi Martín
dc3a28675e Use custom translations in components
In the `i18n_translation` initializer, we're overwriting the `t` helper
so calling it uses custom translations if they're available.

However, ViewComponent doesn't use the `t` helper but implements its own
`t` method. So, when calling the `t` method in a component, we weren't
using our implementation of the `t` helper, and so we weren't loading
custom translations.

Using the `t` helper in components solves the issue.

There was a test where we were directly testing a method in a component,
and that method uses the `t` helper. This caused an error when running
the test:

ViewComponent::Base::ViewContextCalledBeforeRenderError:
`#helpers` can't be used during initialization, as it depends on the
view context that only exists once a ViewComponent is passed to the
Rails render pipeline.

Using `render_inline` in the test and testing the generated HTML, as
recommended in the ViewComponent documentation, solves the issue.
2023-08-05 15:28:20 +02:00
Javi Martín
b986dbbbd2 Merge pull request #5162 from consuldemocracy/bump_selenium_webdriver_to_4.11
Bump selenium-webdriver from 4.0.0 to 4.11.0
2023-08-04 15:10:37 +02:00
Javi Martín
5b0fb3213d Bump selenium-webdriver from 4.0.0 to 4.11.0
Webdrivers doesn't seem to be working with GitHub Actions since Chrome
changed the way to download ChromeDriver [1].

Luckily, webdrivers functionality has recently been added directly to
selenium-webdriver, and version 4.11.0 is compatible with the new way to
download ChromeDriver.

So we're updating selenium-webdriver and removing webdrivers.

Note we now have to use the `Options` class instead of the
`Capabilities`. We're updating Capybara since its changelog mentions its
latest version also adapts these changes in Selenium.

[1] https://groups.google.com/g/chromedriver-users/c/qVPTFXnedw0
2023-08-03 00:35:16 +02:00
Javi Martín
28a9bd55c6 Merge pull request #5033 from consuldemocracy/release_2.0.0
Release version 2.0.0
2023-07-17 13:49:36 +02:00
Javi Martín
e2f31b7af7 Merge pull request #5126 from consuldemocracy/i18n_crowdin
Update translations from Crowdin
2023-07-17 13:47:40 +02:00
Senén Rodero Rodríguez
7afd921814 Enable Nepali language by default 2023-07-17 11:45:20 +02:00
Consul Bot
82f5d690c3 Update translations from Crowdin 2023-07-17 11:45:20 +02:00
Javi Martín
a5d994533c Release version 2.0.0 2023-07-13 17:52:01 +02:00
Javi Martín
d137df67bf Fix release version number in rake tasks
When we added the tasks, we thought the new version was going to be
version 1.6.0, but in the end we're renaming it to version 2.0.0.
2023-07-13 17:48:26 +02:00
Senén Rodero
c4cf7473ae Merge pull request #5150 from consuldemocracy/typos
Fix source string typo
2023-07-13 14:30:56 +02:00
Senén Rodero Rodríguez
53046a5e0f Fix English typos 2023-07-13 12:05:29 +02:00
Javi Martín
3a72776ecc Merge pull request #5149 from consuldemocracy/name_change
Update project name
2023-07-12 18:57:50 +02:00
Javi Martín
175c1a752b Remove old comment referencing the project name
It was obvious which project the comment was about. Also, no point
having a TODO referencing what to do after upgrading to Rails 5.1, since
we did it years ago.
2023-07-12 16:05:33 +02:00
decabeza
0a47a00e13 Change the logo to include the new name
Co-Authored-By: Javi Martín <javim@elretirao.net>
2023-07-12 16:05:33 +02:00
Javi Martín
7dfbf772e2 Use the new name in default settings 2023-07-12 16:05:33 +02:00
Javi Martín
3d9a23bd1b Use the new name in code comments 2023-07-12 16:05:33 +02:00
Javi Martín
054aef3854 Change URLs to use the new domain 2023-07-12 16:05:33 +02:00
Javi Martín
629756dd15 Change URLs referencing our GitHub repositories 2023-07-12 16:05:26 +02:00
Javi Martín
832a6dd8b9 Fix URL to our kanban project
We were referencing an old URL that has been obsolete for years.
2023-07-10 19:28:11 +02:00
Javi Martín
ce7b37f6f8 Change name in English and Spanish texts 2023-07-07 15:07:46 +02:00
Javi Martín
2766d8f152 Merge pull request #5144 from consul/fix_invert_selection
Fix text selection in budget header
2023-07-03 17:29:08 +02:00
Javi Martín
29a3fe4ad5 Merge pull request #5142 from consul/local_logs
Reduce log size in development/test environments
2023-07-03 17:27:40 +02:00
Javi Martín
e0a94f6a6e Reduce log size in development/test environments
Code based on the logger Rails uses by default; as mentioned in the
Rails configuration guide:

> [the logger] defaults to an instance of ActiveSupport::TaggedLogging
> that wraps an instance of ActiveSupport::Logger which outputs a log to
> the log/ directory. You can supply a custom logger, to get full
> compatibility you must follow these guidelines:
>
> * To support a formatter, you must manually assign a formatter from
>   the config.log_formatter value to the logger.
> * To support tagged logs, the log instance must be wrapped with
>   ActiveSupport::TaggedLogging.
> * To support silencing, the logger must include
>   ActiveSupport::LoggerSilence module. The ActiveSupport::Logger class
>   already includes these modules.

Just like the documentation mentions, we're enabling log rotation using
"1" as the number of old files to keep and then the maximum size of the
log file.
2023-07-03 16:16:10 +02:00
Javi Martín
db4db07853 Merge pull request #5146 from consul/delayed_job_monitor
Restart DelayedJob workers after they crash
2023-06-30 17:23:13 +02:00
Senén Rodero
37417e5829 Merge pull request #5129 from consul/geozones
Do not show geozones when there are no geozones defined
2023-06-30 17:21:20 +02:00
Javi Martín
286a128a71 Merge pull request #5106 from consul/fix_budget_background_image
Render background images with brackets in their names
2023-06-30 17:20:56 +02:00
Javi Martín
865fe706b4 Merge pull request #5145 from consul/map_wheel_on_focus
Enable mousewheel when focusing on the map
2023-06-30 11:52:20 +02:00
Javi Martín
a668ecd1a8 Merge pull request #5136 from Meet-Democracy/Legislation-draft-render-markdown-tables
Render markdown tables in legislation draft
2023-06-30 00:09:33 +02:00
Javi Martín
af618eaa45 Extract markdown helper logic to a class
This way it'll be easier for other Consul installations to overwrite
parts of the code, like the default options.
2023-06-29 20:48:01 +02:00
Javi Martín
79120209da Use the same extensions in all markdown renderers
We were using two different sets of extensions but, since the markdown
code is always written by administrators, IMHO it makes sense to be
consistent and always render markdown code the same way.
2023-06-29 20:48:01 +02:00