From cddb50cc226724d1e7a87994e24c6dfbe324e8cd Mon Sep 17 00:00:00 2001 From: Dominik Kwiatek Date: Mon, 16 Nov 2020 18:18:42 +0100 Subject: [PATCH 1/2] Update dependencies and fix new lint warnings --- Gemfile.lock | 183 +++++++++++++++-------------- app/views/answerbox/_actions.haml | 9 +- app/views/answerbox/_comments.haml | 9 +- app/views/answerbox/_header.haml | 9 +- app/views/inbox/_entry.haml | 9 +- app/views/layouts/base.haml | 5 +- app/views/modal/_ban.haml | 2 +- app/views/navigation/_main.haml | 11 +- app/views/notifications/index.haml | 6 +- 9 files changed, 120 insertions(+), 123 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 91034a28..7de67dd3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,25 +36,25 @@ GEM remote: https://rubygems.org/ remote: https://rails-assets.org/ specs: - actioncable (5.2.4.3) - actionpack (= 5.2.4.3) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.3) - actionpack (= 5.2.4.3) - actionview (= 5.2.4.3) - activejob (= 5.2.4.3) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.3) - actionview (= 5.2.4.3) - activesupport (= 5.2.4.3) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.3) - activesupport (= 5.2.4.3) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -62,24 +62,24 @@ GEM active_model_otp (2.0.1) activemodel rotp (~> 5.0.0) - activejob (5.2.4.3) - activesupport (= 5.2.4.3) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) globalid (>= 0.3.6) - activemodel (5.2.4.3) - activesupport (= 5.2.4.3) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (5.2.4.3) - activemodel (= 5.2.4.3) - activesupport (= 5.2.4.3) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) arel (>= 9.0) - activestorage (5.2.4.3) - actionpack (= 5.2.4.3) - activerecord (= 5.2.4.3) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) marcel (~> 0.3.1) - activesupport (5.2.4.3) + activesupport (5.2.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -90,15 +90,15 @@ GEM ast (2.4.1) autoprefixer-rails (9.8.5) execjs - bcrypt (3.1.13) - better_errors (2.7.1) + bcrypt (3.1.16) + better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) bindex (0.8.1) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bootstrap (4.5.0) + bootstrap (4.5.3) autoprefixer-rails (>= 9.1.0) popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) @@ -109,7 +109,7 @@ GEM bootstrap_form (4.5.0) actionpack (>= 5.2) activemodel (>= 5.2) - brakeman (4.8.2) + brakeman (4.10.0) buftok (0.2.0) builder (3.2.4) byebug (11.1.3) @@ -128,7 +128,7 @@ GEM image_processing (~> 1.1) mimemagic (>= 0.3.0) mini_mime (>= 0.1.3) - chunky_png (1.3.12) + chunky_png (1.3.14) cliver (0.3.2) coderay (1.1.3) coffee-rails (4.2.2) @@ -139,12 +139,12 @@ GEM execjs coffee-script-source (1.12.2) colorize (0.8.1) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.7) connection_pool (2.2.3) crass (1.0.6) database_cleaner (1.8.5) debug_inspector (0.0.3) - devise (4.7.2) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -153,15 +153,15 @@ GEM devise-async (1.0.0) activejob (>= 5.0) devise (>= 4.0) - devise-i18n (1.9.1) + devise-i18n (1.9.2) devise (>= 4.7.1) diff-lcs (1.4.4) docile (1.3.2) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) equalizer (0.0.11) - erubi (1.9.0) - excon (0.75.0) + erubi (1.10.0) + excon (0.78.0) execjs (2.7.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -173,20 +173,21 @@ GEM mail faker (2.2.1) i18n (>= 0.8) - faraday (1.0.1) + faraday (1.1.0) multipart-post (>= 1.2, < 3) + ruby2_keywords faraday_middleware (1.0.0) faraday (~> 1.0) ffi (1.13.1) ffi-compiler (1.0.1) ffi (>= 1.0.0) rake - fog-aws (3.6.6) + fog-aws (3.6.7) fog-core (~> 2.1) fog-json (~> 1.1) fog-xml (~> 0.1) ipaddress (~> 0.8) - fog-core (2.2.0) + fog-core (2.2.3) builder excon (~> 0.71) formatador (~> 0.2) @@ -220,11 +221,12 @@ GEM guard (>= 2.0.0) guard-compat (~> 1.0) guard-compat (1.2.1) - haml (5.1.2) + haml (5.2.0) temple (>= 0.8.0) tilt - haml_lint (0.35.0) - haml (>= 4.0, < 5.2) + haml_lint (0.36.0) + haml (>= 4.0, < 5.3) + parallel (~> 1.10) rainbow rubocop (>= 0.50.0) sysexits (~> 1.1) @@ -237,8 +239,8 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) http-form_data (2.3.0) - http-parser (1.2.1) - ffi-compiler (>= 1.0, < 2.0) + http-parser (1.2.2) + ffi-compiler http_parser.rb (0.6.0) httparty (0.18.1) mime-types (~> 3.0) @@ -247,11 +249,11 @@ GEM concurrent-ruby (~> 1.0) i18n-js (3.0.0.rc10) i18n (~> 0.6) - image_processing (1.11.0) + image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) ipaddress (0.8.3) - jbuilder (2.10.0) + jbuilder (2.10.1) activesupport (>= 5.0.0) jquery-minicolors-rails (2.2.6.2) jquery-rails @@ -282,13 +284,13 @@ GEM addressable (~> 2.7) letter_opener (1.7.0) launchy (~> 2.2) - listen (3.2.1) + listen (3.3.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.6.0) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.2.6) + lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) @@ -298,12 +300,12 @@ GEM method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2020.0512) + mime-types-data (3.2020.1104) mimemagic (0.3.5) - mini_magick (4.10.1) + mini_magick (4.11.0) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.14.1) + minitest (5.14.2) moment-timezone-rails (1.0.0) momentjs-rails (>= 2.10.5, <= 3.0.0) momentjs-rails (2.20.1) @@ -314,8 +316,8 @@ GEM naught (1.1.0) nenv (0.3.0) nested_form (0.3.2) - newrelic_rpm (6.11.0.365) - nio4r (2.5.2) + newrelic_rpm (6.13.1) + nio4r (2.5.4) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) nokogumbo (2.0.2) @@ -338,11 +340,11 @@ GEM omniauth-oauth (~> 1.1) rack orm_adapter (0.5.0) - parallel (1.19.2) - parser (2.7.1.4) + parallel (1.20.0) + parser (2.7.2.0) ast (~> 2.4.1) pg (1.2.3) - pghero (2.7.0) + pghero (2.7.2) activerecord (>= 5) poltergeist (1.18.1) capybara (>= 2.1, < 4) @@ -352,29 +354,29 @@ GEM pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.5) - puma (4.3.5) + public_suffix (4.0.6) + puma (5.0.4) nio4r (~> 2.0) rack (2.2.3) rack-pjax (1.1.0) nokogiri (~> 1.5) rack (>= 1.1) - rack-protection (2.0.8.1) + rack-protection (2.1.0) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.3) - actioncable (= 5.2.4.3) - actionmailer (= 5.2.4.3) - actionpack (= 5.2.4.3) - actionview (= 5.2.4.3) - activejob (= 5.2.4.3) - activemodel (= 5.2.4.3) - activerecord (= 5.2.4.3) - activestorage (= 5.2.4.3) - activesupport (= 5.2.4.3) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) bundler (>= 1.3.0) - railties (= 5.2.4.3) + railties (= 5.2.4.4) sprockets-rails (>= 2.0.0) rails-assets-growl (1.3.5) rails-assets-jquery @@ -403,9 +405,9 @@ GEM rails (>= 5.0, < 7) remotipart (~> 1.3) sassc-rails (>= 1.3, < 3) - railties (5.2.4.3) - actionpack (= 5.2.4.3) - activesupport (= 5.2.4.3) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -416,7 +418,7 @@ GEM ffi (~> 1.0) redcarpet (3.5.0) redis (4.1.4) - regexp_parser (1.7.1) + regexp_parser (1.8.2) remotipart (1.4.4) responders (3.0.1) actionpack (>= 5.0) @@ -429,9 +431,9 @@ GEM chunky_png (~> 1.0) rqrcode_core (~> 0.1) rqrcode_core (0.1.2) - rspec-core (3.9.2) + rspec-core (3.9.3) rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-its (1.3.0) @@ -451,21 +453,22 @@ GEM rspec-sidekiq (3.1.0) rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) - rspec-support (3.9.3) - rubocop (0.88.0) + rspec-support (3.9.4) + rubocop (1.3.1) parallel (~> 1.10) - parser (>= 2.7.1.1) + parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) + regexp_parser (>= 1.8) rexml - rubocop-ast (>= 0.1.0, < 1.0) + rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.1.0) - parser (>= 2.7.0.1) + rubocop-ast (1.1.1) + parser (>= 2.7.1.5) ruby-progressbar (1.10.1) ruby-vips (2.0.17) ffi (~> 1.9) + ruby2_keywords (0.0.2) sanitize (5.2.1) crass (~> 1.0.2) nokogiri (>= 1.8.0) @@ -496,20 +499,20 @@ GEM rack-protection (>= 1.5.0) redis (>= 3.3.5, < 4.2) simple_oauth (0.3.1) - simplecov (0.18.5) + simplecov (0.19.1) docile (~> 1.1) simplecov-html (~> 0.11) - simplecov-cobertura (1.3.1) + simplecov-cobertura (1.4.1) simplecov (~> 0.8) - simplecov-html (0.12.2) - simplecov-json (0.2.1) + simplecov-html (0.12.3) + simplecov-json (0.2.3) json simplecov - spring (2.1.0) + spring (2.1.1) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -520,7 +523,7 @@ GEM thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) - timecop (0.9.1) + timecop (0.9.2) tiny-color-rails (0.0.2) railties (>= 3.0) turbolinks (2.5.4) @@ -536,7 +539,7 @@ GEM multipart-post (~> 2.0) naught (~> 1.0) simple_oauth (~> 0.3.0) - tzinfo (1.2.7) + tzinfo (1.2.8) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) @@ -544,8 +547,8 @@ GEM unf_ext unf_ext (0.0.7.7) unicode-display_width (1.7.0) - warden (1.2.8) - rack (>= 2.0.6) + warden (1.2.9) + rack (>= 2.0.9) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) diff --git a/app/views/answerbox/_actions.haml b/app/views/answerbox/_actions.haml index 9e208d9f..f6f99c12 100644 --- a/app/views/answerbox/_actions.haml +++ b/app/views/answerbox/_actions.haml @@ -1,9 +1,8 @@ %span.d-none.d-sm-inline.text-muted - - unless user_signed_in? - - if a.smile_count.positive? - %button.btn.btn-info.btn-sm{ name: 'ab-smile', disabled: true } - %i.fa.fa-smile-o - %span{ id: "ab-smile-count-#{a.id}" }= a.smile_count + - if !user_signed_in? && a.smile_count.positive? + %button.btn.btn-info.btn-sm{ name: 'ab-smile', disabled: true } + %i.fa.fa-smile-o + %span{ id: "ab-smile-count-#{a.id}" }= a.smile_count - if user_signed_in? - if current_user.smiled? a %button.btn.btn-link.answerbox__action{ type: :button, name: 'ab-smile', data: { a_id: a.id, action: :unsmile } } diff --git a/app/views/answerbox/_comments.haml b/app/views/answerbox/_comments.haml index d2dbf2d3..437d8d8b 100644 --- a/app/views/answerbox/_comments.haml +++ b/app/views/answerbox/_comments.haml @@ -18,11 +18,10 @@ = markdown comment.content .pull-right %span.d-none.d-sm-inline.text-muted - - unless user_signed_in? - - if comment.smile_count.positive? - %button.btn.btn-link.answerbox__action{ name: 'ab-smile-comment', disabled: true } - %i.fa.fa-smile-o - %span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count + - if !user_signed_in? && comment.smile_count.positive? + %button.btn.btn-link.answerbox__action{ name: 'ab-smile-comment', disabled: true } + %i.fa.fa-smile-o + %span{ id: "ab-comment-smile-count-#{comment.id}" }= comment.smile_count - if user_signed_in? - if current_user.smiled_comment? comment %button.btn.btn-link.answerbox__action{ type: :button, name: 'ab-smile-comment', data: { c_id: comment.id, action: :unsmile } } diff --git a/app/views/answerbox/_header.haml b/app/views/answerbox/_header.haml index 15629140..5b262bb4 100644 --- a/app/views/answerbox/_header.haml +++ b/app/views/answerbox/_header.haml @@ -20,10 +20,9 @@ = t 'views.actions.report' %h6.text-muted.media-heading.answerbox__question-user = raw t('views.answerbox.asked', user: user_screen_name(a.question.user, anonymous: a.question.author_is_anonymous), time: time_tooltip(a.question)) - - unless a.question.author_is_anonymous - - if a.question.answer_count > 1 - · - %a{ href: show_user_question_path(a.question.user.screen_name, a.question.id) } - = pluralize(a.question.answer_count, t('views.general.answer')) + - if !a.question.author_is_anonymous && a.question.answer_count > 1 + · + %a{ href: show_user_question_path(a.question.user.screen_name, a.question.id) } + = pluralize(a.question.answer_count, t('views.general.answer')) .answerbox__question-text = a.question.content diff --git a/app/views/inbox/_entry.haml b/app/views/inbox/_entry.haml index 9e7066b4..216c61ee 100644 --- a/app/views/inbox/_entry.haml +++ b/app/views/inbox/_entry.haml @@ -7,11 +7,10 @@ .media-body %h6.text-muted.media-heading.answerbox__question-user = raw t('views.inbox.entry.asked', user: user_screen_name(i.question.user, anonymous: i.question.author_is_anonymous), time: time_tooltip(i.question)) - - unless i.question.author_is_anonymous - - if i.question.answer_count.positive? - · - %a{ href: show_user_question_path(i.question.user.screen_name, i.question.id) } - = pluralize(i.question.answer_count, t('views.inbox.entry.response')) + - if !i.question.author_is_anonymous && i.question.answer_count.positive? + · + %a{ href: show_user_question_path(i.question.user.screen_name, i.question.id) } + = pluralize(i.question.answer_count, t('views.inbox.entry.response')) %p.answerbox__question-text= i.question.content .card-body %textarea.form-control{ name: 'ib-answer', placeholder: t('views.placeholder.inbox'), data: { id: i.id } } diff --git a/app/views/layouts/base.haml b/app/views/layouts/base.haml index 6910315d..cae1feee 100644 --- a/app/views/layouts/base.haml +++ b/app/views/layouts/base.haml @@ -13,9 +13,8 @@ = javascript_include_tag 'i18n', data: { 'turbolinks-track': true } = stylesheet_link_tag 'application', media: 'all', data: { 'turbolinks-track': true } = javascript_include_tag 'application', data: { 'turbolinks-track': true } - - if user_signed_in? - - if current_user.mod? - = javascript_include_tag 'moderation', data: { 'turbolinks-track': true } + - if user_signed_in? && current_user.mod? + = javascript_include_tag 'moderation', data: { 'turbolinks-track': true } = csrf_meta_tags %body - if user_signed_in? diff --git a/app/views/modal/_ban.haml b/app/views/modal/_ban.haml index 8720d03b..9854cae1 100644 --- a/app/views/modal/_ban.haml +++ b/app/views/modal/_ban.haml @@ -11,7 +11,7 @@ = f.hidden_field :user, value: user.screen_name .modal-body#ban-control-super = f.check_box :ban, label: t('views.modal.bancontrol.ban'), checked: user.banned? - #ban-controls{ style: !user.banned? ? 'display: none' : '' } + #ban-controls{ style: user.banned? ? '' : 'display: none' } = f.check_box :permaban, label: t('views.modal.bancontrol.permanent'), checked: user.permanently_banned? #ban-controls-time{ style: user.permanently_banned? ? 'display: none' : '' } = f.text_field :until, label: '', required: true, value: (user.banned_until || DateTime.current).strftime('%m/%d/%Y %I:%M %p') diff --git a/app/views/navigation/_main.haml b/app/views/navigation/_main.haml index 6566cc18..8da51976 100644 --- a/app/views/navigation/_main.haml +++ b/app/views/navigation/_main.haml @@ -11,12 +11,11 @@ - if APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod? = nav_entry t('views.navigation.discover'), discover_path %ul.nav.navbar-nav - - unless @user.nil? - - unless @user == current_user - %li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.list') } - %a.nav-link{ href: '#', data: { target: '#modal-list-memberships', toggle: :modal } } - %i.fa.fa-list.hidden-xs - %span.d-none.d-sm-inline.d-md-none= t('views.actions.list') + - unless @user.nil? && @user == current_user + %li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.list') } + %a.nav-link{ href: '#', data: { target: '#modal-list-memberships', toggle: :modal } } + %i.fa.fa-list.hidden-xs + %span.d-none.d-sm-inline.d-md-none= t('views.actions.list') = render 'navigation/main/notifications' %li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.ask_question') } %a.nav-link{ href: '#', name: 'toggle-all-ask', data: { target: '#modal-ask-followers', toggle: :modal } } diff --git a/app/views/notifications/index.haml b/app/views/notifications/index.haml index 1746120d..4c472f81 100644 --- a/app/views/notifications/index.haml +++ b/app/views/notifications/index.haml @@ -5,10 +5,10 @@ .notifications--none %i.fa.fa-bell-o.notification__bell-icon %p - - if params[:type] != 'all' - No new notifications. - - else + - if params[:type] == 'all' No notifications. + - else + No new notifications. - else - @notifications.each do |notification| %li.list-group-item From 3db3ccfc412bbf6c8da6a7012d2b934e0bff8f0d Mon Sep 17 00:00:00 2001 From: Dominik Kwiatek Date: Tue, 17 Nov 2020 21:33:49 +0100 Subject: [PATCH 2/2] Fix incorrectly updated conditions --- app/views/navigation/_main.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/navigation/_main.haml b/app/views/navigation/_main.haml index 8da51976..c08b1df9 100644 --- a/app/views/navigation/_main.haml +++ b/app/views/navigation/_main.haml @@ -11,7 +11,7 @@ - if APP_CONFIG.dig(:features, :discover, :enabled) || current_user.mod? = nav_entry t('views.navigation.discover'), discover_path %ul.nav.navbar-nav - - unless @user.nil? && @user == current_user + - if @user.present? && @user != current_user %li.nav-item.d-none.d-sm-block{ data: { toggle: 'tooltip', placement: 'bottom' }, title: t('views.actions.list') } %a.nav-link{ href: '#', data: { target: '#modal-list-memberships', toggle: :modal } } %i.fa.fa-list.hidden-xs