Add REST API for managing and posting to circles
Circles are the conceptual opposite of lists. A list is a subdivision of your follows, a circle is a subdivision of your followers. Posting to a circle means making content available to only some of your followers. Circles have been internally supported in Mastodon for the purposes of federation since #8950, this adds the REST API necessary for making use of them in Mastodon itsef.
This commit is contained in:
parent
a29080256e
commit
6358072bc0
19 changed files with 353 additions and 4 deletions
10
db/migrate/20200718225713_create_circles.rb
Normal file
10
db/migrate/20200718225713_create_circles.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateCircles < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :circles do |t|
|
||||
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
|
||||
t.string :title, default: '', null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
14
db/migrate/20200718225817_create_circle_accounts.rb
Normal file
14
db/migrate/20200718225817_create_circle_accounts.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class CreateCircleAccounts < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :circle_accounts do |t|
|
||||
t.belongs_to :circle, foreign_key: { on_delete: :cascade }, null: false
|
||||
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false
|
||||
t.belongs_to :follow, foreign_key: { on_delete: :cascade }, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :circle_accounts, [:account_id, :circle_id], unique: true
|
||||
add_index :circle_accounts, [:circle_id, :account_id]
|
||||
end
|
||||
end
|
27
db/schema.rb
27
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2020_06_28_133322) do
|
||||
ActiveRecord::Schema.define(version: 2020_07_18_225817) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -272,6 +272,27 @@ ActiveRecord::Schema.define(version: 2020_06_28_133322) do
|
|||
t.index ["status_id"], name: "index_bookmarks_on_status_id"
|
||||
end
|
||||
|
||||
create_table "circle_accounts", force: :cascade do |t|
|
||||
t.bigint "circle_id", null: false
|
||||
t.bigint "account_id", null: false
|
||||
t.bigint "follow_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id", "circle_id"], name: "index_circle_accounts_on_account_id_and_circle_id", unique: true
|
||||
t.index ["account_id"], name: "index_circle_accounts_on_account_id"
|
||||
t.index ["circle_id", "account_id"], name: "index_circle_accounts_on_circle_id_and_account_id"
|
||||
t.index ["circle_id"], name: "index_circle_accounts_on_circle_id"
|
||||
t.index ["follow_id"], name: "index_circle_accounts_on_follow_id"
|
||||
end
|
||||
|
||||
create_table "circles", force: :cascade do |t|
|
||||
t.bigint "account_id", null: false
|
||||
t.string "title", default: "", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id"], name: "index_circles_on_account_id"
|
||||
end
|
||||
|
||||
create_table "conversation_mutes", force: :cascade do |t|
|
||||
t.bigint "conversation_id", null: false
|
||||
t.bigint "account_id", null: false
|
||||
|
@ -938,6 +959,10 @@ ActiveRecord::Schema.define(version: 2020_06_28_133322) do
|
|||
add_foreign_key "blocks", "accounts", name: "fk_4269e03e65", on_delete: :cascade
|
||||
add_foreign_key "bookmarks", "accounts", on_delete: :cascade
|
||||
add_foreign_key "bookmarks", "statuses", on_delete: :cascade
|
||||
add_foreign_key "circle_accounts", "accounts", on_delete: :cascade
|
||||
add_foreign_key "circle_accounts", "circles", on_delete: :cascade
|
||||
add_foreign_key "circle_accounts", "follows", on_delete: :cascade
|
||||
add_foreign_key "circles", "accounts", on_delete: :cascade
|
||||
add_foreign_key "conversation_mutes", "accounts", name: "fk_225b4212bb", on_delete: :cascade
|
||||
add_foreign_key "conversation_mutes", "conversations", on_delete: :cascade
|
||||
add_foreign_key "custom_filters", "accounts", on_delete: :cascade
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue