Commit Graph

15065 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
096a9f6bb8 Enable soft deletion of Debate::Translations 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
03375ae621 Fix debates restore feature
Add recursive restore option to restore all soft deleted relations.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
ed750f6cce Move private method to a more reusable location
This method will be used by any translatable model that uses pg_search
feature so it's better to have it within globalizable model concern so
all translatable models can use it.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
036a3d7636 Add translations to debate pg_search_scope
Some Debate attributes are now translatable so we need to include all
existing translations on pg_search scope.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
6a6080e6b7 Fix debates suggest feature 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
51cda51155 Add debates translation interface
Also fix broken spec after removing translatable attributes from
strong_parameters definition. Now we need to send these attributes
as nested translations attributes.

Use activerecord.yml title attribute label so form helper could load it
from default location.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
f77e7df33e Fix debate specs
After adding debate translatable fields to forms, they will be generated with nested translations names and ids so we can no longer
use standard id locator.

Using input label text to fill in fields works with both types of forms.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
b67cd0fe40 Add sanitization shared spec to debate 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
e6c9027042 Rename deprecated fields from debates
To avoid deprecation warning thrown by globalize after gem update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
740c738fc5 Add debate translations 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
78c2f54c5d Fix proposal specs
After adding proposal translatable fields to forms, they will be generated with nested translations names and ids so we can no longer
use standard id locator.

Using input label text to fill in fields works with both types of forms.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
dd310f7507 Add sanitization shared spec to proposal 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
e6b3b85e48 Rename proposal deprecated fields
After adding new translations to proposal we no longer need this
attributes in proposals database table, but we keep them with a
deprecated name until next release where we drop them completely.

Also related column indexes where dropped.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
02be0c61f9 Add proposal translations
Adapt retire form to include needed translations and move validations
from controller to model.

Also change sanitizable concern to sanitize not marked for destruction
translations.
2019-06-27 09:19:36 +02:00
taitus
5343448c5a Remove deprecated attributes from Budget::Phase
Some fields from Budget::Phase are translatable and we no longer need them. This commit will remove the annoying deprecation warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
taitus
3b81bf67d1 Remove deprecated attributes from Budget::Heading
Some fields from Budget::Heading are translatable and we no longer need them. This commit will remove the annoying deprecation warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
taitus
952f03bb58 Remove deprecated attributes from Budget::Group
Some fields from Budget::Group are translatable and we no longer need them. This commit will remove the annoying deprecation warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
taitus
b5e17eac07 Remove deprecated attributes from Budgets
Some fields from Budget are translatable and we no longer need them. This commit will remove the annoying deprecation warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
taitus
b503eeac66 Fix spec models/widget/feed_spec.rb:61 as branch master. 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
ce7be5f2d6 Change the way to retrieve notifiable body
Using 'try' method to get notifiable is not working with translations
anymore. It was returning 'nil' always even when body translation is
populated.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
e847aa22f7 Remove deprecated attributes from Widget::Card
Some fields from Widget::Card are translatable and we no longer need
them. This commit will remove the annoying deprecation warning thrown
by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
6e49a09a21 Remove deprecated attributes from SiteCustomization::Page
Some fields from SiteCustomization::page are translatable and we no
longer need them. This commit will remove the annoying deprecation
warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
9f1ca4941f Remove deprecated attibutes from Legislation::Question::Option
Some fields from Legislation::Question::Option are translatable and we
no longer need them. This commit will remove the annoying deprecation
warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
8b33a48e0e Remove deprecated attributes from Legislation::Question
Some fields from Legislation::Question are translatable and we no
longer need them. This commit will remove the annoying deprecation
warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
957959e11d Remove deprecated attributes from Legislation::Process
Some fields from Legislation::Process are translatable and we no longer
need them. This commit will remove the annoying deprecation warning
thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
e28a1a4a8e Remove deprecated attributes from Legislation::Draft::Version
Some fields from LegislationDraftVersion are translatable and we no
longer need them. This commit will remove the annoying deprecation
warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
400a5719df Remove deprecated attributes from Milestone
Some fields from Milestone are translatable and we no longer need them.
This commit will remove the annoying deprecation warning thrown by
Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
43d7d24e3c Remove deprecated attributes from AdminNotification
Some fields from AdminNotification are translatable and we no longer
need them. This commit will remove the annoying deprecation warning
thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
2b23e9603d Remove deprecated attributes from Poll::Question::Answer
Some fields from Poll::Question::Answer are translatable and we no
longer need them. This commit will remove the annoying deprecation
warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
3406983672 Remove deprecated attributes from Poll:Question
Some fields from Poll::Question are translatable and we no longer need
them. This commit will remove the annoying deprecation warning thrown
by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
2575f863bc Remove deprecated attributes from Poll
Some fields from Poll are translatable and we no longer need them. This
commit will remove the annoying deprecation warning thrown by Globalize
gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
2b4fce1598 Remove deprecated attributes from Banner
Some attributes from Banner are translatable and we no longer need to
have them at database table. This will remove the annoying deprecation
warning thrown by Globalize gem after gem version update.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
96d1666899 Initialize graphql after application initialization
Proposal, Debate and Comment "globalize_accessors" class method were
loaded before application available locales initialization because of
graphql initializer. This will cause unexpected translation errors at
any translatable classes declared at graphql api definition (api.yml).

Doing GraphQL initialization after application initialization should
solve this issue.
2019-06-27 09:19:36 +02:00
taitus
0ffb52257f Fix specs budget_investments_spec.b:99 2019-06-27 09:19:36 +02:00
taitus
98074a9a73 Refactor specs from shared translatable 2019-06-27 09:19:36 +02:00
taitus
1687fb3a7b Fix specs budget_phases_spec.rb:13 2019-06-27 09:19:36 +02:00
taitus
2964d91303 Fix specs active_polls_spec.rb:10 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
b86579c40f Avoid crash when adding new translations
Paranoia is activated on translation classes by reflection, this is
making Rails to load translation classes before to execute migration
that adds the new column.

With this extra check Rails will not execute this code until translation
table has this column created.
2019-06-27 09:19:36 +02:00
taitus
90df1faf07 Maganement of available locales in MicrosoftTranslateClient
- Create remote_available_locales method to recover available locales from microsoft tanslate client. This method will be useful to display the translation button as long as the locale sent is valid.
- Create parse_locale method: Need parse available locales in Consul to will be valid on Microsoft Translate Client
2019-06-27 09:19:36 +02:00
taitus
31011033a7 Create MicrosoftTranslateClient
- Conect to remote translation service and translate array of strings
- Create SentencesParser module with texts management methods:
  - Detect split position method: When the text requested to translate is too large, we need split it in smaller parts for we can translate. This method search first valid point (dot or whitespace) for split this text so then we can get an response without dividing the word in half.
2019-06-27 09:19:36 +02:00
taitus
fa80d96249 Add new key to api's secrets group 2019-06-27 09:19:36 +02:00
taitus
f53043ee2a Install gem 'translator-text' to conect with MicrosoftTranslation Service
API Wrapper for the Microsoft Translator Text API 3.0
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
ba9e9887ed Set globalize fallbacks for requests
New version of globalize uses RequestStore gem to store I18n.locale and
Globalize.fallbacks in a per request basis to avoid collissions between
different requests. This gem update broke Globalize.fallback results
because it tries to fetch fallbacks from RequestStore, where there is no
locale fallbacks definition.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
3d04b388ad Adapt translatable shared specs
Adapt translatable shared specs to define an owner when running at
frontend feature specs.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
cf370cab84 Adapt suggest script for translations
Proposal, Debate, Budget Investment  and Comment will be translatable
models soon. This commit prepares suggestions script to work well with
translatable forms elements too.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
4f0d1399f2 Fix html with links sanitization
Globalize attribute accessors were arriving here as Strings intead of
ActiveSupport::SafeBuffer so they were not sanitized correctly.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
5881f8241e Sanitization shared spec
Create sanitization shared spec to check sanitizable concern features
in all translatable models.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
206f92b9fa Enable soft_deletion of Banner::Translations
Also create missing banner model spec.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
caa9e1cd49 Enable soft_deletion of Poll::Question::Translations 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
e451c4657c Enable soft_deletion of Poll::Translations 2019-06-27 09:19:36 +02:00