Commit Graph

18 Commits

Author SHA1 Message Date
taitus
ecde8c6439 Add lambda to the validations that use model constants
In this way when we need modify the constants model value in the
model/custom folder, adding lambda it will be possible load the new
values.
2022-03-22 15:52:36 +01: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
94d2496f8f Add missing has_many relations for users
Usually when we specify a `belongs_to` relations, we also specify its
equivalent `has_many`. That allows us to write, for example:
`topic.user.topics`.
2019-10-25 19:27:30 +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
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
b5b07bccd3 Apply PercentLiteralDelimiters rubocop rule 2019-09-10 20:02:15 +02:00
Juanjo Bazán
b7d9ef6377 models inherits from ApplicationRecord 2019-04-17 17:40:56 +02:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
María Checa
9d580e15f5 Adds activity tab for system emails 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
Bertocq
c9bc028524 Remove all unnecesary extra spacing and Layout/ExtraSpacing list from rubocop file 2017-06-28 14:12:51 +02:00
Bertocq
b074090e92 Fix Layout/SpaceInsidePercentLiteralDelimiters rubocop issue and remove from rubocop todo list 2017-06-26 17:57:53 +02:00
Juanjo Bazán
d9d38482b3 extends Activity to include Investment valuations 2017-03-27 13:56:16 +02:00
Julian Herrero
ba0ce4e14b añadir track_activity para mostrar futuras notificaciones a los usuarios 2016-01-05 17:42:10 +01:00
Juanjo Bazán
9969884a50 minirefactors 2015-09-23 12:32:36 +02:00
Juanjo Bazán
1047df11a1 includes hidden relations by default 2015-09-22 16:30:43 +02:00
Juanjo Bazán
05237ca1e2 adds scopes for every actionable class to activity 2015-09-22 16:30:43 +02:00
Juanjo Bazán
9e922ad080 adds activity model 2015-09-22 16:30:43 +02:00