From a857887398267ad3d71e76f05adf9325ad81c893 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sun, 26 Jun 2022 17:43:34 +0200 Subject: [PATCH] Appease the dog overlords --- app/models/user/ban_methods.rb | 4 +++- .../20220626134554_remove_ban_related_field_from_users.rb | 2 ++ lib/exporter.rb | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/user/ban_methods.rb b/app/models/user/ban_methods.rb index fffd4c31..07826b1b 100644 --- a/app/models/user/ban_methods.rb +++ b/app/models/user/ban_methods.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module User::BanMethods def permanently_banned? bans.current.first&.permanent? || false end def banned? - self.bans.current.count > 0 + bans.current.count.positive? end def unban diff --git a/db/migrate/20220626134554_remove_ban_related_field_from_users.rb b/db/migrate/20220626134554_remove_ban_related_field_from_users.rb index a338c58a..6e81d26a 100644 --- a/db/migrate/20220626134554_remove_ban_related_field_from_users.rb +++ b/db/migrate/20220626134554_remove_ban_related_field_from_users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RemoveBanRelatedFieldFromUsers < ActiveRecord::Migration[6.1] def change remove_column :users, :permanently_banned, :boolean, default: false diff --git a/lib/exporter.rb b/lib/exporter.rb index 58191699..b26ae9e5 100644 --- a/lib/exporter.rb +++ b/lib/exporter.rb @@ -34,13 +34,13 @@ class Exporter private def collect_user_info - %i(answered_count asked_count comment_smiled_count commented_count + %i[answered_count asked_count comment_smiled_count commented_count confirmation_sent_at confirmed_at created_at profile_header profile_header_h profile_header_w profile_header_x profile_header_y profile_picture_w profile_picture_h profile_picture_x profile_picture_y current_sign_in_at current_sign_in_ip id last_sign_in_at last_sign_in_ip locale privacy_allow_anonymous_questions privacy_allow_public_timeline privacy_allow_stranger_answers privacy_show_in_search profile_header_file_name profile_picture_file_name - screen_name show_foreign_themes sign_in_count smiled_count updated_at).each do |f| + screen_name show_foreign_themes sign_in_count smiled_count updated_at].each do |f| @obj[f] = @user.send f end