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
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CreateKeywordMutes < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :keyword_mutes do |t|
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class MoveKeywordMutesIntoGlitchNamespace < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
safety_assured do
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddLocalOnlyFlagToStatuses < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :statuses, :local_only, :boolean
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'mastodon/migration_helpers'
|
||||
|
||||
class AddApplyToMentionsFlagToKeywordMutes < ActiveRecord::Migration[5.2]
|
||||
|
@@ -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
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddContentTypeToStatuses < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :statuses, :content_type, :string
|
||||
|
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddContentTypeToStatusEdits < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :status_edits, :content_type, :string
|
||||
|
Reference in New Issue
Block a user