Commit Graph

819 Commits

Author SHA1 Message Date
Raúl Fuentes
bf0472fd58 Fix test
now the <a> tag is permited, also the list of allowed tags is in
the configuration of ckeditor4
2018-09-12 12:35:28 +02:00
Javier Martín
157cd001d5 Add spec to expose a bug finding manager logged in
I've moved the method to the User model in order to make it easier to
test. I'm not sure where it belongs, though.

There was already a failing spec in `spec/features/management_spec.rb`,
but it passed if run standalone because it only failed if previous tests
had already created nine users or more.
2018-07-28 22:03:33 +02:00
María Checa
f1e7b634ba Adds moderate actions to proposal system notifications 2018-07-26 17:55:06 +02:00
rgarcia
9264763ec5 Log newsletter emails sent
With this commit we are logging which emails have already received the
newsletter

This could be important if something goes wrong sending the newsletter,
to be able to identify which users have already received the newsletter
and be able to skip them

We’ve had to add a new action to the Activity model (email) and add
paranoia features to be able to deal gracefully with the default
`with_hidden` scope in Activities[1]

[1]
https://github.com/AyuntamientoMadrid/consul/blob/master/app/models/acti
vity.rb#L2
2018-07-26 17:55:06 +02:00
rgarcia
8960928a76 Skip invalid emails when sending newsletter
We were seeing an exception when sending some emails due to having
invalid format

With this commit we are skipping this invalid formatted emails when
sending the newsletter
2018-07-26 17:55:06 +02:00
Alberto
b04b1bee46 Merge pull request #2801 from consul/proposal_authors_notifications
Prevent authors from receiving their own proposals notification emails
2018-07-26 14:12:14 +02:00
Alberto
9eacc5c5ff Merge pull request #2753 from consul/unfeasibility-explanation
Fix display of unfeasibility explanation
2018-07-26 13:21:21 +02:00
rgarcia
ab5f78120a Fix specs
Git seems to have gotten confused and some specs where duplicated
and others missing

This commits restructures commits to sync them with Madrid's fork
2018-07-26 12:52:51 +02:00
María Checa
a62b5c1492 Removes author from Proposal#users_to_notify 2018-07-26 12:51:34 +02:00
Bertocq
45488d117a Create AdminNotification model, spec and factory 2018-07-25 18:30:29 +02:00
Angel Perez
31c16406c0 Move disable recommendations permissions to Abilities::Common model 2018-07-15 21:28:58 -04:00
rgarcia
90bb06e684 Fix display of unfeasibility explanation
We were missing a check to make sure valuation had finished before
displaying the unfeasibility explanation
2018-07-10 17:57:41 +02:00
rgarcia
f670019325 Deal gracefully with recommendations of hidden proposals
We were seeing an exceptions in the home page when displaying
recommendations. This was due to trying to load tags of hidden proposals

With this commit we are skipping proposals that that have been hidden,
which will hopefully solve this exception
2018-07-10 17:47:28 +02:00
María Checa
fb5b993920 Add Budget::Investment::Statuses tests 2018-06-27 18:34:02 +02:00
María Checa
e8e9fcd0da Add Budget::Investment::Statuses tests 2018-06-27 16:45:58 +02:00
Alberto
6d2c094931 Merge pull request #2469 from wairbut-m2c/chore/i18n-cleaning
I18n maintenance
2018-06-07 17:42:05 +02:00
rgarcia
8986cf4727 Display only published processes in homepage 2018-05-30 13:32:20 +02:00
rgarcia
0e097973cc Add widget feeds to homepage
Note there is some funkiness going on with class loadings
Had to create a `feed` and `widget_feed` table even though in this
first version the Widget::Feed includes only uses ActiveModel instead
of ActiveRecord, otherwise some specs failed

We’ll figure it out and clean up 😌
2018-05-28 18:17:26 +02:00
rgarcia
664e77305c Add widget cards to homepage 2018-05-28 18:17:26 +02:00
Antonis Tzorvas
c21d806ecc Refs #2603 Show 'See Results' button in admin panel 2018-05-19 13:38:02 +03:00
Angel Perez
f9e8e2d86d I18n: cleanup for Admin English/Spanish strings
* Add missing exclamation marks
* Fix typos
* Remove duplicated keys
* Remove trailing whitespaces
* Replace single quotes with double quotes
* Replace untranslated strings
* Fix incorrect 'Spending proposal' assertion
2018-04-09 14:39:03 -04:00
Bertocq
43d78c6c72 Adding Investment#by_valuator_group test scenario
Budget::Investment#by_valuator_group scope didn't had a test scenario
2018-04-06 00:22:41 +02:00
Bertocq
48286f7de9 Validate ValuatorGroup#name presence & uniqueness
Why:

ValuatorGroup name should be unique and present to be able to identify
correctly each of them.

How:
  - Adding a presence & uniqueness validation at the model
  - Adding a sequenced value for name attribute at its factory
  - Adding missing model spec that covers validations
2018-04-05 22:12:06 +02:00
Raimond Garcia
65f5ab424b Merge pull request #2570 from consul/unfeasibility-explanation
Display unfeasibility explanation only when valuation has finished
2018-04-05 00:21:31 +02:00
Raimond Garcia
787657e07e Merge pull request #2510 from consul/valuator-groups
Add valuator groups
2018-04-05 00:21:04 +02:00
rgarcia
71bb5b3dcf Fix display of unfeasibility explanation
We were missing a check to make sure valuation had finished before
displaying the unfeasibility explanation
2018-04-04 14:38:31 +02:00
Bertocq
633cc1283b Fix Date & DateTime parsings to use default timezone
Date.new(...) does not take into account the current timezone, while other
parts of the application do. By default always parsing any date with the
default timezone and converting the resulting Time to Date would prevent
this kind of issues

DateTime.parse(...).in_time_zone gives an unexpected result, as the
DateTime.parse(...) will create a DateTime with +0000 time zone and the
`in_time_zone` will modify the DateTime to adjust to the default zone.

Maybe its better explained with an example, using 'Lima' as timezone:

DateTime.parse("2015-01-01")
> Thu, 01 Jan 2015 00:00:00 +0000

DateTime.parse("2015-01-01").in_time_zone
> Wed, 31 Dec 2014 19:00:00 -05 -05:00

And that's not the desired date but the previous day!
2018-04-04 14:21:39 +02:00
rgarcia
00c965b715 Clean up 2018-04-04 13:19:01 +02:00
rgarcia
7a01745188 Add valuation permissions to groups 2018-04-03 20:58:35 +02:00
rgarcia
1dbbe331c9 Assign valuators to groups 2018-04-03 20:55:44 +02:00
rgarcia
09c44ee583 Extend notifications to be marked as read and unread 2018-03-23 11:47:06 +01:00
rgarcia
073cf74818 Fix edge case
The user was able to vote as many investments as wanted in the first
heading voted. However in the second heading voted, only one investment
could be voted

This was due to the previous implementation, where you could only vote
in one heading. Note the `first` call in method
`heading_voted_by_user?(user)`

This commits simplifies the logic and allows voting for any investment
in any heading that the user has previously voted in
2018-03-22 23:08:41 +01:00
rgarcia
5c6eaa76ff Add headings_voted_by_user
This method was used only in Madrid’s fork, but it is now needed to
complete the backport for voting in multiple headings

There wasn’t a test in Madrid, so here goes one too. Even though, the
responsibility should probably be moved soon to the `Budget::Heading`.
For consistency with the related methods and tests it has been left in
the investment_spec
2018-03-22 22:24:58 +01:00
rgarcia
bdffb9765e Allow voting in multiple headings
Now that we have the option of voting in multiple headings per group,
the method of voting in a “different heading assigned” has become
deprecated and thus removed
2018-03-22 22:24:58 +01:00
Alberto García
eba4a3c6cb Merge pull request #2528 from consul/budgets-message
Heading link on budgets message
2018-03-09 13:25:39 +01:00
Alberto Calderón Queimadelos
a55218ad9f Merge pull request #2443 from consul/fix_currency_locale
Use user locale instead of default locale to format currencies
2018-03-08 18:03:52 +01:00
decabeza
0e9190bc43 Adds heading link on different heading message 2018-03-08 11:50:09 +01:00
Bertocq
f0dc2a02a5 Add Budget#formatted_amount unit test 2018-03-08 11:42:22 +01:00
Bertocq
1ef2789640 Trim valuator investment valuation ability scope
Valuators shouldn't be able to valuate an investment which valuation has
already been finished (only admins can)
2018-03-06 20:18:05 +01:00
Bertocq
6b41b6487b Add UserSegments#user_segment_emails helper method
Why:

Both Newsletters and Email Downloads need the same logic: To extract the
emails from all the users in the segment that have newsletter flag
active, removing all empty email values.

How:

1- UserSegments#user_segment_emails holds that repeated logic and is used
on both Newsletter & EmailDownload.

2- Rename Newsletter#list_of_recipients to list_of_recipient_emails as
it is more descriptive. There is no need to pass entire Users around,
only the emails are needed at Mailer#newsletter method.

3- Cleanup Newsletter#list_of_recipient_emails model spec scenario
2018-03-01 20:59:20 +01:00
Bertocq
99851e9588 Remove empty emails from users segments recipients
Why:

User with an empty email value (nil) should not appear in the recipient
list for a given UserSegment at Newsletters or Email Downloads.

How:

Using Enumerable#compact and Enumerable#select to filter out empty emails

Increasing Email Download feature spec and Newsletter model spec to cover
all possible scenarios including the nil email one.
2018-03-01 20:09:32 +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
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
María Checa
e8c797766a Added newsletter specs 2018-02-14 16:06:33 +01:00
Bertocq
198ff0cd1f Use updatable slug factory trait to sluggable concern
Slugs should only be updated on certain conditions, we need a trait that
meets that conditions and the name of the trait passed as a mandatory &
named argument on the sluggable concern
2018-02-04 23:04:48 +01:00
Bertocq
2eab6a476e Refactor sluggable concern spec 2018-02-04 22:36:23 +01:00
Bertocq
24b1e64113 Validate MapLocation lat/long/zoom have numeric values 2018-02-02 21:37:50 +01:00
Bertocq
6f87f4b07c Correctly check map location attr presence validations 2018-02-02 21:37:05 +01:00
BertoCQ
59b600dd1a Merge pull request #2390 from wairbut-m2c/aperez-user-permissions-specs
Add specs to check users permissions to delete images & documents
2018-02-02 19:42:27 +01:00