From 6c374b51537126a2cba29f3eaf74faf1fc64ba96 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Mon, 6 May 2019 20:51:20 -0500 Subject: Drop OStatus support. Fix some of the Rspec tests. --- app/models/account.rb | 4 --- app/models/form/account_batch.rb | 2 -- app/models/remote_profile.rb | 57 ---------------------------------------- 3 files changed, 63 deletions(-) delete mode 100644 app/models/remote_profile.rb (limited to 'app/models') diff --git a/app/models/account.rb b/app/models/account.rb index dd644ea37..50033d1c3 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -321,10 +321,6 @@ class Account < ApplicationRecord (['RSA'] + [modulus, exponent].map { |n| Base64.urlsafe_encode64(n) }).join('.') end - def subscription(webhook_url) - @subscription ||= OStatus2::Subscription.new(remote_url, secret: secret, webhook: webhook_url, hub: hub_url) - end - def save_with_optional_media! save! rescue ActiveRecord::RecordInvalid diff --git a/app/models/form/account_batch.rb b/app/models/form/account_batch.rb index 5bc44e809..eed65b47a 100644 --- a/app/models/form/account_batch.rb +++ b/app/models/form/account_batch.rb @@ -52,8 +52,6 @@ class Form::AccountBatch def reject_follow!(follow) follow.destroy - return unless follow.account.activitypub? - json = ActiveModelSerializers::SerializableResource.new( follow, serializer: ActivityPub::RejectFollowSerializer, diff --git a/app/models/remote_profile.rb b/app/models/remote_profile.rb deleted file mode 100644 index 742d2b56f..000000000 --- a/app/models/remote_profile.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -class RemoteProfile - include ActiveModel::Model - - attr_reader :document - - def initialize(body) - @document = Nokogiri::XML.parse(body, nil, 'utf-8') - end - - def root - @root ||= document.at_xpath('/atom:feed|/atom:entry', atom: OStatus::TagManager::XMLNS) - end - - def author - @author ||= root.at_xpath('./atom:author|./dfrn:owner', atom: OStatus::TagManager::XMLNS, dfrn: OStatus::TagManager::DFRN_XMLNS) - end - - def hub_link - @hub_link ||= link_href_from_xml(root, 'hub') - end - - def display_name - @display_name ||= author.at_xpath('./poco:displayName', poco: OStatus::TagManager::POCO_XMLNS)&.content - end - - def note - @note ||= author.at_xpath('./atom:summary|./poco:note', atom: OStatus::TagManager::XMLNS, poco: OStatus::TagManager::POCO_XMLNS)&.content - end - - def scope - @scope ||= author.at_xpath('./mastodon:scope', mastodon: OStatus::TagManager::MTDN_XMLNS)&.content - end - - def avatar - @avatar ||= link_href_from_xml(author, 'avatar') - end - - def header - @header ||= link_href_from_xml(author, 'header') - end - - def emojis - @emojis ||= author.xpath('./xmlns:link[@rel="emoji"]', xmlns: OStatus::TagManager::XMLNS) - end - - def locked? - scope == 'private' - end - - private - - def link_href_from_xml(xml, type) - xml.at_xpath(%(./atom:link[@rel="#{type}"]/@href), atom: OStatus::TagManager::XMLNS)&.content - end -end -- cgit