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

43 lines
522 B

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