Commit Graph

5484 Commits

Author SHA1 Message Date
Javi Martín
e7b271fb47 Remove obsolete comment in environment files
We removed the assets initializer in commit 91cd1ce1b.
2022-07-19 23:13:35 +02:00
Javi Martín
7b91adb16f Use the same config for staging and preproduction
We were already doing so by duplicating the code; now we're doing it
explicitly.

This is going to help because we're going to do a few changes in the
environment files, and this way we don't have to do everything twice.

Note that, after we're finished with these changes, the staging and
production environments will be mostly identical and we could simply
require the production environment configuration in the `staging.rb`
file. We aren't doing so because some Consul installations might have
customized these files and it'd be hard for them to deal with all these
changes at once. So, for now, they'll only have to deal with the
possible differences between their staging and preproduction
environments.

Changes to the preproduction environment that won't be applied to the
staging environment can be added like this:

require Rails.root.join("config", "environments", "staging")

Rails.application.configure do
  config.log_level = :warn
end
2022-07-19 23:13:08 +02:00
Consul Bot
a00c3dad2a Update translations from Crowdin 2022-07-05 13:19:58 +02:00
Senén Rodero Rodríguez
320e1948fc Do not render message when there are zero participants without demographic data 2022-06-14 10:48:48 +02:00
Senén Rodero Rodríguez
184a856538 Remove translation duplicates
At some point we duplicated these keys unintentionally.
2022-06-14 10:48:48 +02:00
Consul Bot
576164b192 Update translations from Crowdin 2022-06-14 10:47:13 +02:00
Javi Martín
5c1da85dca Merge pull request #4848 from consul/banner_destroy_notice
Add notice after destroying a banner
2022-06-07 11:31:06 +02:00
Javi Martín
0f9d6c47a3 Merge pull request #4847 from consul/legacy_annotations_route
Remove legacy annotations route
2022-06-03 20:14:58 +02:00
Javi Martín
7e89ecbb37 Merge pull request #4841 from consul/customize_graphql
Make it possible to customize GraphQL types
2022-06-03 12:28:29 +02:00
Sebastia
77825ed13f Merge pull request #4818 from consul/emails_styles
System emails design
2022-06-03 08:40:54 +02:00
Javi Martín
d4c62e2fc6 Add notice after destroying a banner
We were missing a notice in this case. Not only this caused
inconsistencies in the user experience, but it also made it hard to add
an expectation in the test checking the request had finished before
making a new one. Simultaneous requests sometimes cause failures in our
test suite.
2022-06-02 19:05:02 +02:00
Javi Martín
274b0f9b43 Remove legacy annotations route
We forgot to remove it in commit 54e59a8a5. We were getting an exception
on production when accessing the `/annotations/search` route because of
it.
2022-06-02 18:17:52 +02:00
decabeza
8c078ae0a9 Add missing heading title on mailers 2022-06-02 17:56:18 +02:00
Javi Martín
4eea69faee Make it possible to customize GraphQL types 2022-06-02 16:22:25 +02:00
Javi Martín
cd3b196a04 Make it clear what verified users can vote for
"Participate in the final voting" was a concept which was hard to
understand since many people would think it was related to the
voting/polls section and that somehow there was going to be a "final"
poll.

So we use "Vote for budget projects" instead.

Thanks Pomerange for the suggestion.
2022-06-01 14:27:33 +02:00
Javi Martín
92b1e53fc3 Unify user permission texts
We had the same texts four times, with slight variations in the case of
the management section.

We're unifying them under the "verification" i18n namespace, since the
texts are about actions which can be done depending on whether users are
verified or not.

Note the names of the i18n keys aren't very consistent, since we use
"debates" in plural but "proposal" in singular. We're leaving it like
this so existing translations aren't affected.
2022-06-01 14:27:33 +02:00
Javi Martín
67e9c68662 Remove confusing permission info in "my account"
We were saying that actions marked with an asterisk were only possible
when users were verified. However, there were no actions marked with an
asterisk; instead, we didn't show these actions to non-verified users.

Besides, the concept of Census doesn't exist in many CONSUL
installations, where verification is done through other means, so the
text saying that only users on Census could do certain things wasn't
correct in these cases.

Due to that, we're removing the asterisk in the Spanish version as well.
We're also removing the asterisk in the default welcome pages, since
we're already saying which action can't be done until the account is
verified.

In the case of the residence verification page, we had asterisks but we
didn't explain what the asterisk stood for, so we're also removing it.
2022-06-01 14:27:33 +02:00
Javi Martín
ca4a0bd4b2 Use "login details" instead of "credentials"
As suggested by Pomerange, "credentials" also refers to academic
qualifications, and so might be confusing.
2022-06-01 14:27:33 +02:00
Javi Martín
541c434e7d Fix show/hide recommendations text
As suggested by Pomerange; "proposals" sounded strange as an adjective.
2022-06-01 14:27:33 +02:00
Javi Martín
647a7dc435 Fix text to subscribe to a newsletter
In English, circumstancial complements usually go after the direct
complement.
2022-06-01 14:27:33 +02:00
Javi Martín
4ddcfb2f2a Use "participate in" instead of "participate on"
As suggested by Pomerange.
2022-06-01 14:27:33 +02:00
Javi Martín
d776923ffe Use "withdraw" instead of "retire"
We used "retire" because we translated it literally from the Spanish
verb "retirar" which can mean both "retire" and "withdraw".

Note we're still using "retire" in database fields and method names;
changing that might make it harder to upgrade from a previous version of
CONSUL.
2022-06-01 14:27:33 +02:00
Javi Martín
dac6c714cf Use "help with" instead of "help about"
As suggested by Pomerange; the "help about" construction indeed sounds a
bit strange.
2022-06-01 14:27:33 +02:00
Finn Heemeyer
c984e666ff Add new GraphQL types, schema (with fields) & base mutation
The current consul GraphQL API has two problems.

1) It uses some unnecessary complicated magic to automatically create
   the GraphQL types and querys using an `api.yml` file. This approach
   is over-engineered, complex and has no benefits. It's just harder to
   understand the code for people which are not familiar with the
   project (like me, lol).

2) It uses a deprecated DSL [1] that is soon going to be removed from
   `graphql-ruby` completely. We are already seeing deprecation warning
   because of this (see References).

There was one problem. I wanted to create the API so that it is fully
backwards compatible with the old one, BUT the old one uses field names
which are directly derived from the ruby code, which results in
snake_case field names - not the GraphQL way. When I'm using the
graphql-ruby Class-based syntax, it automatically creates the fields in
camelCase, which breaks backwards-compatibility.

So I've added deprecated snake_case field names to keep it
backwards-compatible.

[1] https://graphql-ruby.org/schema/class_based_api.html
2022-06-01 11:41:09 +02:00
Sebastia
5c6ab81c38 Merge pull request #4820 from consul/legislation_processes_alert
Remove unnecessary alert on legislation processes
2022-06-01 11:03:02 +02:00
decabeza
f6da129857 Add census terms page by default 2022-05-04 16:22:46 +02:00
decabeza
00f0c4410d Remove unnecessary alert on legislation processes 2022-05-04 12:51:21 +02:00
Javi Martín
5977f2ec3d Simplify methods to get API-public records
Just like we did to tags in commit 2e863fdc5.
2022-05-02 17:16:31 +02:00
Javi Martín
0a3c86b92e Remove method to get votes for budget investments
After commit 0214184b2, this method was only used in two places and was
only useful in one of them. IMHO it isn't worth it add a monkey-patch
for such a minor usage.
2022-05-02 17:16:31 +02:00
Javi Martín
c25ab8e4a6 Remove unused vote extensions methods
These methods aren't used since commit b98244afd.
2022-05-02 17:16:31 +02:00
Sebastia
7d1c67261c Merge pull request #4228 from consul/already_confirmed_user_emails
Send informative email for already confirmed users
2022-04-20 09:54:37 +02:00
Julian Herrero
ad018c6f39 Send informative email for already confirmed users
Currently the application does not send any email to confirm the
account for already confirmed users. But we show a notice message
that may look like you will recive one:

"If your email address exists in our database, you will receive
 an email with instructions for how to confirm your email address
 in a few minutes."

In this commit we keep the original message, but send an email to
the user informing them that their account is now registered.

This way no one can know if someone else's account is confirmed and
we don't have to worry about GDPR either.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
2022-04-19 17:03:02 +02:00
taitus
d0571a4a73 Improve confirmation instructions texts
The texts for the confirmation instructions referred to "reset the password".
We have updated the texts to refer to confirmation instructions.
2022-04-19 16:53:30 +02:00
Javi Martín
96da3153ee Merge pull request #4798 from consul/docker_cleanup
Clean up Docker configuration
2022-04-12 18:26:37 +02:00
Sebastia
810a516078 Merge pull request #4806 from consul/budget_phases_hint
Add and improve hint information related to phases duration
2022-04-12 15:50:20 +02:00
taitus
703e28e6cd Add information to the phase table to clarify its functionality.
Add a help text on admin budget show page and improve text from Admin::Budgets::HelpComponent in order to
clarify its functionality when we are using the wizard.
2022-04-12 15:22:29 +02:00
taitus
2464b517c1 Add hint information related to phase dates 2022-04-12 14:41:48 +02:00
Javi Martín
5c0aa42351 Remove duplication in search results summary
We were using very similar code for proposals, debates and investments,
so we might as well share the code between them.

Note we're using the `proposals.index.search_results` key even for
debates and investments. This will still work because the translations
shared the same text, but IMHO we should rename the key to something
like `shared.search_results_summary`. We aren't doing so because we'd
lose all the existing translations.
2022-04-12 14:23:14 +02:00
taitus
dbc51bcdcd Improve hint information related to duration phases
Specify that this field is for information purposes only and
does not automatically update phase status.

We also improve enable help text.
2022-04-12 13:23:59 +02:00
Javi Martín
fa56a74ba0 Activate sync mode for standard output
By default, in order to increase performance during IO operations, Ruby
doesn't immediately write to the standard output but uses a buffer
internally and writes the output in chunks [1].

It looks like this results in some output being missed when running
Docker Compose [2], so we're activating the sync mode, which flushes all
output immediately.

[1] https://ruby-doc.org/core-2.6.5/IO.html#method-i-sync-3D
[2] See issue 1118 in the sinatra/sinatra repository
2022-04-08 16:13:09 +02:00
Javi Martín
3752fef6bf Remove map page in debates
The map feature was never implemented for debates (only for proposals
and budget investments) and it was crashing for debates because the page
didn't load the geozones. And we don't have a "geozone" field in the
debates form either.

So we're removing the map page alongside its (pending implementation)
tests.
2022-04-07 15:34:07 +02:00
Senén Rodero
3ecf2feb2e Merge pull request #4601 from consul/budgets_hide_money
Add hide money option for approval budgets
2022-03-30 09:58:29 +02:00
decabeza
abc4e9dca1 Manage the render of the price field on public investment section 2022-03-29 14:49:27 +02:00
decabeza
80e64590b7 Allow enable 'hide_money' check on admin budget form
Add new 'hide_money' field to admin budget form.

Only display new field 'hide_money' when voting style is 'approval'
2022-03-29 14:49:25 +02:00
Javi Martín
b5a4609b56 Make it easier to customize validations
There are CONSUL installations where the validations CONSUL offers by
default don't make sense because they're using a different business
logic. Removing these validations in a custom model was hard, and that's
why in many cases modifying the original CONSUL models was an easier
solution.

Since modifying the original CONSUL models makes the code harder to
maintain, we're now providing a way to easily skip validations in a
custom model. For example, in order to skip the price presence
validation in the Budget::Heading model, we could write a model in
`app/models/custom/budget/heading.rb`:

```
require_dependency Rails.root.join("app", "models", "budget", "heading").to_s

class Budget::Heading
  skip_validation :price, :presence
end
```

In order to skip validation on translatable attributes (defined with
`validates_translation`), we have to use the
`skip_translation_validation` method; for example, to skip the proposal
title presence validation:

```
require_dependency Rails.root.join("app", "models", "proposal").to_s

class Proposal
  skip_translation_validation :title, :presence
end

```

Co-Authored-By: taitus <sebastia.roig@gmail.com>
2022-03-24 17:05:35 +01:00
Javi Martín
dba68c2c04 Fix deprecation warning in Tagging monkey patch
We were getting a warning in Rails 6.0:

DEPRECATION WARNING: Class level methods will no longer inherit scoping
from `public_for_api` in Rails 6.1. To continue using the scoped
relation, pass it into the block directly. To instead access the full
set of models, as Rails 6.1 will, use
`ActsAsTaggableOn::Tag.default_scoped`.
2022-03-21 20:43:50 +01:00
Javi Martín
2e863fdc51 Fix OR condition in public taggings
In SQL, conditions like:

```
tag_id IN (x) AND taggable_type='Debate' OR taggable_type='Proposal'
```

Don't work as intended; we need to write:

```
tag_id IN (x) AND (taggable_type='Debate' OR taggable_type='Proposal')
```

Due to this bug, we were returning taggings for proposals without
intending to do so.

Since the code was very hard to read, we're also simplifying it.
2022-03-21 20:43:50 +01:00
Javi Martín
95c1999cca Make it easier to customize JavaScript functions
When there was a custom JavaScript file, we weren't loading the original
one, meaning that, in order to customize it, it was necessary to copy
the whole original file and then changing it.

Now we're loading both the original and the custom file, so the custom
file can simply add more functions or overwrite the ones we'd like to
customize, without copying the whole file.

Existing copies of original files will still overwrite the whole file
and won't be affected.
2022-03-18 16:43:14 +01:00
Javi Martín
7212657c02 Remove Paperclip and use just Active Storage 2022-02-23 18:43:48 +01:00
Javi Martín
600f5c35e9 Use file_validators instead of Papeclip validations
Since we're going to remove Paperclip and Active Storage doesn't provide
any validations, we have to either write our own validation rules or use
a different gem.

We're using the file_validators gem instead of the
`active_storage_validations` gem because the latter doesn't support
proc/lambda objects in size and content type definitions. We need to use
them because in our case these values depend on settings stored in the
database.
2022-02-23 18:21:38 +01:00