about summary refs log tree commit diff
path: root/db/migrate/20180707193142_migrate_filters.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-04-09 11:25:30 +0200
committerGitHub <noreply@github.com>2023-04-09 11:25:30 +0200
commitff168ef2024626f37fa776fde5739dcd58ecb9f2 (patch)
tree5b638b2e5a43445a75133a9b510bff00d44ea986 /db/migrate/20180707193142_migrate_filters.rb
parent29a91b871eb4fb375baa3701e29cfb35f884bb98 (diff)
Fix most rubocop issues (#2165)
* Run rubocop --autocorrect on app/, config/ and lib/, also manually fix some remaining style issues

* Run rubocop --autocorrect-all on db/

* Run rubocop --autocorrect-all on `spec/` and fix remaining issues
Diffstat (limited to 'db/migrate/20180707193142_migrate_filters.rb')
-rw-r--r--db/migrate/20180707193142_migrate_filters.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/db/migrate/20180707193142_migrate_filters.rb b/db/migrate/20180707193142_migrate_filters.rb
index 067c53357..8f6b3e1bb 100644
--- a/db/migrate/20180707193142_migrate_filters.rb
+++ b/db/migrate/20180707193142_migrate_filters.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
 class MigrateFilters < ActiveRecord::Migration[5.2]
   class GlitchKeywordMute < ApplicationRecord
     # Dummy class, as we removed Glitch::KeywordMute
-    belongs_to :account, required: true
+    belongs_to :account, optional: false
     validates_presence_of :keyword
   end
 
@@ -15,7 +17,7 @@ class MigrateFilters < ActiveRecord::Migration[5.2]
     private
 
     def clean_up_contexts
-      self.context = Array(context).map(&:strip).map(&:presence).compact
+      self.context = Array(context).map(&:strip).filter_map(&:presence)
     end
   end
 
@@ -27,7 +29,8 @@ class MigrateFilters < ActiveRecord::Migration[5.2]
         phrase: filter.keyword,
         context: filter.apply_to_mentions ? %w(home public notifications) : %w(home public),
         whole_word: filter.whole_word,
-        irreversible: true)
+        irreversible: true
+      )
     end
   end
 
@@ -48,7 +51,8 @@ class MigrateFilters < ActiveRecord::Migration[5.2]
       GlitchKeywordMute.where(account: filter.account).create!(
         keyword: filter.phrase,
         whole_word: filter.whole_word,
-        apply_to_mentions: filter.context.include?('notifications'))
+        apply_to_mentions: filter.context.include?('notifications')
+      )
     end
   end
 end