Commit Graph

31 Commits

Author SHA1 Message Date
Javi Martín
38ad65605e Use excluding instead of where.not(id:
This method was added in Rails 7.0 and makes the code slihgtly more
readable.

The downside is that it generates two queries instead of one, so it
might generate some confusion when debugging SQL queries. Its impact on
performance is probably negligible.
2024-07-22 18:35:35 +02:00
Javi Martín
a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00
Javi Martín
8b13daad95 Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
2023-08-18 14:56:16 +02:00
Jacek Skrzypacz
2af7e32415 Add search form for hidden content
Added search for comments and proposal_notifications, added tsv column
for search and rake tasks to update/create tsv vector.
2022-08-23 14:30:38 +02:00
Javi Martín
5977f2ec3d Simplify methods to get API-public records
Just like we did to tags in commit 2e863fdc5.
2022-05-02 17:16:31 +02:00
Javi Martín
adba81ea89 Add and apply Style/RedundantSelf rubocop rule 2021-09-03 11:49:53 +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
57ef380379 Add and apply Layout/ExtraSpacing rubocop rule 2019-10-24 18:11:58 +02:00
Javi Martín
d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +02:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
9fe8c47528 Apply Rails/SafeNavigation rubocop rule 2019-09-10 21:43:39 +02:00
Javi Martín
47b2c42a1d Apply IndentationConsistency 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
decabeza
69d67940d3 Removes unnecesary scope 2018-07-26 17:55:06 +02:00
decabeza
786a3949fd Moves moderate_system_email from private method 2018-07-26 17:55:06 +02:00
María Checa
9d580e15f5 Adds activity tab for system emails 2018-07-26 17:55:06 +02:00
María Checa
f1e7b634ba Adds moderate actions to proposal system notifications 2018-07-26 17:55:06 +02:00
iagirre
894c5d1eca Fix restore notifications from admins page
The restore feature was not working properly. When pushed, the button
was removing the notification from the admins panel, but it was not
restoring in the proposal.

I added an `after_restore` function (that I missed in the first PR)
so that the notification is unmarked as moderated.
2018-07-02 18:19:49 +02:00
iagirre
21b1d00205 Add backend for the moderators
Add new routes for the proposal notifications edition and
abilities to let moderators edit it (mark as ignored, hide, etc.).

The notifications are not flaggable because they doesn't work like that,
but in a similar way. The moderator/administrator is in charge of hidding
them through the UI, so the normal users don't flag it as inappropriate.

New controller Moderation::ProposalNotification to manage the moderators
work.
2018-07-02 18:17:45 +02:00
rgarcia
2b52d26d82 refactors notifications into concerns and shared examples 2017-12-14 16:15:30 +01:00
Bertocq
69f4e1c683 Fix all rubocop Metrics/LineLength issues (140+) 2017-07-10 13:22:49 +02:00
kikito
92633195d9 refactors proposal_notification.public_for_api 2017-06-13 12:19:02 +02:00
Alberto Miedes Garcés
9ec8b166d7 Use scopes for better query performance 2017-06-01 20:04:51 +02:00
Alberto Miedes Garcés
83267330a7 Group methods related to text generation for GraphQL documentation into a module 2017-01-26 10:47:12 +01:00
Alberto Miedes Garcés
d1f14ffb93 Simplify the way GraphQL 'resolve' is used 2017-01-12 19:51:58 +01:00
Alberto Miedes Garcés
074a8182f6 Add ProposalNotification to api 2016-12-29 10:58:40 +01:00
kikito
f0b8cfd4a2 Time.now -> Time.current 2016-11-23 19:19:19 +01:00
rgarcia
16f10e34ef fixes specs 2016-06-07 23:17:00 +02:00
rgarcia
8e12fbdd55 adds time limit between notifications 2016-06-07 13:48:09 +02:00
rgarcia
f5375e813d stores a proposal notification 2016-06-01 17:23:56 +02:00