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.

41 lines
553 B

  1. # frozen_string_literal: true
  2. module Streamable
  3. extend ActiveSupport::Concern
  4. included do
  5. has_one :stream_entry, as: :activity
  6. def title
  7. super
  8. end
  9. def content
  10. title
  11. end
  12. def target
  13. super
  14. end
  15. def object_type
  16. :activity
  17. end
  18. def thread
  19. super
  20. end
  21. def hidden?
  22. false
  23. end
  24. def needs_stream_entry?
  25. account.local?
  26. end
  27. after_create do
  28. account.stream_entries.create!(activity: self, hidden: hidden?) if needs_stream_entry?
  29. end
  30. end
  31. end