Merge branch 'master' into glitch-soc/merge-upstream

Conflicts:
- Gemfile
- Gemfile.lock
- app/controllers/about_controller.rb
- app/controllers/auth/sessions_controller.rb
This commit is contained in:
Thibaut Girka
2019-09-30 12:23:57 +02:00
352 changed files with 7151 additions and 2269 deletions

View File

@ -3,7 +3,7 @@ class AddInReplyToAccountIdToStatuses < ActiveRecord::Migration[5.0]
add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil
ActiveRecord::Base.transaction do
Status.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
Status.unscoped.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
next if status.thread.nil?
status.in_reply_to_account_id = status.thread.account_id

View File

@ -1,7 +1,7 @@
class AddReplyToStatuses < ActiveRecord::Migration[5.0]
def up
add_column :statuses, :reply, :boolean, nil: false, default: false
Status.update_all('reply = (in_reply_to_id IS NOT NULL)')
Status.unscoped.update_all('reply = (in_reply_to_id IS NOT NULL)')
end
def down

View File

@ -0,0 +1,12 @@
class CreateAccountMigrations < ActiveRecord::Migration[5.2]
def change
create_table :account_migrations do |t|
t.belongs_to :account, foreign_key: { on_delete: :cascade }
t.string :acct, null: false, default: ''
t.bigint :followers_count, null: false, default: 0
t.belongs_to :target_account, foreign_key: { to_table: :accounts, on_delete: :nullify }
t.timestamps
end
end
end

View File

@ -0,0 +1,11 @@
class CreateAccountAliases < ActiveRecord::Migration[5.2]
def change
create_table :account_aliases do |t|
t.belongs_to :account, foreign_key: { on_delete: :cascade }
t.string :acct, null: false, default: ''
t.string :uri, null: false, default: ''
t.timestamps
end
end
end

View File

@ -0,0 +1,5 @@
class AddVotersCountToPolls < ActiveRecord::Migration[5.2]
def change
add_column :polls, :voters_count, :bigint
end
end

View File

@ -0,0 +1,18 @@
# frozen_string_literal: true
class RemoveInvalidWebPushSubscription < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def up
invalid_web_push_subscriptions = Web::PushSubscription.where(endpoint: '')
.or(Web::PushSubscription.where(key_p256dh: ''))
.or(Web::PushSubscription.where(key_auth: ''))
.preload(:session_activation)
invalid_web_push_subscriptions.find_each do |web_push_subscription|
web_push_subscription.session_activation&.update!(web_push_subscription_id: nil)
web_push_subscription.destroy!
end
end
def down; end
end

View File

@ -10,11 +10,20 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_09_17_213523) do
ActiveRecord::Schema.define(version: 2019_09_27_232842) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "account_aliases", force: :cascade do |t|
t.bigint "account_id"
t.string "acct", default: "", null: false
t.string "uri", default: "", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["account_id"], name: "index_account_aliases_on_account_id"
end
create_table "account_conversations", force: :cascade do |t|
t.bigint "account_id"
t.bigint "conversation_id"
@ -49,6 +58,17 @@ ActiveRecord::Schema.define(version: 2019_09_17_213523) do
t.index ["account_id"], name: "index_account_identity_proofs_on_account_id"
end
create_table "account_migrations", force: :cascade do |t|
t.bigint "account_id"
t.string "acct", default: "", null: false
t.bigint "followers_count", default: 0, null: false
t.bigint "target_account_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["account_id"], name: "index_account_migrations_on_account_id"
t.index ["target_account_id"], name: "index_account_migrations_on_target_account_id"
end
create_table "account_moderation_notes", force: :cascade do |t|
t.text "content", null: false
t.bigint "account_id", null: false
@ -520,6 +540,7 @@ ActiveRecord::Schema.define(version: 2019_09_17_213523) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "lock_version", default: 0, null: false
t.bigint "voters_count"
t.index ["account_id"], name: "index_polls_on_account_id"
t.index ["status_id"], name: "index_polls_on_status_id"
end
@ -781,10 +802,13 @@ ActiveRecord::Schema.define(version: 2019_09_17_213523) do
t.index ["user_id"], name: "index_web_settings_on_user_id", unique: true
end
add_foreign_key "account_aliases", "accounts", on_delete: :cascade
add_foreign_key "account_conversations", "accounts", on_delete: :cascade
add_foreign_key "account_conversations", "conversations", on_delete: :cascade
add_foreign_key "account_domain_blocks", "accounts", name: "fk_206c6029bd", on_delete: :cascade
add_foreign_key "account_identity_proofs", "accounts", on_delete: :cascade
add_foreign_key "account_migrations", "accounts", column: "target_account_id", on_delete: :nullify
add_foreign_key "account_migrations", "accounts", on_delete: :cascade
add_foreign_key "account_moderation_notes", "accounts"
add_foreign_key "account_moderation_notes", "accounts", column: "target_account_id"
add_foreign_key "account_pins", "accounts", column: "target_account_id", on_delete: :cascade