diff --git a/.gitignore b/.gitignore index 70a3775c7..00ec87fc7 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ sgemset tags .localeapp + +.byebug_history diff --git a/.rubocop.yml b/.rubocop.yml index 62dfcb6ab..d36a46731 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,9 +5,6 @@ AllCops: Naming/AccessorMethodName: Enabled: false -Rails/ActionFilter: - Enabled: false - Style/Alias: Enabled: false @@ -57,15 +54,15 @@ Style/CommentAnnotation: Metrics/CyclomaticComplexity: Enabled: false -Rails/Delegate: - Enabled: false - Style/Documentation: Enabled: false Layout/DotPosition: EnforcedStyle: trailing +Layout/ConditionPosition: + Enabled: false + Style/DoubleNegation: Enabled: false @@ -84,9 +81,6 @@ Style/EvenOdd: Naming/FileName: Enabled: false -Style/FlipFlop: - Enabled: false - Style/FormatString: Enabled: false @@ -114,7 +108,7 @@ Style/LambdaCall: Style/LineEndConcatenation: Enabled: false -Metrics/LineLength: +Layout/LineLength: Max: 80 Metrics/MethodLength: @@ -154,7 +148,7 @@ Style/PerlBackrefs: Enabled: false Naming/PredicateName: - NamePrefixBlacklist: + ForbiddenPrefixes: - is_ Style/Proc: @@ -187,16 +181,16 @@ Style/StringLiterals: Style/VariableInterpolation: Enabled: false -Style/TrailingCommaInLiteral: +Style/TrailingCommaInArrayLiteral: Enabled: false -Style/TrailingCommaInArguments: +Style/TrailingCommaInHashLiteral: Enabled: false -Style/TrivialAccessors: +Style/TrailingCommaInArguments: Enabled: false -Style/VariableInterpolation: +Style/TrivialAccessors: Enabled: false Style/WhenThen: @@ -214,16 +208,13 @@ Lint/AmbiguousRegexpLiteral: Lint/AssignmentInCondition: Enabled: false -Lint/ConditionPosition: - Enabled: false - Lint/DeprecatedClassMethods: Enabled: false Lint/ElseLayout: Enabled: false -Lint/HandleExceptions: +Lint/SuppressedException: Enabled: false Lint/LiteralInInterpolation: @@ -243,3 +234,6 @@ Lint/UnderscorePrefixedVariableName: Lint/Void: Enabled: false + +Lint/FlipFlop: + Enabled: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 107016e16..7efd3bf7d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,4 +16,4 @@ Visita [la guía para empezar a desarrollar para timeoverflow](https://github.co - Modifica las traducciones directamente en el proyecto [coopdevs/timeoverflow](https://www.localeapp.com/projects/10031) en Locale. - **Eso es todo!** -- El mantenedor obtendrá las nuevas tradcciones del proyecto de Locale y las publicará en Github. +- El mantenedor obtendrá las nuevas traducciones del proyecto de Locale y las publicará en Github. diff --git a/Gemfile b/Gemfile index 76bb04c84..45b563721 100644 --- a/Gemfile +++ b/Gemfile @@ -10,23 +10,19 @@ gem 'has_scope' gem 'pundit', '~> 2.0.0' gem 'pg', '0.21.0' gem 'hstore_translate' -gem 'devise', '~> 4.5.0' +gem 'devise', '~> 4.7.1' gem "http_accept_language", '~> 2.1.1' gem 'unicorn' gem 'kaminari', '~> 1.1.1' gem "simple_form", ">= 3.0.0" gem 'rollbar', '2.8.3' -gem 'whenever', require: false gem 'prawn', '~> 2.2.0' gem 'prawn-table', '~> 0.2.2' gem 'elasticsearch-model' gem 'elasticsearch-rails' gem 'skylight' gem 'sidekiq', '5.1.3' -gem 'sidekiq-cron', '0.6.3' -# TODO: remove this once the following issue has been addressed -# https://github.com/ondrejbartas/sidekiq-cron/issues/199 -gem 'rufus-scheduler', '~> 3.4.2' +gem 'sidekiq-cron', '~> 1.1.0' # Assets gem 'jquery-rails', '>= 4.2.0' @@ -39,7 +35,7 @@ gem 'select2-rails' group :development do gem "binding_of_caller", '~> 0.8.0' gem "better_errors", '~> 2.4.0' - gem 'rubocop', '~> 0.52.1', require: false + gem 'rubocop', '~> 0.80.0', require: false gem 'web-console', '2.1.3' gem 'capistrano', '~> 3.1' gem 'capistrano-rails', '~> 1.1' @@ -51,17 +47,17 @@ group :development do end group :development, :test do - gem "byebug" + gem "byebug", '~> 11.0' end group :test do gem "rspec-rails", '~> 3.8.2' gem "database_cleaner", '1.6.2' gem 'shoulda-matchers', '~> 3.1.2' - gem 'fabrication' + gem 'fabrication', '~> 2.20' gem 'faker', '~> 1.9' gem 'capybara', '~> 3.15' gem 'selenium-webdriver', '~> 3.142' - gem 'webdrivers', '~> 4.1.2' + gem 'webdrivers', '~> 4.2.0' gem 'simplecov', '~> 0.17', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 400b860bc..b6c18bef4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,30 +47,28 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.1) - public_suffix (~> 2.0, >= 2.0.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) airbrussh (0.8.0) sshkit (>= 1.6.1, != 1.7.0) arbre (1.1.1) activesupport (>= 3.0.0) arel (6.0.4) ast (2.4.0) - autoprefixer-rails (6.3.1) + autoprefixer-rails (9.7.4) execjs - json - bcrypt (3.1.12) + bcrypt (3.1.13) better_errors (2.4.0) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bootstrap-sass (3.3.6) + bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) - builder (3.2.3) - byebug (4.0.5) - columnize (= 0.9.0) + sassc (>= 2.0.0) + builder (3.2.4) + byebug (11.0.0) capistrano (3.4.1) i18n rake (>= 10.0.0) @@ -84,17 +82,15 @@ GEM capistrano-rbenv (2.1.3) capistrano (~> 3.1) sshkit (~> 1.3) - capybara (3.15.1) + capybara (3.31.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.2) + regexp_parser (~> 1.5) xpath (~> 3.2) - childprocess (1.0.1) - rake (< 13.0) - chronic (0.10.2) + childprocess (3.0.0) coderay (1.1.2) coffee-rails (4.1.0) coffee-script (>= 2.2.0) @@ -103,16 +99,15 @@ GEM coffee-script-source execjs coffee-script-source (1.8.0) - columnize (0.9.0) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.6) connection_pool (2.2.1) - crass (1.0.4) + crass (1.0.6) database_cleaner (1.6.2) debug_inspector (0.0.3) - devise (4.5.0) + devise (4.7.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 6.0) + railties (>= 4.1.0) responders warden (~> 1.2.3) diff-lcs (1.3) @@ -138,17 +133,21 @@ GEM multi_json erubi (1.7.1) erubis (2.7.0) - et-orbi (1.1.2) + et-orbi (1.1.7) tzinfo - execjs (2.6.0) - fabrication (2.11.3) + execjs (2.7.0) + fabrication (2.20.1) faker (1.9.3) i18n (>= 0.7) faraday (0.9.1) multipart-post (>= 1.2, < 3) + ffi (1.12.2) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic_i18n (0.6.0) + fugit (1.1.8) + et-orbi (~> 1.1, >= 1.1.7) + raabro (~> 1.1) gli (2.16.0) globalid (0.4.2) activesupport (>= 4.2.0) @@ -168,11 +167,12 @@ GEM has_scope (~> 0.6) railties (>= 4.2, <= 5.2) responders + jaro_winkler (1.5.4) jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.1.0) + json (2.3.0) kaminari (1.1.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.1.1) @@ -195,7 +195,7 @@ GEM i18n (~> 0.4) json rest-client - loofah (2.2.3) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -203,35 +203,35 @@ GEM mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_mime (1.0.1) + mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.11.3) + minitest (5.14.0) multi_json (1.11.2) multipart-post (2.0.0) net-scp (2.0.0) net-ssh (>= 2.6.5, < 6.0.0) net-ssh (5.2.0) netrc (0.11.0) - nokogiri (1.10.3) + nokogiri (1.10.8) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) - parallel (1.12.1) - parser (2.5.0.0) + parallel (1.19.1) + parser (2.7.0.2) ast (~> 2.4.0) pdf-core (0.7.0) pg (0.21.0) polyamorous (1.3.3) activerecord (>= 3.0) - powerpack (0.1.1) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - public_suffix (2.0.5) + public_suffix (4.0.3) pundit (2.0.0) activesupport (>= 3.0.0) - rack (1.6.11) + raabro (1.1.6) + rack (1.6.13) rack-protection (2.0.1) rack rack-test (0.6.3) @@ -253,8 +253,8 @@ GEM activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) @@ -265,23 +265,27 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (3.0.0) raindrops (0.16.0) - rake (12.3.3) + rake (13.0.1) ransack (1.8.6) actionpack (>= 3.0) activerecord (>= 3.0) activesupport (>= 3.0) i18n polyamorous (~> 1.3.2) + rb-fsevent (0.10.3) + rb-inotify (0.10.1) + ffi (~> 1.0) rdiscount (2.1.7.1) redis (4.0.1) regexp_parser (1.6.0) - responders (2.4.0) - actionpack (>= 4.2.0, < 5.3) - railties (>= 4.2.0, < 5.3) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) rest-client (2.0.1) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + rexml (3.2.4) rollbar (2.8.3) multi_json rspec-core (3.8.0) @@ -301,29 +305,34 @@ GEM rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) rspec-support (3.8.0) - rubocop (0.52.1) + rubocop (0.80.0) + jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.4.0.2, < 3.0) - powerpack (~> 0.1) + parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + rexml ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) - ruby-progressbar (1.9.0) - rubyzip (1.2.3) - rufus-scheduler (3.4.2) - et-orbi (~> 1.0) - sass (3.4.21) + unicode-display_width (>= 1.4.0, < 1.7) + ruby-progressbar (1.10.1) + rubyzip (2.2.0) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + sassc (2.2.1) + ffi (~> 1.9) select2-rails (4.0.1) thor (~> 0.14) - selenium-webdriver (3.142.3) - childprocess (>= 0.5, < 2.0) - rubyzip (~> 1.2, >= 1.2.2) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) shoulda-matchers (3.1.2) activesupport (>= 4.0.0) sidekiq (5.1.3) @@ -331,8 +340,8 @@ GEM connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) redis (>= 3.3.5, < 5) - sidekiq-cron (0.6.3) - rufus-scheduler (>= 3.3.0) + sidekiq-cron (1.1.0) + fugit (~> 1.1) sidekiq (>= 4.2.1) simple_form (3.1.0) actionpack (~> 4.0) @@ -360,7 +369,7 @@ GEM thread_safe (0.3.6) tilt (2.0.8) ttfunk (1.5.1) - tzinfo (1.2.5) + tzinfo (1.2.6) thread_safe (~> 0.1) uglifier (2.7.2) execjs (>= 0.3.0) @@ -368,7 +377,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.2) - unicode-display_width (1.3.0) + unicode-display_width (1.6.1) unicorn (5.0.1) kgio (~> 2.6) rack @@ -380,12 +389,10 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) - webdrivers (4.1.2) + webdrivers (4.2.0) nokogiri (~> 1.6) - rubyzip (~> 1.0) + rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) - whenever (0.9.4) - chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) @@ -398,18 +405,18 @@ DEPENDENCIES better_errors (~> 2.4.0) binding_of_caller (~> 0.8.0) bootstrap-sass - byebug + byebug (~> 11.0) capistrano (~> 3.1) capistrano-rails (~> 1.1) capistrano-rbenv (~> 2.1) capybara (~> 3.15) coffee-rails database_cleaner (= 1.6.2) - devise (~> 4.5.0) + devise (~> 4.7.1) dotenv-rails (~> 2.7.1) elasticsearch-model elasticsearch-rails - fabrication + fabrication (~> 2.20) faker (~> 1.9) has_scope hstore_translate @@ -427,22 +434,20 @@ DEPENDENCIES rdiscount rollbar (= 2.8.3) rspec-rails (~> 3.8.2) - rubocop (~> 0.52.1) - rufus-scheduler (~> 3.4.2) + rubocop (~> 0.80.0) sass-rails (~> 5.0.7) select2-rails selenium-webdriver (~> 3.142) shoulda-matchers (~> 3.1.2) sidekiq (= 5.1.3) - sidekiq-cron (= 0.6.3) + sidekiq-cron (~> 1.1.0) simple_form (>= 3.0.0) simplecov (~> 0.17) skylight uglifier (= 2.7.2) unicorn web-console (= 2.1.3) - webdrivers (~> 4.1.2) - whenever + webdrivers (~> 4.2.0) RUBY VERSION ruby 2.6.3p62 diff --git a/app/jobs/organization_notifier_job.rb b/app/jobs/organization_notifier_job.rb new file mode 100644 index 000000000..1bd46729c --- /dev/null +++ b/app/jobs/organization_notifier_job.rb @@ -0,0 +1,20 @@ +# A weekly digest email. +# +# Strategy: go throught all organizations and take latest active posts from last week +# posted by active members. Send an email to all active and online members +# with the email notifications enabled with those posts. + +# Schedule defined in config/schedule.yml file. + +class OrganizationNotifierJob < ActiveJob::Base + queue_as :cron + + def perform + Organization.all.find_each do |org| + posts = org.posts.active.of_active_members.from_last_week + if posts.present? + OrganizationNotifier.recent_posts(posts).deliver_now + end + end + end +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/mailers/.keep b/app/mailers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/services/organization_notifier_service.rb b/app/services/organization_notifier_service.rb deleted file mode 100644 index cd00e0013..000000000 --- a/app/services/organization_notifier_service.rb +++ /dev/null @@ -1,14 +0,0 @@ -class OrganizationNotifierService - def initialize(organization) - @organization = organization - end - - def send_recent_posts_to_online_members - @organization.each do |org| - posts = org.posts.active.of_active_members.from_last_week - if posts.present? - OrganizationNotifier.recent_posts(posts).deliver_now - end - end - end -end diff --git a/app/views/statistics/statistics_all_transfers.html.erb b/app/views/statistics/statistics_all_transfers.html.erb index 5cb16c02a..823b9aa4e 100644 --- a/app/views/statistics/statistics_all_transfers.html.erb +++ b/app/views/statistics/statistics_all_transfers.html.erb @@ -2,7 +2,7 @@ <%= t 'global.statistics' %>: <%= t '.transfers' %>
-
+
diff --git a/app/views/statistics/statistics_inactive_users.html.erb b/app/views/statistics/statistics_inactive_users.html.erb index 756fadd77..addc8cfc2 100644 --- a/app/views/statistics/statistics_inactive_users.html.erb +++ b/app/views/statistics/statistics_inactive_users.html.erb @@ -2,7 +2,7 @@ <%= t 'global.statistics' %>: <%= t '.inactive_users' %>
-
+
diff --git a/app/views/statistics/statistics_last_login.html.erb b/app/views/statistics/statistics_last_login.html.erb index d2150e6d9..296127761 100644 --- a/app/views/statistics/statistics_last_login.html.erb +++ b/app/views/statistics/statistics_last_login.html.erb @@ -1,7 +1,7 @@

<%= t 'global.statistics' %>: <%= t '.last_login' %>

-
+
diff --git a/app/views/statistics/statistics_type_swaps.html.erb b/app/views/statistics/statistics_type_swaps.html.erb index cedb0859f..bd8385b13 100644 --- a/app/views/statistics/statistics_type_swaps.html.erb +++ b/app/views/statistics/statistics_type_swaps.html.erb @@ -1,7 +1,7 @@

<%= t 'global.statistics' %>: <%= t '.type_of_swaps' %>

-
+
diff --git a/app/views/statistics/statistics_without_offers.html.erb b/app/views/statistics/statistics_without_offers.html.erb index 4b61a62f1..0dc738d2c 100644 --- a/app/views/statistics/statistics_without_offers.html.erb +++ b/app/views/statistics/statistics_without_offers.html.erb @@ -1,7 +1,7 @@

<%= t 'global.statistics' %>: <%= t '.without_offers' %>

-
+
diff --git a/app/views/tags/_grouped_index.html.erb b/app/views/tags/_grouped_index.html.erb index befe8c6c2..a3be369bb 100644 --- a/app/views/tags/_grouped_index.html.erb +++ b/app/views/tags/_grouped_index.html.erb @@ -2,7 +2,7 @@ <% alpha_tags.each_slice(6) do |gr| %>
<% gr.each do |kg, vg| %> -
+

<%= kg %>

diff --git a/app/views/users/manage.html.erb b/app/views/users/manage.html.erb index 6f37ae995..186bc2759 100644 --- a/app/views/users/manage.html.erb +++ b/app/views/users/manage.html.erb @@ -11,7 +11,7 @@
<%= search_form_for(@search, class: "navbar-form navbar-left", url: manage_users_path) do |f| %>
- <%= f.search_field :user_username_or_user_email_or_member_uid_search_contains, class: "form-control" %> + <%= f.search_field :user_username_or_user_email_or_user_phone_or_user_alt_phone_or_member_uid_search_contains, class: "form-control" %>