Reflect "requested" relationship in API and UI Reflect inability of private posts to be reblogged in the UI Disable Webfinger for locked accountsmaster
parent
2d2154ba75
commit
b891a81008
@ -0,0 +1,19 @@ |
|||||||
|
# frozen_string_literal: true |
||||||
|
|
||||||
|
class FollowRequest < ApplicationRecord |
||||||
|
belongs_to :account |
||||||
|
belongs_to :target_account, class_name: 'Account' |
||||||
|
|
||||||
|
validates :account, :target_account, presence: true |
||||||
|
validates :account_id, uniqueness: { scope: :target_account_id } |
||||||
|
|
||||||
|
def authorize! |
||||||
|
account.follow!(target_account) |
||||||
|
FeedManager.instance.merge_into_timeline(target_account, account) |
||||||
|
destroy! |
||||||
|
end |
||||||
|
|
||||||
|
def reject! |
||||||
|
destroy! |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,12 @@ |
|||||||
|
class CreateFollowRequests < ActiveRecord::Migration[5.0] |
||||||
|
def change |
||||||
|
create_table :follow_requests do |t| |
||||||
|
t.integer :account_id, null: false |
||||||
|
t.integer :target_account_id, null: false |
||||||
|
|
||||||
|
t.timestamps null: false |
||||||
|
end |
||||||
|
|
||||||
|
add_index :follow_requests, [:account_id, :target_account_id], unique: true |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,3 @@ |
|||||||
|
Fabricator(:follow_request) do |
||||||
|
|
||||||
|
end |
@ -0,0 +1,6 @@ |
|||||||
|
require 'rails_helper' |
||||||
|
|
||||||
|
RSpec.describe FollowRequest, type: :model do |
||||||
|
describe '#authorize!' |
||||||
|
describe '#reject!' |
||||||
|
end |
Loading…
Reference in new issue