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:
Claire
2023-04-09 11:25:30 +02:00
committed by GitHub
parent 29a91b871e
commit ff168ef202
45 changed files with 211 additions and 216 deletions

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class CreateKeywordMutes < ActiveRecord::Migration[5.1]
def change
create_table :keyword_mutes do |t|

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class MoveKeywordMutesIntoGlitchNamespace < ActiveRecord::Migration[5.1]
def change
safety_assured do

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddLocalOnlyFlagToStatuses < ActiveRecord::Migration[5.1]
def change
add_column :statuses, :local_only, :boolean

View File

@@ -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

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'mastodon/migration_helpers'
class AddApplyToMentionsFlagToKeywordMutes < ActiveRecord::Migration[5.2]

View File

@@ -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

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddContentTypeToStatuses < ActiveRecord::Migration[5.2]
def change
add_column :statuses, :content_type, :string

View File

@@ -1,3 +1,5 @@
# frozen_string_literal: true
class AddContentTypeToStatusEdits < ActiveRecord::Migration[6.1]
def change
add_column :status_edits, :content_type, :string