Commit Graph

16153 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
10d77e021e Improve remote census translation
This translation was confusing for Crowdin users.
Translators were not sure about the direction of the data.
2021-04-17 11:04:25 +02:00
Senén Rodero Rodríguez
7a11ac6606 Fix typo on source translation
Thanks to mugurcagdas from the Crowdin CONSUL community
2021-04-15 15:57:05 +02:00
Javi Martín
c0c26205e2 Merge pull request #4462 from consul/docker_2.6
Update Dockerfile dependencies
2021-04-15 13:31:24 +02:00
Senén Rodero Rodríguez
6de8c2abd7 Install shared-mime-info required to install the mimemagic gem 2021-04-15 13:12:09 +02:00
Senén Rodero Rodríguez
d95a3c4976 Install system packages required to install the pronto gem 2021-04-15 12:53:35 +02:00
Senén Rodero Rodríguez
079fd829a3 Setup a workflow to check Dockerfile build
Based on https://docs.docker.com/ci-cd/github-actions/
2021-04-15 12:53:35 +02:00
Javi Martín
baa58335cb Use Ruby 2.6 in the Dockerfile
So we use the same version defined in our .ruby-version file. Besides,
some of the gems we use are not compatible with Ruby 2.4.
2021-04-15 12:53:35 +02:00
Javi Martín
89e82926cc Merge pull request #4472 from consul/visit_after_setup
Setup database before starting the browser in tests
2021-04-14 18:18:35 +02:00
Javi Martín
9af37232b0 Merge pull request #4473 from consul/add_shared_mime_info_dependency
Add shared-mime-info dependency to README
2021-04-14 17:04:06 +02:00
Javi Martín
e1c32607e1 Merge pull request #4458 from consul/install_rvm
Speed up deployment when Ruby is already installed
2021-04-14 14:02:53 +02:00
Javi Martín
e042491169 Speed up deployment when Ruby is already installed
We were installing RVM every time we were deploying, which meant
deployments took a few extra seconds and generated a lot of unneeded
output even when we didn't have to update Ruby.

We need to update RVM when a new Ruby version needs to be installed
(otherwise we could be asking RVM to install a Ruby version which the
current RVM version cannot handle), but in every other case we're fine
using the already installed RVM version.

We're also considering the case where the RVM command is not available.
Even though the CONSUL installer installs RVM, some people might prefer
to install it through Capistrano.
2021-04-14 13:28:09 +02:00
Javi Martín
16fdffdf96 Reduce number of requests in user tests
We were adding a `visit` in a `before` block but then we started some
tests with another `visit`.

We also destroyed records in the database in between, which increased
the risk of database inconsistency since the process running the browser
had already been started.

Besides, some tests were wrong; they were visiting a page with the
browser, then destroying records in the database, and then checking the
page without reloading the browser. Since we aren't automatically
refreshing the affected areas of the page, obviously the page content
before and after destroying records is exactly the same, and the test
was passing because it's testing content that isn't there in any
situation.
2021-04-13 21:54:26 +02:00
Javi Martín
b52d381da5 Simplify emulating last_sign_in_at
We were updating the database after starting the browser to emulate the
behavior where a user logs in a day before the current request. We can
use `current_sign_in_at` instead and devise will automatically copy that
value to `last_sign_in_at` after users visit a page.

This way we avoid setting up the database after the process runnin the
browser has been started.
2021-04-13 21:54:26 +02:00
Javi Martín
8d70c9f150 Set up data before starting the browser in tests
Changing the database after the process running the browser has started
is proving to be one of the reasons tests are failing sometimes, so
we're reducing the number of times were that happens. In this case, we
were changing a setting.
2021-04-13 21:54:26 +02:00
Javi Martín
6f5180e512 Reduce number of requests in user search specs
We were adding a `visit` in a `before` block but then we started the
search tests with another `visit`.

We also created records in the database in between, which increased the
risk of database inconsistency since the process running the browser had
already been started.
2021-04-13 21:54:26 +02:00
Javi Martín
cab750c8f1 Remove redundant request in ballots spec 2021-04-13 21:54:26 +02:00
Javi Martín
95e38448c0 Reduce number of requests in dashboard poll tests
Just like we did in commit 0ec8878db, we remove the useless initial
request in the `before` filter since most tests started by visiting a
different URL.

We also reduce the risk of database inconsistency which comes with
setting up the database after the browser has been started.
2021-04-13 21:54:26 +02:00
Javi Martín
804e513c7f Remove redundant setting resets in after blocks
We forgot to remove these lines in commit da121ebc53.
2021-04-13 21:54:26 +02:00
Javi Martín
683fff935a Add shared-mime-info dependency to README
This is a mimemagic dependency since commit 25c55bfd6.
2021-04-13 21:43:06 +02:00
Javi Martín
6a3dd0504b Merge pull request #4226 from consul/delete_comments
Allow users to delete their own comments
2021-04-13 20:20:14 +02:00
Julian Herrero
0698c0ff4f Allow users to delete their own comments 2021-04-13 20:04:04 +02:00
Javi Martín
fa14976cfd Merge pull request #4442 from consul/user_search
Improve user search by email/name
2021-04-13 18:31:34 +02:00
Javi Martín
d5ee76aac2 Merge pull request #4463 from consul/fix_follow_cache
Expire cache when users follow/unfollow
2021-04-13 14:07:36 +02:00
Javi Martín
3645c333ab Expire cache when users follow/unfollow
When users followed/unfollowed a proposal or a budget investment, the
cache did not expire and so the wrong button was displayed after
reloading the page.
2021-04-13 13:52:18 +02:00
Javi Martín
d7ad1a769f Make sure users can only delete their own follows
Since we're defining abilities with cancancan and using
`load_and_authorize_resource`, we're also modifying the `create` action
for consistency.
2021-04-13 13:52:18 +02:00
Javi Martín
8a47fe3505 Avoid a brakeman security warning
Although it wasn't a real security concern because we were only calling
a `find` method based on the user input, it's a good practice to avoid
using constants based on user parameters.

Since we don't use the `find` method anymore but we still need to check
the associated record exists, we're changing the `followable` validation
in the `Follow` model to do exactly that.
2021-04-13 13:52:18 +02:00
Javi Martín
3215060e94 Merge pull request #4464 from consul/sdg_serbian_icons
Add SDG icons for Serbian (Cyrillic)
2021-04-13 13:51:32 +02:00
Javi Martín
2da74a771f Merge pull request #4465 from consul/restore_user_content
Restore all related content along when a user is restored
2021-04-13 13:48:38 +02:00
taitus
85aba8830a Allow scope :by_username_email_or_document_number search users with whitespaces 2021-04-13 10:46:31 +02:00
Javi Martín
5af4d33c14 Merge pull request #4461 from consul/fix_flaky_dashboard_spec
Fix flaky spec "Edit poll allows removing answers"
2021-04-12 17:02:56 +02:00
Javi Martín
171a40d25d Fix flaky spec "Edit poll allows removing answers"
The test was hanging sometimes on my machine, probably because we
weren't making sure the request submitting the form had finished before
visiting a new page.

In theory the spec should have been fine from a technical point of view:
since submitting the form generates a regular HTTP request (and not an
AJAX one), Capybara/Selenium/Chromedrive should wait until the request
is finished. But that doesn't seem to be the case 100% of the time;
maybe conditions change depending on previous tests.

On the other hand, from a design point of view, the spec wasn't that
fine. The main purpose of system specs is to test the way users interact
with our application, and users don't click a button and immediately
visit a different page. Instead, most users wait until they receive
feedback of their actions, and then they visit a different page.

Of course some users might visit another page without waiting. What
happens then cannot be predicted (it will depend on which request is
handled first), and so there's no point in writing a test for this case
unless there's a specific concurrency issue we'd like to check.
2021-04-12 16:40:46 +02:00
Javi Martín
08e19153d4 Merge pull request #4455 from consul/title-suggestion
Do not make suggestions for related titles on edit pages
2021-04-12 16:31:23 +02:00
Javi Martín
cc5bdef550 Merge pull request #4456 from consul/clear_backspace
Clear fields in tests before filling them in
2021-04-12 16:25:08 +02:00
Javi Martín
235e39672e Create admin user before starting a browser
Even after the previous changes, this test is still failing sometimes
(although now it fails for a different reason). We're doing this change
in order to discard it as the reason why the test is failing.
2021-04-12 16:07:13 +02:00
taitus
65f734bf3d Reduce the number of specs lines of code 2021-04-12 14:19:45 +02:00
taitus
95503f5811 Allow search User through name with whitespaces 2021-04-12 14:19:45 +02:00
taitus
ea8ce24a2a Only make suggestions for related titles for new records
Avoid show suggestions for :edit and :update actions.
2021-04-12 11:05:51 +02:00
taitus
56d3840c40 Extract to help method to fill in the data for the suggestions 2021-04-12 11:04:32 +02:00
Javi Martín
f8500cea62 Add SDG icons for Serbian (Cyrillic)
Icons obtained at the UNDP page for Serbia [1].

Thanks Dantic for the link ;).

[1] https://www.rs.undp.org/content/serbia/sr/home/sustainable-development-goals.html
2021-04-09 17:55:03 +02:00
Carlos Iniesta
67d61699b6 Restore all related content when a user is restored 2021-04-09 17:54:56 +02:00
Carlos Iniesta
712d33ef99 Small block user refactor 2021-04-09 17:54:56 +02:00
Javi Martín
de9c261c0e Clear fields in tests before filling them in
There seems to be an issue with capybara or chromedriver which results
in `fill_in` sometimes appending to an input rather than overwriting
[1], causing some tests to fail under certain circumstances.

Clearing fields before filling them in solves the issue.

Note we're now getting warnings on all tests using the rack driver. I
haven't found a way to avoid the `clear: :backspace` option in
non-JavaScript tests, so to avoid the annoying warnings we should reduce
the number of tests using the rack driver even more.

[1] See issue 2419 in https://github.com/teamcapybara/capybara/issues
2021-04-09 17:54:21 +02:00
Javi Martín
5538a1346b Merge pull request #4448 from consul/improve-management-investments
Improve create investments in Management section
2021-04-09 16:40:17 +02:00
Javi Martín
843f61e987 Merge pull request #4467 from consul/fix_flaky_notification_spec
Fix flaky spec "Notifications User not logged in"
2021-04-09 16:29:17 +02:00
taitus
4468cc0c04 Use image attributes concern
Reviewing the attribute concerns it has been detected that it can also be used in
this controller.
2021-04-09 16:21:00 +02:00
taitus
be6390cc71 Allow to create an investment with documents
In the Management section when creating an investment we were not passing the
document attributes, so we were never able to associate documents.

Make the nested_documentable spec compatible with the Management section.
2021-04-09 16:21:00 +02:00
taitus
ac144d172d Move document attributes to concern 2021-04-09 16:21:00 +02:00
taitus
82cd019b40 Allow to create an investment with images
In the Management section when creating an investment we were not passing the
images attributes, so we were never able to associate images.

Make the nested_imageable spec compatible with the Management section.
2021-04-09 16:20:59 +02:00
taitus
fa12528581 Make the do_login_for method accessible to other shared specs 2021-04-09 16:20:59 +02:00
taitus
7a34a338f4 Allow to create an investment with a geolocation.
In the Management section when creating an investment we were not passing the
map attributes, so we were never able to associate a geolocation.
2021-04-09 16:20:59 +02:00