Commit Graph

19 Commits

Author SHA1 Message Date
Javi Martín
d938077813 Remove empty lines around if and when body
Unfortunately, there doesn't seem to be a Rubocop rule for this one.
I've found these empty lines thanks to Rufo.
2019-10-24 17:56:03 +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
47b2c42a1d Apply IndentationConsistency rubocop rule 2019-09-10 20:02:15 +02:00
Javi Martín
e252d82cdb Apply IndentationWidth rubocop rule 2019-09-10 20:02:15 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Julian Herrero
9a23393535 Use find instead of find_by_id
This method will raise an exception if resource is not found when
trying to call score_action on nil.
Prefer to raise a 404 HTML NotFound error instead.
2019-01-25 09:03:56 +01:00
Vicente Mendoza
74124fb784 Control when the investment is trying to relate to itself. 2018-02-02 10:52:28 +01:00
María Checa
a1f840e8fd Added improvements to related contents 2018-01-12 18:35:15 +01:00
Bertocq
01d5656884 Fix valid related content url helper method 2017-12-20 14:51:39 +01:00
Bertocq
cf06d5b047 Refactor related content score methods to make them easier to follow 2017-12-20 10:24:00 +01:00
Bertocq
c67851df53 Fix relatedcontent creation and scoring on related content controller 2017-12-20 03:06:06 +01:00
Bertocq
d544d56722 Add correct user to RelatedContentScore on creation 2017-12-20 02:36:13 +01:00
Bertocq
2e0dd9caea Relationable find_related_content should not be used to find, refactored to have a single purpose 2017-12-20 02:36:13 +01:00
Bertocq
f21f5ec05e Refactor Related Content Controller score methods 2017-12-20 02:36:13 +01:00
María Checa
7d8b5838b9 Added new related contents score method 2017-12-19 13:14:12 +01:00
María Checa
d944a88c63 Added flag/unflag related content routes 2017-12-18 18:21:51 +01:00
Bertocq
b02e2729e7 Rubocop style autocorrections 2017-12-16 17:59:16 +01:00
María Checa
88fc740863 Moved RELATIONABLE_MODELS from controller to model 2017-12-14 20:48:32 +01:00
María Checa
5c7b5eed53 Added RelatedContentsController 2017-12-14 14:50:47 +01:00