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

  1. # frozen_string_literal: true
  2. class OStatus::Activity::Share < OStatus::Activity::Creation
  3. def perform
  4. return if reblog.nil?
  5. status, just_created = super
  6. NotifyService.new.call(reblog.account, status) if reblog.account.local? && just_created
  7. status
  8. end
  9. def object
  10. @xml.at_xpath('.//activity:object', activity: OStatus::TagManager::AS_XMLNS)
  11. end
  12. private
  13. def reblog
  14. return @reblog if defined? @reblog
  15. original_status = OStatus::Activity::Remote.new(object).perform
  16. return if original_status.nil?
  17. @reblog = original_status.reblog? ? original_status.reblog : original_status
  18. end
  19. end