Commit Graph

18014 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
c6190d0199 Remove roles when block or delete users
After a user assigned as a budget admin deletes their account or gets blocked by
a moderator, the application throws an exception while loading the admin
investment index page.

As an erased user is not really deleted and neither its associated roles, the
application was failing when trying to sort and administration without a
username. In this case, the application was throwing an `ArgumentError:
comparison of NilClass with String failed` exception.

As a blocked user is not deleted or its roles, the application failed when trying
to access the user name through the delegation in the Administrator. In this
case, the application was throwing a `NoMethodError: undefined method `name' for
nil:NilClass` exception.
2022-05-04 16:37:35 +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
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
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
e18f85a570 Merge pull request #4825 from consul/fix_selecting_text_in_budget_header
Fix link and text selection in budget header
2022-05-04 09:43:40 +02:00
Sebastia
8a0cb2f277 Merge pull request #4824 from consul/rails-5.2.7.1
Bump Rails from 5.2.7 to 5.2.7.1
2022-05-04 09:20:58 +02:00
Javi Martín
bfe6c1862d Fix link and text selection in budget header
While reviewing commit 7702b551e, I forgot to test whether selecting
text in the budget header or clicking its link worked properly.

The negative index (-5) meant it was impossible to select its text or
click on its link.

The good news is the pseudoelement with a negative index (-1) is
considered a child of the .budget-header element, so having a negative
index will cause the pseudoelement to be render behind the content of
the .budget-header element but in front of the background of the
.budget-header element.

This is exactly what we want.

Originally, we didn't have a z-index in the .budget-header element,
meaning the pseudoelement was rendered behind the background of the
.budget-header element, meaning both backgrounds were visible. This was
OK when the background was a plain color, but it wasn't when the
background was an image.

To stress the fact that the budget header is only affected when we use
an image, I'm also moving the code inside the `.with-background-image`
selector, although it would be interesting to check whether it's a good
idea to add `z-index: 0` to the `full-width-background` mixin.
2022-05-03 21:00:08 +02:00
Javi Martín
d05fa803f2 Merge pull request #4814 from iraline/fix_background_4786
Fix background image from Participatory Budgets page
2022-05-03 20:22:16 +02:00
Sebastia
e346bdc861 Merge pull request #4816 from consul/i18n-conventions
Add development instructions regarding i18n translations
2022-05-03 19:51:34 +02:00
Javi Martín
01634e862d Merge pull request #4810 from consul/budgets_map
Show budgets map only if feature is enabled
2022-05-03 19:27:08 +02:00
Javi Martín
9e41a6c92d Merge pull request #4823 from consul/missing_relation
Fix crash deleting admin with assigned budgets
2022-05-03 19:06:46 +02:00
Senén Rodero Rodríguez
d797ec3ca0 Fix crash deleting admin with assigned budgets
Add missing relation between administrator and budget_administrators, otherwise
we'd get the following exception when deleting and administrator with assigned budgets:

PG::ForeignKeyViolation:
ERROR:  update or delete on table "administrators" violates foreign key constraint "fk_rails_ee7dc33688" on table "budget_administrators"
DETAIL:  Key (id)=(3) is still referenced from table "budget_administrators".
2022-05-03 18:39:42 +02:00
Javi Martín
82ef55256a Bump Rails from 5.2.7 to 5.2.7.1
This version fixes a couple of security issues in Rails.
2022-05-03 13:17:34 +02:00
decabeza
d517403234 Show budgets map only if feature is enabled 2022-05-03 12:56:12 +02:00
Javi Martín
8befe55ba1 Remove obsolete feature_maps? method
It isn't used since commit c34aa5412.
2022-05-03 12:56:08 +02:00
Senén Rodero Rodríguez
514494fbf5 Add instructions regarding i18n translations 2022-05-03 10:44:55 +02:00
Javi Martín
e8b33ae25b Remove obsolete expectations in budget index test
We forgot to do so in commit 04605d5d5. Before that commit, we were
testing the links weren't displayed in the "informing" phase as opposed
to the "finished" phase. After that commit, they weren't displayed
anywhere since a <select> field was shown instead.

Since then, we've replaced the <select> field with the links generated
by the `Budgets::Investments::FiltersComponent`. We've already got tests
for these links.
2022-05-02 20:25:29 +02:00
Javi Martín
cf7fe89ddd Revove obsolete references in budget component
These helpers aren't used here since commit 090f1bcdd.
2022-05-02 20:25:29 +02:00
Javi Martín
69ae2d31ee Extract component to render the budget map
We're going to make a change, and it's easier if we've already got a
component with tests so we don't have to write system tests to check
whether the map is rendered.
2022-05-02 20:25:25 +02:00
Javi Martín
0d70b76331 Merge pull request #4807 from consul/api_votes
Remove and simplify API and votes-related code
2022-05-02 18:24:54 +02:00
Javi Martín
60579f7e16 Fix typos in user public API methods
We were returning an (empty) association of users instead of empty
associations of proposals, debates or comments. The code worked because
in the end it returned an empty array, but looked weird nevertheless.
2022-05-02 17:29:48 +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
Javi Martín
4be609bc6d Merge pull request #4822 from consul/banner_link
Fix banner link on Chromium 101
2022-05-02 17:16:14 +02:00
Javi Martín
e4e359339f Fix banner link on Chromium 101
After upgrading to Chrome/Chromium 101, the test "Cross-Site Scripting
protection banner URL" was failing with the message:

Element <a>...</a> is not clickable (...) Other element would receive
the click: <div class="banner" style="background-color:#FF0000;">...</
div>

The reason was that, when using the structure of a link with one <h2>
and one <h3> inside, previous versions of Chrome/Chromium considered the
margin between the <h2> and the <h3> part of the link.  Version 101 does
the same thing Firefox does and so clicking on the space between the
<h2> and the <h3> doesn't result in clicking the link.

In order to keep the previous behavior, we're adding a `display: block`
tag to a link.

Note that, in the future, we might change the structure of the banner,
since using <h3> as a subheading is discouraged by the W3C, and we
aren't sure about the usability of making the whole banner clickable.
But, for now, we're just fixing the issue so our test suite is green
again.
2022-05-02 15:11:22 +02:00
Javi Martín
fef39cad24 Move banner styles to their own stylesheet
Since we've already got a banner component, we follow the convention of
using one CSS file per component. We also reduce the number of lines in
the huge layout.scss file.

Now the sections in layout.scss from "17" to "19", just like they jump
from "08" to "10".
2022-05-02 15:00:51 +02:00
Iraline
ac16bd9395 Merge branch 'fix_confirmation_token_2746' of https://github.com/iraline/consul into fix_confirmation_token_2746 2022-04-27 12:06:09 -03:00
Iraline
985ab4faad Tests to validate the flow of token already used 2022-04-27 12:04:16 -03:00
Iraline
7702b551ec Fixing background image from Participatory Budgets page 2022-04-27 09:13:44 -03:00
iraline
f253518e1a Merge branch 'consul:master' into fix_confirmation_token_2746 2022-04-26 09:50:57 -03: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
Iraline
996a2888e7 Changing message location of user already confirmed 2022-04-18 16:34:33 -03:00
Iraline
6c03e258fa Added conditional to check if token has already been used 2022-04-18 13:56:18 -03: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
Javi Martín
d0f3bdf589 Merge pull request #4808 from consul/dependabot/bundler/nokogiri-1.13.4
Bump nokogiri from 1.13.3 to 1.13.4
2022-04-12 15:03:00 +02:00
Javi Martín
ca99357701 Merge pull request #4805 from consul/search_results_html_injection
Fix HTML injection in search results summary
2022-04-12 14:47:24 +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
taitus
2464b517c1 Add hint information related to phase dates 2022-04-12 14:41:48 +02:00
dependabot[bot]
079bdc4fad Bump nokogiri from 1.13.3 to 1.13.4
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.3 to 1.13.4.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/v1.13.4/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.3...v1.13.4)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-12 14:40:01 +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
1c93a3cebb Simplify search results summary layout 2022-04-12 14:23:35 +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
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