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.

31 lines
560 B

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