闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
500 B

  1. # frozen_string_literal: true
  2. class FollowRequest < ApplicationRecord
  3. include Paginable
  4. belongs_to :account, required: true
  5. belongs_to :target_account, class_name: 'Account', required: true
  6. has_one :notification, as: :activity, dependent: :destroy
  7. validates :account_id, uniqueness: { scope: :target_account_id }
  8. def authorize!
  9. account.follow!(target_account)
  10. MergeWorker.perform_async(target_account.id, account.id)
  11. destroy!
  12. end
  13. def reject!
  14. destroy!
  15. end
  16. end