about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20171009222537_create_keyword_mutes.rb2
-rw-r--r--db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb2
-rw-r--r--db/migrate/20171210213213_add_local_only_flag_to_statuses.rb2
-rw-r--r--db/migrate/20180410220657_create_bookmarks.rb2
-rw-r--r--db/migrate/20180604000556_add_apply_to_mentions_flag_to_keyword_mutes.rb2
-rw-r--r--db/migrate/20180707193142_migrate_filters.rb12
-rw-r--r--db/migrate/20190512200918_add_content_type_to_statuses.rb2
-rw-r--r--db/migrate/20220209175231_add_content_type_to_status_edits.rb2
-rw-r--r--db/post_migrate/20180813160548_post_migrate_filters.rb6
9 files changed, 25 insertions, 7 deletions
diff --git a/db/migrate/20171009222537_create_keyword_mutes.rb b/db/migrate/20171009222537_create_keyword_mutes.rb
index 66411ba1d..77c88b0a5 100644
--- a/db/migrate/20171009222537_create_keyword_mutes.rb
+++ b/db/migrate/20171009222537_create_keyword_mutes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class CreateKeywordMutes < ActiveRecord::Migration[5.1]
   def change
     create_table :keyword_mutes do |t|
diff --git a/db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb b/db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb
index 269bb49d6..b6ea537c2 100644
--- a/db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb
+++ b/db/migrate/20171021191900_move_keyword_mutes_into_glitch_namespace.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class MoveKeywordMutesIntoGlitchNamespace < ActiveRecord::Migration[5.1]
   def change
     safety_assured do
diff --git a/db/migrate/20171210213213_add_local_only_flag_to_statuses.rb b/db/migrate/20171210213213_add_local_only_flag_to_statuses.rb
index af1e29d6a..010503b10 100644
--- a/db/migrate/20171210213213_add_local_only_flag_to_statuses.rb
+++ b/db/migrate/20171210213213_add_local_only_flag_to_statuses.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class AddLocalOnlyFlagToStatuses < ActiveRecord::Migration[5.1]
   def change
     add_column :statuses, :local_only, :boolean
diff --git a/db/migrate/20180410220657_create_bookmarks.rb b/db/migrate/20180410220657_create_bookmarks.rb
index bc79022e4..aba21f5ea 100644
--- a/db/migrate/20180410220657_create_bookmarks.rb
+++ b/db/migrate/20180410220657_create_bookmarks.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 # This migration is a duplicate of 20180831171112 and may get ignored, see
 # config/initializers/0_duplicate_migrations.rb
 
diff --git a/db/migrate/20180604000556_add_apply_to_mentions_flag_to_keyword_mutes.rb b/db/migrate/20180604000556_add_apply_to_mentions_flag_to_keyword_mutes.rb
index cd97d0f20..8078a07bf 100644
--- a/db/migrate/20180604000556_add_apply_to_mentions_flag_to_keyword_mutes.rb
+++ b/db/migrate/20180604000556_add_apply_to_mentions_flag_to_keyword_mutes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'mastodon/migration_helpers'
 
 class AddApplyToMentionsFlagToKeywordMutes < ActiveRecord::Migration[5.2]
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
diff --git a/db/migrate/20190512200918_add_content_type_to_statuses.rb b/db/migrate/20190512200918_add_content_type_to_statuses.rb
index efbe2caa7..31c1a4f17 100644
--- a/db/migrate/20190512200918_add_content_type_to_statuses.rb
+++ b/db/migrate/20190512200918_add_content_type_to_statuses.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class AddContentTypeToStatuses < ActiveRecord::Migration[5.2]
   def change
     add_column :statuses, :content_type, :string
diff --git a/db/migrate/20220209175231_add_content_type_to_status_edits.rb b/db/migrate/20220209175231_add_content_type_to_status_edits.rb
index 0e4e52fcb..bb414535d 100644
--- a/db/migrate/20220209175231_add_content_type_to_status_edits.rb
+++ b/db/migrate/20220209175231_add_content_type_to_status_edits.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class AddContentTypeToStatusEdits < ActiveRecord::Migration[6.1]
   def change
     add_column :status_edits, :content_type, :string
diff --git a/db/post_migrate/20180813160548_post_migrate_filters.rb b/db/post_migrate/20180813160548_post_migrate_filters.rb
index 588548c1d..82acf13d5 100644
--- a/db/post_migrate/20180813160548_post_migrate_filters.rb
+++ b/db/post_migrate/20180813160548_post_migrate_filters.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 class PostMigrateFilters < ActiveRecord::Migration[5.2]
   disable_ddl_transaction!
 
@@ -5,7 +7,5 @@ class PostMigrateFilters < ActiveRecord::Migration[5.2]
     drop_table :glitch_keyword_mutes if table_exists? :glitch_keyword_mutes
   end
 
-  def down
-  end
+  def down; end
 end
-