Commit Graph

16247 Commits

Author SHA1 Message Date
Javi Martín
0f5943b6a8 Merge pull request #4537 from consul/i18n_crowdin
Update translations from Crowdin
2021-06-03 17:19:01 +02:00
Senén Rodero Rodríguez
b2de9dbb65 Update translations from Crowdin 2021-06-03 15:34:18 +02:00
Javi Martín
414eba83ec Merge pull request #4522 from consul/budget_without_phases
Fix crash with budgets with disabled current phase
2021-06-02 19:13:33 +02:00
Javi Martín
93a7d28a82 Fix crash with budgets with no published phases
In this case, the duration of the budget cannot be determined, and the
application was crashing when trying to do so.

Now we're just returning `nil` as duration.
2021-06-02 18:00:17 +02:00
Javi Martín
69ade5b131 Fix crash with budgets with disabled current phase
There's an edge case where the current phase of the budget was disabled.
In this case, the application was crashing.

I'm not sure what we should do regarding this case. Is it OK to allow
disabling the current phase? Is it OK to allow selecting a disabled
phase as the current phase?

Since I'm not sure about it, for now I'm leaving it the same way it was.

Co-authored-by: Julian Herrero <microweb10@gmail.com>
2021-06-02 18:00:17 +02:00
Javi Martín
c592d80257 Merge pull request #4528 from consul/budget_with_administrators
Fix crash destroying budgets with admins/valuators
2021-06-02 17:59:31 +02:00
Javi Martín
a0942f66bf Fix crash destroying budgets with admins/valuators
We don't allow deleting a budget with associated investments. However,
we allow deleting a budget with associated administrators and valuators.
This results in a foreign key violation error:

PG::ForeignKeyViolation: ERROR:  update or delete on table "budgets"
violates foreign key constraint "fk_rails_c847a52b1d" on table
"budget_administrators"

Using the `dependent: :destroy` option when defining the relationship,
we remove the association records when removing the budget.

As a bonus, we reduce the number of Rubocop offenses regarding the
`Rails/HasManyOrHasOneDependent` rule. Only 72 to go! :)
2021-06-02 17:07:04 +02:00
Javi Martín
99361a958a Merge pull request #4515 from consul/application_css
Fix order loading custom styles
2021-06-02 17:04:15 +02:00
Javi Martín
f18d163cd3 Merge pull request #4535 from consul/update_parser
Bump parser from 2.7.2.0 to 3.0.1.1
2021-06-02 17:03:01 +02:00
Javi Martín
b549eb444a Allow several custom stylesheets
So other institutions customizing CONSUL can organize their custom code
as they wish to.

We're also updating the comments in the `custom.scss` file, since it was
referencing files which no longer exist.
2021-06-02 16:15:00 +02:00
Javi Martín
4d70f50a5f Fix order loading custom styles
We have to load the custom styles last so they actually override what we
do.
2021-06-02 16:14:59 +02:00
Javi Martín
0846766dd6 Load leaflet CSS before our styles
This way we don't have to use the `!important` flag to override styles.
2021-06-02 16:14:24 +02:00
Javi Martín
9885f67111 Merge pull request #4518 from consul/fix_i18n_help_images
Fix exception using locales with no help images
2021-06-02 16:14:02 +02:00
Javi Martín
44c7f7a5a2 Bump parser from 2.7.2.0 to 3.0.1.1
We were getting a warning in the development environment because the
version of parser we were using didn't support Ruby 2.6.7.
2021-06-01 01:37:49 +02:00
Javi Martín
5f92252054 Fix exception using locales with no help images
In commit 905ac48bb we activated exceptions when assets were not found,
in order to detect places where we were trying to load non-existent
images.

We got an exception for that reason: we were loading images based on the
current locale, but for some locales there was no images.

We're now using fallbacks and loading another image when the original
one isn't available.

Note we're copying the English images to images with a generic name for
the case where there's no fallback with an image. We're copying the
files instead of using symbolic links to make sure they can be
overwritten independently in other CONSUL installations.

Also note we're updating the HTML so the section gets the ID instead of
the header. That way the system test is simple.
2021-05-29 15:05:29 +02:00
Javi Martín
7024f1edf5 Extract class to find assets
So its methods can be used in other places.
2021-05-29 14:34:46 +02:00
Javi Martín
08318171f0 Extract component to render help section 2021-05-29 14:34:46 +02:00
Javi Martín
fbb40eccff Merge pull request #4512 from consul/fix_header_card_factory
Fix header card factory
2021-05-29 14:34:10 +02:00
Javi Martín
216fe8f686 Merge pull request #4521 from consul/phases_exception
Validate process dates depending on enabled phases
2021-05-29 14:28:46 +02:00
Javi Martín
b196e83121 Fix header card factory
It was using methods which don't exist.
2021-05-29 14:18:31 +02:00
Javi Martín
f55d2ab891 Validate process dates depending on enabled phases
When configuring phases in a process, we were validating the start date
or the end date is present, the other date is present too.

However, in other parts of the application we were checking whether a
phase is enabled and then assumed its dates were present if the phase
was enabled. However, we weren't validating this behavior, so it was
possible to enable a phase and leaving its dates blank, causing the
application to crash.

So, as suggested by Alberto, we're changing the validation rule so
phase dates are mandatory when a phase is enabled.

With this rule, the old validation rules are not necessary. I've
considered leaving them in order to avoid database inconsistencies.
However, I realized records having a disabled phase with its start and
end dates have always been valid. This means applications checking for
the presence of these dates instead of checking whether the phase is
enabled have never worked properly.

We don't have to change the logic anywhere else because as mentioned we
were already checking phases are enabled before using their dates.
2021-05-29 14:13:48 +02:00
Javi Martín
d5b3b25e1e Refactor legislation phases date validation rules
So now they're easier to change and we make sure the same rules apply to
all phases.
2021-05-29 13:55:29 +02:00
Javi Martín
5bcc70eda8 Fix proposals phase end date validation
So now it uses the same rules as the other phases.
2021-05-29 13:55:29 +02:00
Javi Martín
53c53e26a8 Add tests for draft and proposal phases dates
We had tests for other phases, but not for these ones.
2021-05-29 13:55:29 +02:00
Javi Martín
89545db3c0 Fix typos in processes dates validation specs 2021-05-29 13:55:29 +02:00
Javi Martín
9466aed833 Merge pull request #4529 from consul/dependabot/bundler/nokogiri-1.11.6
Bump nokogiri from 1.11.2 to 1.11.6
2021-05-28 15:48:52 +02:00
dependabot[bot]
fd8388bef7 Bump nokogiri from 1.11.2 to 1.11.6
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.11.2 to 1.11.6.
- [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.11.2...v1.11.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-28 13:15:14 +00:00
Javi Martín
2505883d00 Merge pull request #4525 from consul/rails_5.2.4.6
Bump rails from 5.2.4.5 to 5.2.4.6
2021-05-28 15:13:47 +02:00
Javi Martín
c16e29863b Merge pull request #4524 from consul/ruby_2.6.7
Upgrade Ruby to version 2.6.7
2021-05-28 14:29:51 +02:00
Javi Martín
cb49e1c6bb Bump rails from 5.2.4.5 to 5.2.4.6
Bumps [rails](https://github.com/rails/rails) from 5.2.4.5 to 5.2.4.6.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](https://github.com/rails/rails/compare/v5.2.4.5...v5.2.4.6)
2021-05-20 18:38:17 +02:00
Javi Martín
85f13f9501 Use namespace as symbol in polymorphic_path calls
Our `namespace` helper returns a string. However, Rails version 5.2.4.6
doesn't allow strings as arguments to polymorphic_path [1]

Since returning a symbol in our `namespace` helper would break other
places in the application, we're converting it to a symbol in the
methods calling `polymorphic_path`.

[1] https://github.com/advisories/GHSA-hjg4-8q5f-x6fm
2021-05-20 18:37:45 +02:00
Javi Martín
5f4dd48e25 Merge pull request #4500 from consul/dependabot/bundler/rexml-3.2.5
Bump rexml from 3.2.4 to 3.2.5
2021-05-20 17:05:39 +02:00
Javi Martín
a2113ae003 Upgrade Ruby to version 2.6.7
So get the latest security fixes in the 2.6.x series.
2021-05-20 16:43:56 +02:00
dependabot[bot]
74f18cc550 Bump rexml from 3.2.4 to 3.2.5
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.2.4...v3.2.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-20 14:11:37 +00:00
Javi Martín
c34de4b669 Merge pull request #4519 from consul/dependabot/bundler/puma-4.3.8
Bump puma from 4.3.6 to 4.3.8
2021-05-20 15:47:32 +02:00
dependabot[bot]
41f83b387e Bump puma from 4.3.6 to 4.3.8
Bumps [puma](https://github.com/puma/puma) from 4.3.6 to 4.3.8.
- [Release notes](https://github.com/puma/puma/releases)
- [Changelog](https://github.com/puma/puma/blob/master/History.md)
- [Commits](https://github.com/puma/puma/compare/v4.3.6...v4.3.8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-19 07:31:40 +00:00
Javi Martín
f49d751ba1 Merge pull request #4391 from consul/release_1.3.0
Release version 1.3.0
2021-04-27 19:37:11 +02:00
Javi Martín
6de3bd9844 Merge pull request #4479 from consul/i18n_crowdin
Update translations from Crowdin
2021-04-27 19:01:19 +02:00
Javi Martín
e69a89f3c7 Fix typos in CHANGELOG 2021-04-27 12:37:34 +02:00
taitus
9e6c8bf5b3 Release version 1.3.0 2021-04-27 12:37:34 +02:00
Javi Martín
45448374e3 Merge pull request #4497 from consul/small_screen_footer
Fix footer overflow on small screens
2021-04-27 12:34:06 +02:00
Senén Rodero Rodríguez
77c75add3d Enable Ukrainian language by default 2021-04-27 10:53:47 +02:00
Senén Rodero Rodríguez
85e9addc21 Update translations from Crowdin 2021-04-27 10:53:47 +02:00
Javi Martín
963511d4cc Fix footer overflow on small screens
On small screens, sometimes the bottom of the footer didn't have the
footer's background color.

I'm not sure why the `min-height` rule affects this outcome. However,
since this rule usually results in footer with quite a bit of empty
space at the bottom, we can simpliy remove the rule and use padding to
guarantee there's a bit of space between the text in the footer and the
bottom of the screen.
2021-04-26 19:57:31 +02:00
Javi Martín
50bf83d417 Merge pull request #4487 from consul/dependabot/bundler/oauth-0.5.6
Bump oauth from 0.5.4 to 0.5.6
2021-04-23 16:23:05 +02:00
dependabot[bot]
1e9f4a2448 Bump oauth from 0.5.4 to 0.5.6
Bumps [oauth](https://github.com/oauth-xx/oauth-ruby) from 0.5.4 to 0.5.6.
- [Release notes](https://github.com/oauth-xx/oauth-ruby/releases)
- [Changelog](https://github.com/oauth-xx/oauth-ruby/blob/master/HISTORY)
- [Commits](https://github.com/oauth-xx/oauth-ruby/compare/v0.5.4...v0.5.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-23 14:01:36 +00:00
Javi Martín
39dd039faf Merge pull request #4489 from consul/pronto_dependabot
Fix checkout in Pronto on Dependabot pull requests
2021-04-23 15:59:07 +02:00
Javi Martín
8fcb9560e0 Merge pull request #4478 from consul/update_posgres_docker
Use a maintained PostgreSQL version in Docker
2021-04-23 12:50:57 +02:00
Javi Martín
a6cda37113 Use environment variable for password in Docker
We were getting an error since we started using the postgres 9.6 image:

```
Attaching to app_1, database_1
database_1  | Error: Database is uninitialized and superuser password is not specified.
database_1  |        You must specify POSTGRES_PASSWORD to a non-empty value for the
database_1  |        superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
database_1  |
database_1  |        You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
database_1  |        connections without a password. This is *not* recommended.
database_1  |
database_1  |        See PostgreSQL documentation about "trust":
database_1  |        https://www.postgresql.org/docs/current/auth-trust.html
```
2021-04-23 12:23:17 +02:00
Javi Martín
a5eada79c0 Fix Pronto on Dependabot pull requests
As explained in "GitHub Actions: Workflows triggered by Dependabot PRs
will run with read-only permissions" [1], we need to consider Dependabot
pull requests as external pull requests.

[1] https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
2021-04-23 00:14:16 +02:00