This commit is contained in:
KMY 2024-12-16 11:38:52 +09:00
parent 3784ad273c
commit ddd3581bd8
8 changed files with 20 additions and 15 deletions

View file

@ -5,7 +5,8 @@ class REST::StatusEditSerializer < ActiveModel::Serializer
has_one :account, serializer: REST::AccountSerializer
attributes :content, :spoiler_text, :markdown, :sensitive, :created_at
attributes :content, :spoiler_text, :sensitive, :created_at
attribute :markdown_opt, key: :markdown
has_many :ordered_media_attachments, key: :media_attachments, serializer: REST::MediaAttachmentSerializer
has_many :emojis, serializer: REST::CustomEmojiSlimSerializer
@ -19,4 +20,8 @@ class REST::StatusEditSerializer < ActiveModel::Serializer
def poll
{ options: object.poll_options.map { |title| { title: title } } }
end
def markdown_opt
object.markdown
end
end

View file

@ -2,6 +2,6 @@
class AddGroupMessageFollowingOnlyToAccounts < ActiveRecord::Migration[6.1]
def change
add_column :accounts, :group_message_following_only, :boolean
add_column :accounts, :group_message_following_only, :boolean, null: false, default: false
end
end

View file

@ -2,6 +2,6 @@
class AddGroupAllowPrivateMessageToAccounts < ActiveRecord::Migration[6.1]
def change
add_column :accounts, :group_allow_private_message, :boolean
add_column :accounts, :group_allow_private_message, :boolean, null: false, default: false
end
end

View file

@ -3,7 +3,7 @@
class AddMarkdownToStatuses < ActiveRecord::Migration[6.1]
def change
safety_assured do
add_column :statuses, :markdown, :boolean, default: false
add_column :statuses, :markdown, :boolean, default: false, null: false
end
end
end

View file

@ -3,7 +3,7 @@
class AddMarkdownToStatusEdits < ActiveRecord::Migration[6.1]
def change
safety_assured do
add_column :status_edits, :markdown, :boolean, default: false
add_column :status_edits, :markdown, :boolean, default: false, null: false
end
end
end

View file

@ -3,7 +3,7 @@
class AddEmojiReactionStreamingToAccounts < ActiveRecord::Migration[6.1]
def change
safety_assured do
add_column :accounts, :stop_emoji_reaction_streaming, :boolean, default: false
add_column :accounts, :stop_emoji_reaction_streaming, :boolean, default: false, null: false
end
end
end

View file

@ -9,7 +9,7 @@ class RemoveStopEmojiReactionStreamingFromAccounts < ActiveRecord::Migration[6.1
def down
safety_assured do
add_column :accounts, :stop_emoji_reaction_streaming, :boolean, null: true, default: false
add_column :accounts, :stop_emoji_reaction_streaming, :boolean, null: false, default: false
end
end
end

View file

@ -4,17 +4,17 @@ class ImproveIndexForPublicTimelineSpeed < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def up
add_index :statuses, [:id, :account_id], name: :index_statuses_local_20231213, algorithm: :concurrently, order: { id: :desc },
add_index :statuses, [:id, :account_id], name: :index_statuses_local_20231213, algorithm: :concurrently, order: { id: :desc }, # rubocop:disable Naming/VariableNumber
where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility IN (0, 10, 11) AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))'
add_index :statuses, [:id, :account_id], name: :index_statuses_public_20231213, algorithm: :concurrently, order: { id: :desc }, where: 'deleted_at IS NULL AND visibility IN (0, 10, 11) AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))'
remove_index :statuses, name: :index_statuses_local_20190824
remove_index :statuses, name: :index_statuses_public_20200119
add_index :statuses, [:id, :account_id], name: :index_statuses_public_20231213, algorithm: :concurrently, order: { id: :desc }, where: 'deleted_at IS NULL AND visibility IN (0, 10, 11) AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))' # rubocop:disable Naming/VariableNumber
remove_index :statuses, name: :index_statuses_local_20190824 # rubocop:disable Naming/VariableNumber
remove_index :statuses, name: :index_statuses_public_20200119 # rubocop:disable Naming/VariableNumber
end
def down
add_index :statuses, [:id, :account_id], name: :index_statuses_local_20190824, algorithm: :concurrently, order: { id: :desc }, where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))'
add_index :statuses, [:id, :account_id], name: :index_statuses_public_20200119, algorithm: :concurrently, order: { id: :desc }, where: 'deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))'
remove_index :statuses, name: :index_statuses_local_20231213
remove_index :statuses, name: :index_statuses_public_20231213
add_index :statuses, [:id, :account_id], name: :index_statuses_local_20190824, algorithm: :concurrently, order: { id: :desc }, where: '(local OR (uri IS NULL)) AND deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))' # rubocop:disable Naming/VariableNumber
add_index :statuses, [:id, :account_id], name: :index_statuses_public_20200119, algorithm: :concurrently, order: { id: :desc }, where: 'deleted_at IS NULL AND visibility = 0 AND reblog_of_id IS NULL AND ((NOT reply) OR (in_reply_to_account_id = account_id))' # rubocop:disable Naming/VariableNumber
remove_index :statuses, name: :index_statuses_local_20231213 # rubocop:disable Naming/VariableNumber
remove_index :statuses, name: :index_statuses_public_20231213 # rubocop:disable Naming/VariableNumber
end
end