Add conversation-based forwarding for limited visibility statuses through bearcaps

This commit is contained in:
Eugen Rochko 2020-08-26 03:16:47 +02:00
parent 52157fdcba
commit 7cd4ed7d42
26 changed files with 430 additions and 78 deletions

View file

@ -0,0 +1,10 @@
class CreateStatusCapabilityTokens < ActiveRecord::Migration[5.2]
def change
create_table :status_capability_tokens do |t|
t.belongs_to :status, foreign_key: true
t.string :token
t.timestamps
end
end
end

View file

@ -0,0 +1,7 @@
class AddInboxUrlToConversations < ActiveRecord::Migration[5.2]
def change
add_column :conversations, :parent_status_id, :bigint, null: true, default: nil
add_column :conversations, :parent_account_id, :bigint, null: true, default: nil
add_column :conversations, :inbox_url, :string, null: true, default: nil
end
end

View file

@ -0,0 +1,15 @@
class ConversationIdsToTimestampIds < ActiveRecord::Migration[5.2]
def up
safety_assured do
execute("ALTER TABLE conversations ALTER COLUMN id SET DEFAULT timestamp_id('conversations')")
end
Mastodon::Snowflake.ensure_id_sequences_exist
end
def down
execute("LOCK conversations")
execute("SELECT setval('conversations_id_seq', (SELECT MAX(id) FROM conversations))")
execute("ALTER TABLE conversations ALTER COLUMN id SET DEFAULT nextval('conversations_id_seq')")
end
end