Commit Graph

193 Commits

Author SHA1 Message Date
Andy Sims
74fbde09f1 Support creates follow (Merge pull request #3895)
* Supporting a proposal will create a follow relationship
* Only followers receive notifications
2020-04-06 15:26:47 +02:00
Javi Martín
82b0a6a92d Remove new CSV report generation
The new CSV report was more configurable and could work on proposals,
processes and comments. However, it had several issues.

In the public area, by default it generated a blank file.

In the admin section, the report was hard to configure and it generated
a file with less quality than the old system.

So until we improve this system, we're bringing back the old investment
CSV exporter.

This commit reverts most of commit 9d1ca3bf.
2019-11-06 00:04:02 +01:00
Javi Martín
8e3bfa0d72 Apply Style/RedundantReturn rubocop rule
We were already following this pattern most of the time.
2019-10-26 13:26:35 +02:00
Javi Martín
8b5cca746c Apply rubocop rules to freeze constants
Added by popular demand among our team members.
2019-10-26 13:21:36 +02:00
Javi Martín
42d2e5b3ad Apply Rails/InverseOf rubocop rule
Not doing so has a few gotchas when working with relations, particularly
with records which are not stored in the database.

I'm excluding the related content file because it's got a very peculiar
relationship with itself: the `has_one :opposite_related_content` has no
inverse; the relation itself is its inverse. It's a false positive since
the inverse condition is true:

```
content.opposite_related_content.opposite_related_content.object_id ==
  content.object_id
```
2019-10-25 19:29:12 +02:00
Javi Martín
fda53a0a2a Remove unnecessary foreign_key options
When we specify `belongs_to :author`, ActiveRecord automatically uses
`author_id` as the foreign key.
2019-10-25 19:03:10 +02:00
Javi Martín
7ca55c44e0 Apply Rails/SaveBang rubocop rule
Having exceptions is better than having silent bugs.

There are a few methods I've kept the same way they were.

The `RelatedContentScore#score_with_opposite` method is a bit peculiar:
it creates scores for both itself and the opposite related content,
which means the opposite related content will try to create the same
scores as well.

We've already got a test to check `Budget::Ballot#add_investment` when
creating a line fails ("Edge case voting a non-elegible investment").

Finally, the method `User#send_oauth_confirmation_instructions` doesn't
update the record when the email address isn't already present, leading
to the test "Try to register with the email of an already existing user,
when an unconfirmed email was provided by oauth" fo fail if we raise an
exception for an invalid user. That's because updating a user's email
doesn't update the database automatically, but instead a confirmation
email is sent.

There are also a few false positives for classes which don't have bang
methods (like the GraphQL classes) or destroying attachments.

For these reasons, I'm adding the rule with a "Refactor" severity,
meaning it's a rule we can break if necessary.
2019-10-23 14:39:31 +02:00
Javi Martín
1004ac01f8 Add and apply Style/SafeNavigation rubocop rule
We were already using it most of the time, but not always.
2019-10-22 17:37:51 +02:00
Javi Martín
ad14636255 Use Tag instead of ActsAsTaggableOn::Tag
It's shorter, it's easier to extend its behaviour, and it's easier to
integrate with other parts of our application, like translations.
2019-10-05 03:38:44 +02:00
Javi Martín
9fe8c47528 Apply Rails/SafeNavigation rubocop rule 2019-09-10 21:43:39 +02:00
Javi Martín
a5ba13b599 Apply Rails/Presence rubocop rule 2019-09-10 21:43:38 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
Javi Martín
a21240b230 Use Date.current and Time.current
Using Date.today and Time.now might lead to inconsistencies if the time
zone the application uses is not the same as the system time zone.
2019-08-28 20:32:40 +02:00
Senén Rodero Rodríguez
f572d5b579 Add translations to proposal pg_search_scope
Some Proposal attributes are now translatable so we need to include all
existing translations on pg_search scope.
2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
02be0c61f9 Add proposal translations
Adapt retire form to include needed translations and move validations
from controller to model.

Also change sanitizable concern to sanitize not marked for destruction
translations.
2019-06-27 09:19:36 +02:00
German Galia
9d1ca3bfd4 Report generation. Download csv 2019-06-12 10:17:31 +02:00
Julian Herrero
8e0bbf54f6 Replace harcoded images and documents settings 2019-06-04 11:50:09 +02:00
Julian Herrero
a852696eeb Remove not selected proposals from other lists 2019-05-30 11:19:38 +02:00
Julian Herrero
9948804e21 Add selected attribute to proposals 2019-05-29 16:51:27 +02:00
decabeza
f40787561d Remove all references to question and external_url fields 2019-04-30 16:42:07 +02:00
decabeza
0995480b73 Remove question and external_url fields from proposals 2019-04-30 11:35:47 +02:00
voodoorai2000
992f1d23a1 Change syntax to delay dashboard emails
After updating to Rails5 It seems the after_action[1] in the dashboard's mailer is not beind called.

Using this syntax the emails are still being delayed and the after_action being called correctly.

[1] https://github.com/AyuntamientoMadrid/consul/pull/1945/files#diff-fdf5590f3241c439fcc9d2225c3cf4d8R3
2019-04-29 15:44:45 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
Juanjo Bazán
b7d9ef6377 models inherits from ApplicationRecord 2019-04-17 17:40:56 +02:00
decabeza
2af154d539 Merge branch 'master' into proposal-dashboard 2019-03-28 01:26:04 +01:00
decabeza
f47ec9d7dc Fix hound warnings 2019-03-26 18:21:19 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Javi Martín
4c35df4812 Use double quotes inside string interpolation 2019-03-25 14:58:54 +01:00
taitus
8b1c458fdf Allow detect new actions since a custom date
- Rename method "detect_new_actions" to "detect_new_actions_since". Add new param date.
2019-03-21 12:29:31 +01:00
taitus
08383b9cac Send new notification email after publish Proposal
After publish a proposal send email to proposal's author with information text and new actions available.
2019-03-21 12:29:30 +01:00
taitus
c959e078b8 Send new action notification email after create Proposal
After create a proposal send email to proposal's author with information text and new actions available.
2019-03-20 11:50:47 +01:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
Javi Martín
6682121069 Reuse code to set and order by a random seed 2019-02-20 12:10:12 +01:00
Julian Nicolas Herrero
1be64a5dc3 Merge pull request #3098 from consul/backport-1742-new_most_active_algorithm
[Backport] New algorithm for filter 'most active'
2018-12-13 12:46:18 +01:00
Julian Herrero
ef835bef1c new algorithm for filter 'most active' 2018-12-13 11:42:22 +01:00
Javi Martín
7891efee32 Add milestones to proposals 2018-12-11 20:09:30 +01:00
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
Juan Salvador Pérez García
488e7e081f Merge branch 'dashboard' into rebase_consul_master 2018-09-27 09:18:27 +02:00
María Checa
a62b5c1492 Removes author from Proposal#users_to_notify 2018-07-26 12:51:34 +02:00
Juan Salvador Pérez García
e5f9cf6710 Fixed #239
Proposals dashboard refactored to dashboard.
Added missing specs for the dashboard.
2018-07-24 15:52:43 +02:00
rgarcia
4cd5bb90d4 Fix validation error when creating proposals without user verification
We were getting a validation error when skipping user verification and
creating proposals

This was due to the responsible_name being empty for unverified users

As skipping user verification is a temporary setting used until Census
integration is configured, we can safely skip this validation when this
setting is active
2018-07-20 11:53:01 +02:00
Juan Salvador Pérez García
ba753f3649 Fixes #222
Community view shows the polls for the given proposal.
2018-07-17 17:59:12 +02:00
Juan Salvador Pérez García
3eaf8dbe9f Fixed redundant scope condition
Redundant scope condition found in Proposal.created_by scope. It has
been removed.
2018-07-17 17:53:18 +02:00
Juan Salvador Pérez García
83f78b1940 Fixes #135
Adds a table with proposed actions in the dashboard. The user can mark
an action as executed.
2018-07-17 17:51:13 +02:00
Juan Salvador Pérez García
77dd60427d Implements story #136
Adds draft state for proposals
2018-07-17 17:46:54 +02:00
Angel Perez
a143fa447b Ensure recommendations are only shown when enabled 2018-07-15 21:28:58 -04:00
Angel Perez
a58f6a2662 Enable 'Recommended proposals' setting for users 2018-07-15 21:28:57 -04:00
María Checa
a1f840e8fd Added improvements to related contents 2018-01-12 18:35:15 +01:00
Angel Perez
63317714c3 Proposal recommendations won't include archived or already supported proposals 2017-12-15 22:40:24 -04:00
rgarcia
2b52d26d82 refactors notifications into concerns and shared examples 2017-12-14 16:15:30 +01:00