Commit Graph

5270 Commits

Author SHA1 Message Date
taitus
41b9705563 Unify unsubscribe section styles with others emails 2022-06-02 11:24:19 +02:00
taitus
7ff62532df Unifiy proposal notification digest with others emails
The notification digest title did not look the same as other mail.  We
removed the table for the title to make it more consistent with the rest of
the emails.
2022-06-02 11:24:19 +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
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
Javi Martín
6382028142 Use page_path to generate the census_terms URL
We had a link to `/census_terms`, and by looking at the code, it wasn't
so clear where this URL came from.

Using `page_path`, it's easier to understand that it comes from a page
with the `census_term` slug. It also means we'll find this line when
searching for usages of `page_path` in the code.
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
b74b63cb72 Remove unused partial
It isn't used since commit 5d37997a6, when it was replaced with the
`debate.html.erb` template.
2022-05-04 12:19:28 +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
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
bdf4d6a79c Do not use the wizard component when edit phases
Currently we were using the wizard component to edit a
phase when we were no longer in the wizard.

This was a bit strange, as it took us out of the context
and showed us information such as the
CreationTimelineComponent or the HelpComponent
that is meant for when navigating the Wizard.
2022-04-12 14:41:48 +02:00
Javi Martín
2684fc70d3 Show either investments header or results summary
We were showing the header when there were no search terms but there
were advanced search filters, unlike what we do for debates and
proposals. Besides, we were already hiding the header when there were
search terms, so it makes sense to hide it when using the advanced
search too.

We're using the `@search_terms` and `@advanced_search_terms` instance
variables in order to be consistent with what we do in the debates and
proposals sections.
2022-04-12 14:24:24 +02:00
Javi Martín
015613a140 Fix HTML injection in search results summary
In commit f374478dd, we enabled the possibility to use HTML in the
search results translations in order to add a <strong> tag to these
results. However, that meant we were also allowing HTML tags inside the
search term itself, and so it was possible to inject HTML on the page.

Stripping the HTML tags solves the issue.

Note the issue wasn't a high severity issue because tags such as
`<script>` weren't allowed since we were using the `sanitize` helper.
2022-04-12 14:23:35 +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
Javi Martín
de35e93611 Remove empty paragraph in proposals search summary
We were accidentally introducing an empty paragraph because of a typo.
2022-04-10 13:51:10 +02:00
Javi Martín
b16bd2d461 Fix background style in investments search summary
The background wasn't expanding to the edge of the page because we
forgot to do this when we did the same thing for proposals and debates
in commit 4c47eab60.
2022-04-10 13:48:45 +02:00
Javi Martín
8aff5e95d6 Fix term in investments advanced search results
When using the advanced search in the debates and proposals sections, we
were not displaying the search term in the search results summary.
However, we were displaying it when using the advanced search in the
investments section.

Now we're doing the same thing everywhere.
2022-04-10 13:48:27 +02:00
Javi Martín
e637bce3d8 Fix error messages for question answer images
Since we were creating a new answer in the form, we weren't getting the
errors associated to the answer the administrator was trying to create,
and so we were skipping the test.

Using the answer which contains the information about validation errors
fixes the issue and so we don't have to skip the tests.
2022-04-07 15:34:10 +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
Julian Herrero
0c9a46221e Show assigned heading on investment show 2022-03-31 17:00:24 +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
8c3b222c98 Manage the render of the price field on valuation investments section 2022-03-29 14:49:29 +02:00
decabeza
4c0499d53b Manage the render of the price field on budgets results section 2022-03-29 14:49:28 +02:00
decabeza
40bdd1f03a Manage the render of the price field on admin investments section 2022-03-29 14:49:27 +02:00
decabeza
9fb5019f0f Manage the render of the price field on admin budget headings
Avoid displaying the price in admin budget headings section
and avoid fill the field 'price' in admin budget headings form
when the budget has been checked with hide_money field.
2022-03-29 14:49:26 +02:00
Javi Martín
12460c2000 Merge pull request #4789 from consul/rails_6.0_compatibility
Add Rails 6.0 compatibility
2022-03-23 14:14:11 +01:00
Javi Martín
3f84ab0758 Add test case for adding budget poll results
While writing the test, we noticed it didn't work because the labels
weren't correctly generated, so we're fixing them as well.
2022-03-21 21:33:07 +01:00
Javi Martín
94d4e1db1e Use render template: instead of render file:
We did a similar change in commit 47925fbab, and we were getting a
warning in Rails 6.0:

DEPRECATION WARNING: render file: should be given the absolute path to a
file

Since using `render file:` would ignore views in custom folders, we're
using `render template:` instead.
2022-03-21 20:43:50 +01:00
Javi Martín
7212657c02 Remove Paperclip and use just Active Storage 2022-02-23 18:43:48 +01:00
Javi Martín
8e6df7f5d9 Use Active Storage to render custom images
Just like we did with regular attachments, we're moving the logic to
generate URLs out of the model.

Note we're changing the `image_path_for` helper method in order to
return a `polymorphic_path` because sometimes it's used in combination
with `favicon_link_tag`, and `favicon_link_tag` doesn't automatically
generate a polymorphic URL when given an `ActiveStorage::Attachment`
record.
2022-02-23 18:21:38 +01:00
Javi Martín
091abfc944 Use Active Storage to render attachments
This way we fix a bug we mentioned in commit 930bb753c which caused
links to documents to be broken when editing their title because the
title was used to generate the URL of the document.

Note we're still using Paperclip to render cached attachments because
this is the only case where we store files with just Paperclip and not
Active Storage.

With Active Storage, we render attachments just like any other resource,
using `polymorphic_path`. Paperclip included the `url` method in the
model; since the model doesn't have access to the request parameters
(like the host), this was inconvenient because it wasn't possible to
generate absolute URLs with Paperclip.

In order to simplify the code and make it similar to the way we used
Paperclip, we're adding a `variant` method accepting the name of a
variant and returning the variant.
2022-02-23 18:21:38 +01:00
Javi Martín
9c4d406a77 Unify the logic to show the "not allowed" message
We were using the same logic six times regarding when we should show a
"participation not allowed" message. Since we're going to change the
current behavior, we're unifying the logic in one place so the changes
will be easier.
2022-02-23 16:43:37 +01:00
Javi Martín
a0b4e35dbd Show login to comment message in annotations
This way it's consistent with what we get when there are no comments. It
only appears once on the page so it isn't overwhelming.
2022-02-21 18:48:09 +01:00
Javi Martín
9154614577 Always show not allowed message in legislation debates
This message is only shown in the `show` action, so it's shown at most
once in the whole page, so it doesn't take up too much space and it
isn't as overwhelming as if we were showing it on the index page, once
per debate.

We're only showing it when there are closed options, though, since
there's already a message to sign in to comment when the question
accepts open answers.
2022-02-21 18:48:09 +01:00
Javi Martín
9a625fe59f Remove redundant "participation not allowed" code
Very similar code is present in the `votes.js` file. Since the only
elements with the `js-participation-not-allowed` class also matched the
`div.supports div.participation-not-allowed` selector, for these
elements the events were executed twice.

So we can get rid of the `js-participation` class alongside all the
JavaScript code referencing it.
2022-02-21 18:47:13 +01:00
Javi Martín
4b42a68b6a Use the vote action to vote featured proposals
The action and the views were almost identical, with the supports
progress and the HTML classes of the success message element being the
only exceptions; we can use CSS for the styles instead.
2022-02-21 18:47:13 +01:00
Javi Martín
b98244afd9 Remove votes query optimizations
Just like we did in commit 0214184b2d for investments, we're removing
some possible optimizations (we don't have any benchmarks proving they
affect performance at all) in order to simplify the code.

The investement votes component `delegate` code was accidentally left
but isn't used since commit 0214184b2, so we're removing it now that
we're removing the `voted_for?` helper method.
2022-02-21 18:47:13 +01:00
Javi Martín
78f372fd0b Move votes partials to components
We're going to change the code quite a bit, and with components we can
easily extract methods when necessary.
2022-02-21 18:47:13 +01:00
Javi Martín
0bacd5baf3 Remove unused legislation proposals index action
The `legislation_proposals#index` action was never used because it used
the same URL as `legislation_processes#proposals`.

In commit 702bfec24 we removed the view, but we forgot to remove the
controller action, the route, and some partials which were rendered from
the index view.
2022-02-21 18:47:13 +01:00
Javi Martín
3e89a1dd53 Merge pull request #4301 from consul/unsubscribe
Include link to unsubscribe in email notifications
2022-01-21 20:43:43 +01:00
taitus
13965901f8 Update "newsletter" notification email to add unsubscribe link 2022-01-21 20:21:52 +01:00
taitus
1fcbd49448 Update "reply" notification email to add unsubscribe link
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.

We also adapted the existing generic text by adding a description of
the related notification.
2022-01-21 20:21:52 +01:00
taitus
478ac3a952 Update "proposal" notification email to add unsubscribe link
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.
2022-01-21 20:21:52 +01:00
taitus
a36f3feb87 Update "direct message" notification email to add unsubscribe link
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.
2022-01-21 20:21:52 +01:00
taitus
0af765a3bd Update "comment" notification email to add unsubscribe link
We modified the link that previously redirected us to the "My content"
page to redirect us to the new page for managing subscriptions.

We also adapted the existing generic text by adding a description of
the related notification.
2022-01-21 20:21:52 +01:00
taitus
6d9e4a9330 Allow users to manage their notifications
The user can access this page without being logged in.
We identify the user through the "subscriptions_token" parameter and
show a list of the notifications that can be enable/disable.

We will return a 404 error in case someone accesses the page with a
non-existent token.

We also control the case that some anonymous user tries to access the
page without any token, by returning the CanCan::AccessDenied exception.
2022-01-21 18:58:38 +01:00
Javi Martín
c5103d3025 Fix generating dashboard poster on production
In commit 905ac48bb we mentioned:

> Since we don't use `asset_path` to reference assets in the public
> folder, we can safely disable the `unknown_asset_fallback` option.

However, `asset_path` is used by the wicked_pdf gem when calling the
`wicked_pdf_stylesheet_link_tag` method. This method also checks the CSS
files, searching for `url()` calls and converting any relative URLs
referenced there to absolute URLs.

However, when compiling assets on production, our `application.css` file
contains the following line imported from Leaflet which says:

```
behavior: url(#default#VML);
```

When passing this URL to `asset_path` (which is something the wicked_pdf
gem does automatically), it doesn't find the URL, and so this call
crashes unless we enable then `unknown_asset_fallback` option.

Since the dashboard poster is a feature we might remove in the future,
we're avoiding changing a Rails global configuration just for this
feature. So, instead of enabling the `unknown_asset_fallback` option,
we're changing the `poster.pdf` view so it doesn't load all the CSS of
the application but only the CSS it needs.

Note we aren't adding a test case because this bug is only present on
production environments when assets have been precompiled.
2022-01-12 13:45:59 +01:00
Javi Martín
791b2e12f7 Fix invalid HTML introduced by Foundation
See foundation/foundation-sites issue 12167, which was fixed in
Foundation 6.7.1. However, since Foundation 6.7 requires Node 12 and the
foundation-rails gem hasn't been maintained for a year and a half, we're
not updating for now.
2021-12-30 17:05:07 +01:00
Javi Martín
231a7aa8ee Remove unused code to track events
We forgot to remove it in commit f28a5cc49.

The generated HTML was invalid, with the error:

> Element meta is missing one or more of the following attributes:
> content, property.
2021-12-30 17:05:07 +01:00