Add: #95 リストへの新着投稿通知 (#192)

* Add: テーブル定義、内部処理

* Add: 通知の定期削除処理、自動削除、テスト

* Add: Web画面の表示、設定

* Fix test
This commit is contained in:
KMY(雪あすか) 2023-10-31 08:59:31 +09:00 committed by GitHub
parent 2cc60253c4
commit f8280ca5d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 300 additions and 9 deletions

View file

@ -0,0 +1,22 @@
# frozen_string_literal: true
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
class CreateListStatuses < ActiveRecord::Migration[7.1]
include Mastodon::MigrationHelpers
disable_ddl_transaction!
def change
safety_assured do
create_table :list_statuses do |t|
t.belongs_to :list, null: false, foreign_key: { on_delete: :cascade }
t.belongs_to :status, null: false, foreign_key: { on_delete: :cascade }
t.datetime :created_at, null: false
t.datetime :updated_at, null: false
end
add_index :list_statuses, [:list_id, :status_id], unique: true
end
end
end

View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
class AddNotifyToList < ActiveRecord::Migration[7.0]
include Mastodon::MigrationHelpers
disable_ddl_transaction!
def change
safety_assured do
add_column_with_default :lists, :notify, :boolean, default: false, allow_null: false
end
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_10_23_083359) do
ActiveRecord::Schema[7.1].define(version: 2023_10_28_005948) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -761,6 +761,16 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_23_083359) do
t.index ["list_id", "account_id"], name: "index_list_accounts_on_list_id_and_account_id"
end
create_table "list_statuses", force: :cascade do |t|
t.bigint "list_id", null: false
t.bigint "status_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["list_id", "status_id"], name: "index_list_statuses_on_list_id_and_status_id", unique: true
t.index ["list_id"], name: "index_list_statuses_on_list_id"
t.index ["status_id"], name: "index_list_statuses_on_status_id"
end
create_table "lists", force: :cascade do |t|
t.bigint "account_id", null: false
t.string "title", default: "", null: false
@ -768,6 +778,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_23_083359) do
t.datetime "updated_at", precision: nil, null: false
t.integer "replies_policy", default: 0, null: false
t.boolean "exclusive", default: false, null: false
t.boolean "notify", default: false, null: false
t.index ["account_id"], name: "index_lists_on_account_id"
end
@ -1480,6 +1491,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_23_083359) do
add_foreign_key "list_accounts", "follow_requests", on_delete: :cascade
add_foreign_key "list_accounts", "follows", on_delete: :cascade
add_foreign_key "list_accounts", "lists", on_delete: :cascade
add_foreign_key "list_statuses", "lists", on_delete: :cascade
add_foreign_key "list_statuses", "statuses", on_delete: :cascade
add_foreign_key "lists", "accounts", on_delete: :cascade
add_foreign_key "login_activities", "users", on_delete: :cascade
add_foreign_key "markers", "users", on_delete: :cascade