Commit Graph

8825 Commits

Author SHA1 Message Date
Raúl Fuentes
8f4d48690b Added tests for edit the name of any Budget::Group 2018-03-02 09:17:03 +01:00
Raúl Fuentes
6d8d44a5e3 Added interface and methods for edit the name of a Budget::Group if the budget is still inthe drafting phase 2018-03-02 09:16:57 +01:00
Bertocq
089cef8ead Improve download segment translations 2018-03-01 13:52:48 +01:00
Alberto Calderón Queimadelos
0decaf43a3 Merge pull request #2492 from consul/fix_newsletter_send_performance
Fixed how newsletters controller and mailer handle recipients
2018-02-28 19:03:58 +01:00
Bertocq
61c58817fc Update unreleased section of changelog 2018-02-28 18:09:46 +01:00
Alberto Calderón Queimadelos
4af603edc6 Merge pull request #2491 from consul/2487-feasible_undecided_investment_authors_segment
Fix UserSegment feasible and undecided investment authors
2018-02-28 18:01:54 +01:00
Alberto Calderón Queimadelos
0acb4988f0 Merge pull request #2490 from consul/documents-tab
Documents list
2018-02-28 17:14:58 +01:00
María Checa
3867c6b716 Fixed newsletter tests 2018-02-28 17:02:39 +01:00
María Checa
8d2a103744 Changed how newsletters controller and mailer handle recipients
Now newsletters controller calls the Mailer method to send a newsletter once per user.
2018-02-28 17:02:31 +01:00
Alberto Calderón Queimadelos
494904565a Merge pull request #2489 from consul/ui-fixes
UI fixes
2018-02-28 16:56:57 +01:00
María Checa
6140a822e8 Changed translations 2018-02-28 16:55:53 +01:00
María Checa
7913128520 Changed tests for UserSegments#feasible_and_undecided_investment_authors 2018-02-28 16:54:28 +01:00
María Checa
678ea0bef2 Added unfeasible investments with valuation not finished to UserSegments#feasible_and_undecided_investment_authors 2018-02-28 16:54:28 +01:00
decabeza
53e36850a4 Fixes documentable rubocop offences 2018-02-28 16:21:22 +01:00
decabeza
e79f64c009 Updates specs 2018-02-28 16:21:18 +01:00
decabeza
1546f67367 Removes document tab on legislation proposals 2018-02-28 16:21:08 +01:00
decabeza
7a888b71fd Removes duplicate heading info, fixes headings structure 2018-02-28 16:10:14 +01:00
decabeza
46f21330bd Removes document tab on budgets investments 2018-02-28 15:23:39 +01:00
decabeza
5b7a5a2b4b Removes document tab on proposals 2018-02-28 15:23:32 +01:00
decabeza
466f8ef4e0 Removes unnecessary css 2018-02-28 15:23:22 +01:00
decabeza
5c0a10699a Refactors documents partials and reorganices css 2018-02-28 15:22:33 +01:00
decabeza
bd3929a7dc Adds missing translation for legislation filter title 2018-02-28 15:19:44 +01:00
decabeza
ddc4ff329b Fixes button vertical align on polls list 2018-02-28 15:19:33 +01:00
Bertocq
c2e9096ce1 Improved user segments en & es translations 2018-02-26 16:56:28 +01:00
Alberto Calderón Queimadelos
f5f37829e0 Merge pull request #2486 from wairbut-m2c/docs/nodejs-requirement
docs(readme): Include Node.js as requirement
2018-02-26 16:17:41 +01:00
Angel Perez
9443e585c6 docs(readme): Include Node.js as requirement
Failed CONSUL installation reported on #2391 because
Node.js was missing on the development environment
2018-02-26 10:33:22 -04:00
Bertocq
dbe723079e Disable guide page when Budget is not accepting
Why:

When there is not Budget accepting (Investment creation) the guide page
doesn't have much sense as it will give the user an option that can't be
used (creating an Investment).

How:

Using `Budget.current&.accepting?` conditional at GuidesHelper to link
to new proposal link instead of guide page, and adding an scenario to
guides feature spec for it.
2018-02-26 10:01:30 +01:00
Bertocq
c3a3e76304 Improve newsletter model spec list_of_recipients 2018-02-22 18:24:36 +01:00
Bertocq
e3eeca4f06 Improve newsletter model spec with valid_segment_recipient? 2018-02-22 18:24:18 +01:00
Bertocq
d44621f761 Relocate spending proposal valuation assigment seed 2018-02-22 11:38:49 +01:00
Bertocq
500db4b5d8 Add translations used on dev seeds files 2018-02-22 11:04:49 +01:00
Bertocq
54e6c5fc5c Split dev_seeds into individual files for sections
Why:

Its a really huge script, and conflicts are hard to resolve on forks,
with indivudal scripts its easier to make custom changes.

How:

Following @mariacheca example using require_relative and a file under
the db/dev_seeds/ folder
2018-02-22 11:04:47 +01:00
Bertocq
7d88b25741 Revert "Revert default map change"
This reverts commit 418dc6a1d6.
2018-02-22 07:40:59 +01:00
Bertocq
65288573b5 Fix user administrators scope relation 2018-02-22 00:42:40 +01:00
Bertocq
61f015e2c2 Add administrators UserSegment
We need a user segment to have only administrators as recipients of both
newsletters and notifications
2018-02-21 23:34:20 +01:00
María Checa
4bf20e5bd9 Removed rubyzip gem from Gemfile.lock 2018-02-21 16:06:55 +01:00
Bertocq
c572fe26e9 Update unreleased section of changelog 2018-02-21 13:04:57 +01:00
Alberto Calderón Queimadelos
df16194c78 Merge pull request #2474 from consul/admin_newsletter_email_refactor
Admin newsletter email refactor
2018-02-21 13:03:35 +01:00
Bertocq
12fd0a7cd3 Make newsletter seed file line lenght compliant 2018-02-21 11:47:34 +01:00
Bertocq
fb2c92228a Refactor UserSegment class
Simple refactor to avoid creating unnecessary variables and make it easier
to read.
2018-02-21 11:47:30 +01:00
Bertocq
24aa157998 Fix invalid Newsletter recipients count to 0
When a newsletter doesn't have a valid user segment for the recipients
list, the number of users should be 0.
2018-02-21 11:47:24 +01:00
Bertocq
f34d6c1c1d Prevent invalid newsletters from being sent
Why:

Newsletters without a valid user segment can't be sent since there is no
recipient user email list.

How:

* Hiding the send button at the form
* Preventing an invalid newsletter from being delivered at the controller
2018-02-21 11:47:16 +01:00
Bertocq
38f7a222f5 Add error message for invalid Newsletter user segment
Instead of the name of the User Segment we'll display an error message
2018-02-21 11:46:30 +01:00
Bertocq
7dfa056fe0 Add invalid newsletter scenarios to feature spec
Newsletters with an invalid user segment should display a warning on
show and index. Also those newsletters should not be sent.
2018-02-21 11:46:23 +01:00
Bertocq
7cfa7b18f9 Validate Newsletter segment_recipient value
Why:

A Newsletter can only be sent if the are available user recipient emails
and that means the `segment_recipient` value actually corresponds to a
function on the UserSegments class.

We could rely on the UserSegments::SEGMENTS constant as the list of
possible user segments functions that a Newsletter can use to gather
emails, so any value not included in that hash would not be valid.

But to be 100% sure the newsletter can get a recipients_list we should
just check if the UserSegments class has a method with same name as the
`segment_recipient` value.

How:

* Adding an validation method that checks if UserSegment has a method
with same name as the `segment_recipient` value.
* Adding an scenario to the Newsletter model spec to check this
2018-02-21 11:46:16 +01:00
Bertocq
4becd0eb35 Change Newsletter's segment_recipient to string
Why:

Newsletter attribute `segment_recipient` is an integer to be used as
enum. There's no advantage to store a number instead of an string if the
ammount of elements in the table is not going to be huge, or we can take
advantage of using an enum.

Also maintaining both Newsletters enum paired with UserSegments::SEGMENTS
would be a maintenance burden.

How:

* Migration to change segment_recipient column from integer to string
* Removing enumeration from Newsletter model class
* Using UserSegments::SEGMENTS instead of Newsletter.segment_recipients
or integer values
2018-02-21 11:46:11 +01:00
Bertocq
bdbb32e824 Move newsletter User scope outside UserSegments
Why:

UserSegments are not only used for Newsletters or Email downloads, but
also for internal Global Notifications. We don't want to have that scope
hardcoded inside UserSegments as users that have opted-out from the
newsletter should still be recipients of global notifications.

How:

Removing the scope from the UserSegments `all_users` method that acts as
base for all the other segments. Including that `newsletter` scope only
on the places that is relevant:
* When listing recipients for a newsletter
* When downloading a listing emails that can be newsletter recipients

Also updated relevant tests
2018-02-21 11:45:38 +01:00
Alberto Calderón Queimadelos
eb4a446a9a Merge pull request #2466 from consul/2120-admin_emails_list
Admin emails list download
2018-02-21 11:44:17 +01:00
Bertocq
f873bff5c6 Fix admin menu controller name conditionals 2018-02-20 22:33:01 +01:00
rgarcia
7f30d0c620 Fix doble submit specs
We have a custom implementation to avoid doble submissions which causes
some custom problems 😌

This commit should fix the following three specs
spec/features/comments/legislation_annotations_spec.rb:367
spec/features/comments/legislation_questions_spec.rb:333
spec/features/custom/probe_option_comments_spec.rb:298

One of the custom problems comes from ajax:success[1] not being
triggered, instead only ajax:complete seems to be triggered

We should remove this custom implementation and use the standard
solution provided in rails[2]

[1]
https://github.com/AyuntamientoMadrid/consul/blob/master/app/assets/java
scripts/prevent_double_submission.js.coffee#L28

[2]
https://stackoverflow.com/questions/9570912/how-to-disable-a-form-submit
-button-a-l%C3%A0-ruby-on-rails-way/9572893#9572893
2018-02-20 22:33:01 +01:00