Commit Graph

38 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
65c9786db7 Apply Layout/RedundantLineBreak rule to short lines
We're not adding the rule because it would apply the current line length
rule of 110 characters per line. We still haven't decided whether we'll
keep that rule or make lines shorter so they're easier to read,
particularly when vertically splitting the editor window.

So, for now, I'm applying the rule to lines which are about 90
characters long.
2021-09-03 11:49:53 +02:00
Javi Martín
e01a94d7bd Use mem_cache_store instead of dalli_store
`dalli_store` is deprecated since dalli 2.7.11.

We can now enable cache_versioning. We didn't enable it when upgrading
to Rails 5.2 because of possible incompatibility with `dalli_store` [1],
even though apparently some the issues were fixed in dalli 2.7.9 and
dalli 2.7.10 [2].

Since using cache versioning makes cache expiration more efficient, and
I'm not sure whether the options we were passing to the dalli store are
valid with memcache store (documentation here is a bit lacking), I'm
just removing the option we used to double the default cache size on
production.

[1] https://www.schneems.com/2018/10/17/cache-invalidation-complexity-rails-52-and-dalli-cache-store
[2] https://github.com/petergoldstein/dalli/blob/master/History.md
2021-08-15 19:42:22 +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
35143ac43e Use be_empty instead of not_to include
Using `not_to include` does not test for other elements which could be
present in the array.
2019-09-29 23:57:35 +02:00
Javi Martín
fd1325768f Check exact array contents instead of inclusion
We're using `eq` and `match_array` in most places, but there were a few
places where we were still checking each element is included in the
array. This is a bit dangerous, because the array could have duplicate
elements, and we wouldn't detect them with `include`.
2019-09-29 23:57:35 +02:00
Javi Martín
f27beb1e47 Simplify testing array contents
We were testing for the size and the content of the elements when we
could test for the array itself.
2019-09-24 21:32:52 +02:00
Javi Martín
ffc50246c2 Apply explict RSpec/DescribedClass rubocop rule
We settled on using this style in commit 4cbe81a1, but didn't add the
rule enforcing this style and we didn't apply it to existing code.
2019-09-23 16:51:00 +02:00
Senén Rodero Rodríguez
4ce006ec96 Enable soft deletion of Comment::Translations 2019-06-27 09:19:37 +02:00
Senén Rodero Rodríguez
158af0217d Add comments translations
Co-Authored-By: Sebastia <sebastia.roig@gmail.com>
2019-06-27 09:19:37 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Bertocq
56fc5c9583 Filter internal valuation comments from public api
Why:

Internal valuation comments are only for admins and valuators,
not for the public view.

How:

Adding a `not_valuations` scope and use it at the `public_for_api` one
2018-01-30 19:22:27 +01:00
Bertocq
34bb9d65b1 Enable RSpec/NotToNot cop and fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
2018-01-07 17:39:48 +01:00
Bertocq
265d4d0967 Enables RSpec/DescribedClass cop & fixes all issues
Autocorrection for existing issues, and stashing at .rubocop_todo.yml
the false positives

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
2018-01-07 00:38:19 +01:00
Alberto Miedes Garcés
ad8aba0739 Revised public fields, wrote more exhaustive specs 2017-05-15 20:22:11 +02:00
Alberto Miedes Garcés
cb06075c68 Clarify spec message 2017-01-27 13:47:09 +01:00
Alberto Miedes Garcés
4b7cebf686 Improved public_for_api scopes and corresponding specs 2017-01-26 18:29:59 +01:00
Alberto Miedes Garcés
e7f55b10e2 Remove obsolete specs 2017-01-25 13:58:44 +01:00
Alberto Miedes Garcés
f467bb64c7 Wrote specs for HasPublicAuthor module 2017-01-07 18:00:14 +01:00
Alberto Miedes Garcés
861a723724 Only show public_voter if votable.total_votes are above threshold 2017-01-07 17:22:18 +01:00
Alberto Miedes Garcés
90ff84b6ef Update API fields for Comment 2016-12-27 18:18:22 +01:00
Juanjo Bazán
5ed3a2280e Merge branch 'master' of https://github.com/danibaena/consul into danibaena-master 2016-01-21 17:47:29 +01:00
Juanjo Bazán
790d8de5b6 removes unused method 2016-01-08 13:06:00 +01:00
rgarcia
b5e9113718 merges activities into notifications 2016-01-06 12:33:37 +01:00
Daniel Baena
f8e1fc70a1 #670 2015-12-11 21:06:27 +01:00
Juanjo Bazán
c258a4f3b4 adds scope for only normal user comments 2015-11-12 12:15:36 +01:00
kikito
f0e9005332 Adds missing spec to comment 2015-11-02 14:01:55 +01:00
kikito
f5d9ea4357 adds confidence_score capacity to the comment model 2015-10-28 16:25:35 +01:00
kikito
6c5d1faa90 Uses the new field, erased_at, for erased users 2015-10-21 14:28:21 +02:00
kikito
793bc52d00 recalculates comments_count when restoring in addition to when hiding a comment 2015-09-18 11:00:18 +02:00
kikito
1e8605fa28 Replaces it "should xx" by it "xxs" in comment_spec 2015-09-18 11:00:18 +02:00
Juanjo Bazán
60089b8986 uses author info in comment/debate cache
author is already preloaded and we avoid expensive touching methods
2015-09-06 12:13:39 +02:00
rgarcia
9515ccc3a8 adds specs 2015-09-05 22:03:33 +02:00
Juanjo Bazán
136c1e73ed uses ancestry to retrieve debate comments 2015-09-03 16:32:54 +02:00
Juanjo Bazán
dee2d0196b ancestries
moves to ancestry from acts_as_commentable_with_threading
2015-09-02 19:23:09 +02:00
Juanjo Bazán
dacbe27fda uses cache counter for debate's comments 2015-08-26 17:26:17 +02:00
Juanjo Bazán
57228636c4 adds as_moderator/administrator methods to comment 2015-08-24 17:47:09 +02:00
David Gil
a3550a55a5 create spec/models/comment_spec and add a few tests for children count 2015-08-12 14:59:54 +02:00