Commit Graph

6051 Commits

Author SHA1 Message Date
Javi Martín
651861c462 Fix hidden active elements in admin menu
In the admin menu, some links take you to a section, and some links open
a submenu with more links.

When we disable the "multi-open" property of the menu and the active
element is a link which takes you to a section, Foundation will hide it
whenever we click a link which opens a submenu.

The easiest solution is to enable "multi-open" property.
2020-02-20 18:30:39 +01:00
Javier Martín
14b1f1b4d3 Merge pull request #3911 from rockandror/dashboard-email
Improve Dashboard emails
2020-02-19 19:06:53 +01:00
Julian Nicolas Herrero
377c24f49b Merge pull request #3063 from microweb10/poll_question_answer_update_spec
Check for missing feature specs for Poll::Question::Answer
2020-02-18 19:38:49 +07:00
Julian Nicolas Herrero
4e906b2af8 Merge pull request #3912 from consul/refactor_editing_budget_investments
Refactor editing budget investments
2020-02-18 19:21:28 +07:00
Julian Herrero
65e841e44e Show edit button instead of remove image on accepting phase
Since now it's possible to edit the budget investment during the
accepting phase, it does not really make sense to show the button to
just remove the image when the investment project can be fully edited,
and the image can be removed from the editing form.
2020-02-18 13:49:28 +07:00
taitus
b9792241ca Allow always send forward email
The new key only block notifications emails from Dashboard::Mailer.
Fix specs.
2020-02-17 16:30:38 +01:00
taitus
5608424510 Rename all ocurrences from this Setting to new key 2020-02-17 16:30:38 +01:00
Javier Martín
4f5d49561e Merge pull request #3915 from consul/polls_menu
Fix Polls link in admin menu
2020-02-17 14:47:54 +01:00
Javier Martín
7af932375f Merge pull request #3916 from consul/without_filters
Fix filters for investments without admin/valuator
2020-02-07 14:35:00 +01:00
Javier Martín
7f19b16478 Merge pull request #3902 from consul/wordpress_login
Enable Wordpress Oauth login and registration
2020-02-07 14:23:00 +01:00
Julian Herrero
193e51d42f Enable Wordpress Oauth login and registration 2020-02-07 12:23:41 +07:00
Javi Martín
f223b3945f Fix filters for investments without admin/valuator
These filters were only returning investments with valuation open, but
we don't want to do that since the time we changed the interface in
order to allow users to apply several filters at the same time.
2020-02-06 14:33:36 +01:00
Javi Martín
00484fe5f7 Fix Polls link in admin menu
The link was marked as active and hidden by foundation when we were in
the "Booths Assignments" section.
2020-02-05 22:16:16 +01:00
taitus
14c38a2615 Force dateFormat to dd/mm/yyyy for all locales
To maintain consistency and the use of advanced search in the frontend,
we forced the expected date format for all languages. This is a temporary
solution that we should analyze in depth to allow different date formats
depending on the language in the filters.
2020-02-05 09:27:10 +01:00
Julian Herrero
6d6f173713 Remove duplicated tests
These scenarios were already tested in
spec/features/admin/poll/questions/answers/answers_spec.rb
2020-01-19 12:34:16 +07:00
Julian Herrero
925964f5bb Remove duplicated test
This scenario was already tested in
spec/features/admin/poll/questions/answers/videos/videos_spec.rb
2020-01-19 12:34:09 +07:00
Julian Herrero
cf1f688d38 Move Poll::Question::Answer images tests to the right place 2020-01-19 12:24:04 +07:00
Javi Martín
d19abd7ddb Fix uploading images through CKEditor's upload tab
The bug was introduced when we upgraded the ckeditor gem in commit
f240e007.
2020-01-17 21:52:21 +01:00
Julian Nicolas Herrero
00d023a18d Merge pull request #3891 from consul/sitemap_skip_disabled_processes
Don't include disabled processes in sitemap
2019-12-24 11:48:16 +07:00
Javier Martín
309c86bed7 Merge pull request #3883 from rockandror/i18n_crowdin
Update translations from Crowdin
2019-12-19 14:29:19 +01:00
Julian Herrero
6e00842b0e Don't include disabled processes in sitemap 2019-12-19 13:26:29 +07:00
Senén Rodero Rodríguez
5fa02f604b Fix specs after new Deutsch translations
New deutsch translations of remote translations
interface have broke these specs where we were
using English translations at specs to do the checks
while the spec interface was in deutsch and now we
have deutsch translations for the interface application
is not returning english fallbacks anymore and a lot of
specs of this file fails.

This commits also changes the alternative language
used at spec from deutsch to spanish which is
maintaned by code not through Crowdin, so if any
developer update current spanish translations for the
user interface this specs will fail.
2019-12-18 16:50:48 +01:00
taitus
d1c9df5f91 Sanitize resource fields values
Sanitize resource fields values from ddbb before send
to remote translate client.
2019-12-04 17:03:57 +01:00
Andrew Sims
5d3748d863 Bugfix: categories are shown on process update
These changes fix a bug that causes categories
of a legislation process to be wiped on update
of the process. It also adds a regression test
for this fix.
2019-11-25 18:45:53 +11:00
Javi Martín
12eee3f5d1 Avoid invalid random titles in dashboard specs
Generating a random title with `Faker::Lorem.sentence` sometimes caused
validation errors in tests because the generated sentence was more than
80 characters long.
2019-11-19 23:32:12 +01:00
Javi Martín
1fdc34deac Fix "go back" link in newsletters
The link was pointing to the previous page, which was strange in many
scenarios, including cases where the previous page was the current page.
2019-11-18 20:14:45 +01:00
Julian Nicolas Herrero
81cf1635bb Merge pull request #3808 from consul/chromedriver_upgrade
Update chromeOptions for newer versions of chromedriver
2019-11-14 20:05:09 +07:00
Julian Herrero
cb3a1f2860 Update chromeOptions for newer versions of chromedriver 2019-11-14 11:58:39 +07:00
Javi Martín
e470ea1cc1 Avoid JavaScript execution in banner URLs
Using `sanitize` we make sure the `href` attribute does not execute any
dangerous code. The possibility of a banner pointing to a dangerous URL
was very reduced, though, since only administrators can edit this
attribute.
2019-11-13 19:52:15 +01:00
Javi Martín
6cb3047da2 Reuse partial to render a banner 2019-11-13 19:52:15 +01:00
João Lutz
f4ae9725c6 Allow create legislation proposals on process draft phase (Merge #3532) 2019-11-13 01:23:59 +01:00
Javi Martín
31c21ddd42 Keep current host in links to current path
This way we avoid a possible unprotected redirect.
2019-11-12 19:28:35 +01:00
Javi Martín
9065683216 Redirect to referer after destroying an image
The same way we do for documents. This way we avoid a possible
unprotected redirect.
2019-11-12 19:28:35 +01:00
Javi Martín
50bdfd5488 Avoid redirects with unprotected query params
In theory it's possible to add a `host` parameter to a URL, and we could
end up redirecting to that host if we just redirect using query
parameters.

Generating the path using `url_for` with `only_path` solves the issue.

Note in the tests I'm using the `get` method because the `patch` method
wouldn't send query parameters. This doesn't mean the action can be
accessed through GET requests, since controller tests don't check route
verbs. Using feature specs doesn't seem to work because `controller` and
`host` parameters are filtered automatically in feature specs.

Also note I'm not testing every hidden/moderation controller because
they basically use the same code.
2019-11-12 19:27:58 +01:00
Javi Martín
941fc76884 Remove unused query parameters in redirect
These actions are never called with query parameters in our application,
so there's no need to use these parameters in a redirect.

Note in the test I'm using the `get` method because the `patch` method
wouldn't send query parameters. This doesn't mean the action can be
accessed through GET requests, since controller tests don't check route
verbs.
2019-11-12 19:27:58 +01:00
Javi Martín
bd03e249ce Reduce number of records in pagination tests
Creating more than 25 records isn't necessary to test pagination; we can
stub the number of records per page in a test.

On my machine we save about one second per test with these changes.
2019-11-10 14:12:21 +01:00
Javi Martín
a84cf54c73 Add tests for debates and comments admin index 2019-11-10 12:32:25 +01:00
Javi Martín
940f099505 Move tests for moderated content to their own files
When we renamed hidden controllers in the admin section in commit
85722eb7 we forgot to rename the test files as well.
2019-11-10 12:32:25 +01:00
Javier Martín
b22ba4aff3 Merge pull request #3838 from PierreMesure/replace-spanish-text-with-app-name
Replace old Spanish text with org name
2019-11-09 21:39:35 +01:00
Pierre Mesure
232e6c7f11 Replace old Spanish text with org name 2019-11-09 19:38:13 +01:00
Javi Martín
ed6a4a1b95 Don't generate stats for budget polls
The link to show stats for these polls is nowhere to be seen in the
application, and these stats are included in the budget stats, so it
makes sense to restrict access to them.
2019-11-09 19:34:24 +01:00
Javi Martín
f8e6e98d3a Define stats and result permissions with scopes
When defining abilities, scopes cover more cases because they can be
used to check permissions for a record and to filter a collection. Ruby
blocks can only be used to check permissions for a record.

Note the `Budget::Phase.kind_or_later` name sounds funny, probably
because we use the word "phase" for both an an attribute in the budgets
table and an object associated with the budget, and so naming methods
for a budget phase is a bit tricky.
2019-11-09 19:34:21 +01:00
Javi Martín
864f750d92 Remove duplication in poll permissions
We were checking for `expired?` and `results_enabled?` in views and
helpers, when we've already defined a rule for accessing stats and
results for a poll.

This way we also fix a bug when stats were enabled but the poll wasn't
finished. In this scenario, the link pointed to the stats page, but when
clicking it we'd get a "you don't have permission" message.

Now the link doesn't point to the stats page anymore.
2019-11-09 19:33:02 +01:00
Javi Martín
2029d7baa5 Limit admin access to poll stats and results
There's no reason to allow administrators to check stats and results for
a poll when it isn't finished or when results and stats are not enabled.

Now admins have the same permissions as everyone else.
2019-11-09 19:32:54 +01:00
Javi Martín
8dbad5c3d2 Simplify tests for stats and results permissions
Now these tests look like the other ability tests.
2019-11-09 15:18:58 +01:00
Javi Martín
ea2aeab383 Apply rubocop Rails/FindBy rule everywhere
We didn't detect these cases because by default the rule only searches
for offenses in `app/models/`.
2019-11-08 19:15:04 +01:00
Javi Martín
8f021cbfce Fix random title with trailing spaces
When the generated title for a dashboard action ended with a space, the
action `click_link(feature.title)` failed because the link shown in the
HTML ignores the trailing spaces.

Using `strip` solves the problem. Not the most elegant solution, though;
ideally we'd generate a better title.
2019-11-08 17:58:56 +01:00
Javier Martín
487008d445 Merge pull request #3829 from rockandror/remove-duplicated-local-census-records-on-deployment
Remove duplicated local census records on deployment
2019-11-08 15:39:53 +01:00
Senén Rodero Rodríguez
be886ba77a Add rake task to remove duplicated local census records
Also supress migration messages during spec execution to keep test log as clean
as possible.
2019-11-08 14:46:45 +01:00
Javier Martín
943f2d9379 Merge pull request #3773 from rockandror/local-census-records-fixes
Local census records fixes
2019-11-08 12:36:37 +01:00