闭社主体 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.

26 lines
435 B

  1. class Favourite < ApplicationRecord
  2. include Streamable
  3. belongs_to :account, inverse_of: :favourites
  4. belongs_to :status, inverse_of: :favourites
  5. validates :status_id, uniqueness: { scope: :account_id }
  6. def verb
  7. :favorite
  8. end
  9. def title
  10. "#{account.acct} favourited a status by #{status.account.acct}"
  11. end
  12. delegate :object_type, to: :target
  13. def thread
  14. status
  15. end
  16. def target
  17. thread
  18. end
  19. end