From 630744563fcddba4e2a57a91a56d4b33d7e76f6c Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 18 Jul 2023 12:10:52 -0400 Subject: [PATCH] Fix haml-lint `InstanceVariables` rule for auth/registrations/edit (#26061) --- .haml-lint_todo.yml | 5 ++--- .../auth/registrations/_session.html.haml | 16 ++++++++++++++++ .../auth/registrations/_sessions.html.haml | 19 +------------------ app/views/auth/registrations/edit.html.haml | 2 +- 4 files changed, 20 insertions(+), 22 deletions(-) create mode 100644 app/views/auth/registrations/_session.html.haml diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index ec0a9d3a49..26599fcc7b 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `haml-lint --auto-gen-config` -# on 2023-07-18 11:29:47 -0400 using Haml-Lint version 0.48.0. +# on 2023-07-18 11:56:05 -0400 using Haml-Lint version 0.48.0. # The point is for the user to remove these configuration records # one by one as the lints are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -26,13 +26,12 @@ linters: - 'app/views/admin/reports/show.html.haml' - 'app/views/disputes/strikes/show.html.haml' - # Offense count: 41 + # Offense count: 40 InstanceVariables: exclude: - 'app/views/admin/reports/_actions.html.haml' - 'app/views/admin/roles/_form.html.haml' - 'app/views/admin/webhooks/_form.html.haml' - - 'app/views/auth/registrations/_sessions.html.haml' - 'app/views/auth/registrations/_status.html.haml' - 'app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml' - 'app/views/authorize_interactions/_post_follow_actions.html.haml' diff --git a/app/views/auth/registrations/_session.html.haml b/app/views/auth/registrations/_session.html.haml new file mode 100644 index 0000000000..11eae566fa --- /dev/null +++ b/app/views/auth/registrations/_session.html.haml @@ -0,0 +1,16 @@ +%tr + %td + %span{ title: session.user_agent }< + = fa_icon "#{session_device_icon(session)} fw", 'aria-label': session_device_icon(session) + = ' ' + = t 'sessions.description', browser: t("sessions.browsers.#{session.browser}", default: session.browser.to_s), platform: t("sessions.platforms.#{session.platform}", default: session.platform.to_s) + %td + %samp= session.ip + %td + - if current_session.session_id == session.session_id + = t 'sessions.current_session' + - else + %time.time-ago{ datetime: session.updated_at.iso8601, title: l(session.updated_at) }= l(session.updated_at) + %td + - if current_session.session_id != session.session_id && !current_account.suspended? + = table_link_to 'times', t('sessions.revoke'), settings_session_path(session), method: :delete diff --git a/app/views/auth/registrations/_sessions.html.haml b/app/views/auth/registrations/_sessions.html.haml index 55d753c18a..929129a5a1 100644 --- a/app/views/auth/registrations/_sessions.html.haml +++ b/app/views/auth/registrations/_sessions.html.haml @@ -14,21 +14,4 @@ %th= t 'sessions.activity' %th %tbody - - @sessions.each do |session| - %tr - %td - %span{ title: session.user_agent }< - = fa_icon "#{session_device_icon(session)} fw", 'aria-label': session_device_icon(session) - = ' ' - = t 'sessions.description', browser: t("sessions.browsers.#{session.browser}", default: session.browser.to_s), platform: t("sessions.platforms.#{session.platform}", default: session.platform.to_s) - %td - %samp= session.ip - %td - - if current_session.session_id == session.session_id - = t 'sessions.current_session' - - else - %time.time-ago{ datetime: session.updated_at.iso8601, title: l(session.updated_at) }= l(session.updated_at) - %td - - if current_session.session_id != session.session_id && !current_account.suspended? - = table_link_to 'times', t('sessions.revoke'), settings_session_path(session), method: :delete - + = render partial: 'session', collection: sessions diff --git a/app/views/auth/registrations/edit.html.haml b/app/views/auth/registrations/edit.html.haml index 27d3f331eb..3e9b0cb6bd 100644 --- a/app/views/auth/registrations/edit.html.haml +++ b/app/views/auth/registrations/edit.html.haml @@ -30,7 +30,7 @@ %hr.spacer/ -= render 'sessions' += render partial: 'sessions', object: @sessions - unless current_account.suspended? %hr.spacer/