logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

share.rb (636B)


  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