Commit Graph

14280 Commits

Author SHA1 Message Date
Javi Martín
7c252750c9 Remove duplicated call to index customization
The statement executed the method twice if the `present?` condition was
true. If the condition was false, it executed it once anyway.

It's probably a typo and originally we probably meant we wanted to
execute the method if the method existed.
2019-08-27 17:22:22 +02:00
Javi Martín
3a2818ece5 Remove unused method
This method was not used since commit d0245059.
2019-08-27 17:22:22 +02:00
Javi Martín
e64289c5f9 Fix double quotes inside double quotes
The interpolation was being evaluated as a comment.
2019-08-27 17:22:22 +02:00
dependabot-preview[bot]
f7da0704a0 [Security] Bump nokogiri from 1.10.2 to 1.10.4
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.2 to 1.10.4. **This update includes security fixes.**
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.10.2...v1.10.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-08-11 21:22:15 +00:00
Javier Martín
072d53f8b8 Merge pull request #3674 from consul/remove_duplicate_translation_classes
Remove duplicate translation classes
2019-08-09 14:00:02 +02:00
Javi Martín
e500d15704 Use Translation classes consistently
We're moving the code for the phases translation class to the same place
in the code the other translation classes are: right after including the
Globalizable module.
2019-08-08 18:49:14 +02:00
Javi Martín
59478ef461 Remove duplicate Translation classes
We accidentally added them twice when rebasing the translations branch.
2019-08-08 18:49:13 +02:00
Javi Martín
648cdf1440 Fix CKEditor height in dashboard actions form
Not wrapping the editor in a `.ckeditor` div made it change height when
the editor was loaded. That caused a weird effect for users, and also
made some tests fail sometimes since the position of the "Add new
document" link might change right when capybara is clicking it.
2019-08-08 16:35:20 +02:00
Javier Martín
5ade66dfa4 Merge pull request #3663 from consul/custom_locales_check
Load custom locales after everything is loaded
2019-08-07 23:54:40 +02:00
Javi Martín
0b1a4907ac Load custom locales after everything is loaded
The line:

```
config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**", "*.{rb,yml}")]
```

Was adding every locale under the `config/locales` folder, including the
ones inside `config/locales/custom/`. The files were loaded in the same
order as listed using `ls -f`.

So if the custom locales were loaded before the folder
`config/locales/#{I18n.locale}`, the default locales would override the
custom ones, and we want the custom locales to override the default
ones so CONSUL is easier to customize.
2019-08-07 22:05:01 +02:00
Javier Martín
1296069092 Merge pull request #3635 from consul/remove_custom_dashboard_task
Remove custom dashboard task
2019-08-07 22:00:14 +02:00
Javier Martín
b7f183f297 Merge pull request #3608 from consul/remove_system_total
Remove system recounts in the admin section
2019-08-07 21:15:34 +02:00
Javi Martín
d981e23cd7 Remove custom dashboard task
It was made for Madrid's repository, but was accidentally added to
CONSUL as well.
2019-08-07 20:37:02 +02:00
Javi Martín
0b55097820 Remove system count from old booth assigments
This number was not the important one; the important one is the one
given by the recounts.

Note we're also removing the votes by date, since they're also system
votes.
2019-08-07 20:31:45 +02:00
Javi Martín
45376d1e49 Fix indentation 2019-08-07 20:31:45 +02:00
Javi Martín
aa759e1af8 Simplify recounts code
Now the code is the same as the code in the poll booth assignment page.
2019-08-07 20:31:45 +02:00
Javi Martín
bddfee2b86 Remove system count column for old polls
System count isn't a relevant number because the important one is the
number of votes counted by poll officers. We're still maintaining it for
a month in case poll officers would like to review the results.
2019-08-07 20:31:45 +02:00
Javier Martín
4b51ab4b6a Merge pull request #3622 from consul/use_dynamic_factories
Use dynamic attributes in factories
2019-08-07 20:31:25 +02:00
Javi Martín
c2869f4887 Move Rails/RelativeDateConstant to basic cops
The reason for this rule is similar to dynamic factories: we want
dynamic dates to be evaluted relative to the current time, and not
relative to the moment the application was loaded.
2019-08-07 19:43:59 +02:00
Javi Martín
fc1a89e966 Use dynamic attributes in factories
Static attributes are deprecated since factory bot 4.11; we haven't
upgraded yet but now we're ready to do so:

https://thoughtbot.com/blog/deprecating-static-attributes-in-factory_bot-4-11
2019-08-07 19:43:57 +02:00
Javi Martín
444fc524f7 Use the AttributeDefinedStatically rubocop rule
Factory bot has stopped supporting dynamic attributes, and we'll have to
change all factories before upgrading.

In order to apply the rubocop rule, we need to bump rubocop-rspec to its
latest version.
2019-08-07 19:41:45 +02:00
Javi Martín
61be48a6c6 Remove unused and obsolete rubocop rules
These rules are now defined under `Style/`. However, we don't really use
them, so they add noise to the rubocop configuration file without
solving any issues we actually have.
2019-08-07 19:41:45 +02:00
Javier Martín
46873fe251 Merge pull request #3620 from consul/fix_migrations
Use Rails 5.1 conventions in migrations and specs
2019-08-07 17:12:39 +02:00
Javier Martín
2ccfa5b049 Merge pull request #3643 from consul/fix_notifiable_comment
Fix flaky notifiable specs
2019-08-07 16:38:05 +02:00
Javi Martín
ae98dbf683 Use Rails 5.1 conventions in tests params 2019-08-07 15:50:00 +02:00
Javier Martín
0610991741 Merge pull request #3644 from consul/fix_flaky_proposals_spec
Fix flaky spec: Proposals Search Reorder results maintaing search
2019-08-07 15:40:45 +02:00
Javi Martín
9cff2ac56b Improve expectations in notifiable specs
Sometimes during this test some comments are not created (so far we
don't know why), but since all comments had the same text, we didn't
notice when checking the text of the comment was on the page.
2019-08-07 14:19:14 +02:00
Javi Martín
57bda006b5 Don't click two places at the same time
When clicking the button "Search", the link "newest" is already present,
so capybara might click the "newest" link before the "Search" request is
finished, leading to unexpected results.

Checking the page to make sure the "Search" request has finished before
clicking the "newest" link solves the problem.
2019-08-07 14:18:50 +02:00
Javi Martín
bd85aede99 Use describe on new feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.

We're also adding a rubocop rule so we dont' accidentally add these
keywords again.
2019-08-07 13:53:27 +02:00
Javi Martín
765d405df1 Use Rails 5 conventions in migrations and models
We forgot to add these changes to pull requests which were in
development before we upgraded to Rails 5.

We're also moving the rubocop rules to the basic files, so we're
notified when we inherit from `ActiveRecord::Base`.
2019-08-07 13:53:27 +02:00
Javier Martín
79852716f2 Merge pull request #3658 from consul/fix_web_section_seeds
Make WebSection seeds idempotent
2019-08-07 03:06:34 +02:00
Javi Martín
c3bcb10c2b Make WebSection seeds idempotent
Each time we were loading the seeds file, more web sections were
created.

On production it meant running `db:seeds` several times created the
records even if they already existed.

During the test, it meant 5 more records were created before every test,
so after ending a test run, thousands of records existed, making banner
tests very slow.
2019-08-06 22:00:29 +02:00
Raimond Garcia
ce112860f9 Merge pull request #3646 from consul/verification
Make user verification configurable from the admin interface
2019-07-30 12:34:35 +02:00
Javi Martín
5e219a8f1d Increment number of Travis workers
After combining our translations and verification branches, some jobs
take more than 50 minutes to run.
2019-07-29 13:59:06 +02:00
taitus
6e62ea81a9 Add new model presence validates
- Only validate :date_of_birth and :postal_code presence when the
  application has configured Remote Census and their alias fields
  has values.
2019-07-29 13:10:09 +02:00
taitus
c0c967b961 Create Management::Document initialize
Allow parse :date_of_birth on Management::Document initialize
2019-07-29 13:10:09 +02:00
taitus
ceaf118188 Add new fields to form
- Add :date_of_birth and :postal_code
- Only display new fields when aplication has configured the Remote
  Census API and contains values for fields. Check with Setting Class
  methods:
  - force_presence_date_of_birth?
  - force_presence_postal_code?
2019-07-29 13:10:09 +02:00
taitus
bc36c5a987 Allow to Management::Document works with CustomCensusAPI
- Allow receive new fields :date_of_birth and :postal_code
- Send new fields to CensusCaller call method to allow use
  on RemoteCensusAPI
2019-07-29 13:10:09 +02:00
taitus
b9a8e5a254 Houndci-bot: Resolve indentation suggestion 2019-07-29 13:10:09 +02:00
taitus
1788df3cf7 Add new translations
- Add new translations on SignatureSheet show page.
  Changes:
   -> "document number" to "sigantures"
   -> "documents" to "users"

- Remove unused translations from the others yml
2019-07-29 13:10:09 +02:00
taitus
5953e87c71 Update help text and add dynamic example text
- Display help text and example text according to
  remote census configuration:

  Examples with expecte results:
  * With remote census without :date_of_birth and :postal_code:
    -> "To verify a user, your application needs: Document number"
    -> "Required fields for each user must be separated by commas and
        each user must be separated by semicolons."
    -> "Example: 12345678Z; 87654321Y"

  * With remote census with :date_of_birth required:
    -> "To verify a user, your application needs: Document number,
        Day of birth (dd/mm/yyyy)"
    -> "Required fields for each user must be separated by commas and
        each user must be separated by semicolons."
    -> "Example: 12345678Z, 01/01/1980; 87654321Y, 01/02/1990"

  * With remote census with :date_of_birth and :postal_code required:
    -> "To verify a user, your application needs: Document number,
        Day of birth (dd/mm/yyyy) and Postal Code"
    -> "Required fields for each user must be separated by commas and
        each user must be separated by semicolons."
    -> "Example: 12345678Z, 01/01/1980, 28001; 87654321Y, 01/02/1990, 28002"
2019-07-29 13:10:09 +02:00
taitus
d07f9312e5 Allow any configuration of required fields
- Add the methods "parse_date_of_birth" and "parse_postal_code"
  to recover the correct position of their values depending on the
  configuration of the remote census.
2019-07-29 13:10:09 +02:00
taitus
626d2b3c2b Allow to Signature works with CustomCensusAPI
- Send new fields to CensusCaller call method to
  allow use on CustomCensusAPI
2019-07-29 13:10:09 +02:00
taitus
0bf88abcf1 Allow to SignatureSheet parse new fields
- In the previous version, each signature was equivalent to a document
  and we separated them by commas.
  Now each signature may also need the fields birth date and postal code.
  So we separated each signature with a semicolon and separated each of
  its fields by commas.
  Example old version: "12345678X, 87654321Y"
  Example new version:
  "12345678X, 31/12/1980, 28001; 87654321Y, 31/12/1981, 28002"

- Update translations:
 "Write the numbers separated by commas (,)" to
 "Write the numbers separated by semicolons (;)"
2019-07-29 13:10:09 +02:00
taitus
5d68e1a43d Add new fields to signature
- Add :date_of_birth and :postal_code to Signature to allow send these
  fields to CustomCensusAPI

- Add new model presence validates: Only validate :date_of_birth and
  :postal_code presence when the application has configured Remote Census
  and their alias fields has values.
2019-07-29 13:10:09 +02:00
taitus
837c45599d Rename SignatureSheet column
This new functionality will allow to retrieve in the signature sheet
the document number, the date of birth and the postal code.

So we renamed :document_numbers to :required_fields_to_veriry to
clarify and adjust the name to its use.
2019-07-29 13:10:09 +02:00
taitus
ff1e8db4c6 Update Residence validation
- Update residence_valid? method to don't check :year_of_birth
when :date_of_birth is present.
- Remove unused 'census_year_of_birth' method.
2019-07-29 13:10:09 +02:00
taitus
cc49587fe4 Update FailedCensusCall with new fields 2019-07-29 13:10:09 +02:00
taitus
ff5f7ad401 Naming: Ambiguos ‘date_of_birth'
Actually we are using 'date_of_birth' as method and as attribute
accessor.
- Refactor 'date_of_birth' method to 'response_date_of_birth’
2019-07-29 13:10:09 +02:00
taitus
dd14fd8649 Add new model presence validates
- Only validate :date_of_birth and :postal_code presence when the application
  has configured Custom Census and their alias fields has values.
- Only validate :year_of_birth presence when :date_of_birth is not configured
  to send to Custom Census
2019-07-29 13:10:09 +02:00