Correct OStatus inflection (Ostatus -> OStatus) (#4255)

th-downstream
Eugen Rochko 7 years ago committed by GitHub
parent fa9c117921
commit 3852032953

@ -13,7 +13,7 @@ class AccountsController < ApplicationController
format.atom do format.atom do
@entries = @account.stream_entries.where(hidden: false).with_includes.paginate_by_max_id(20, params[:max_id], params[:since_id]) @entries = @account.stream_entries.where(hidden: false).with_includes.paginate_by_max_id(20, params[:max_id], params[:since_id])
render xml: Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.feed(@account, @entries.to_a)) render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, @entries.to_a))
end end
format.json do format.json do

@ -19,7 +19,7 @@ class StreamEntriesController < ApplicationController
end end
format.atom do format.atom do
render xml: Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.entry(@stream_entry, true)) render xml: OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.entry(@stream_entry, true))
end end
end end
end end

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::Activity::Base class OStatus::Activity::Base
def initialize(xml, account = nil) def initialize(xml, account = nil)
@xml = xml @xml = xml
@account = account @account = account

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::Activity::Creation < Ostatus::Activity::Base class OStatus::Activity::Creation < OStatus::Activity::Base
def perform def perform
if redis.exists("delete_upon_arrival:#{@account.id}:#{id}") if redis.exists("delete_upon_arrival:#{@account.id}:#{id}")
Rails.logger.debug "Delete for status #{id} was queued, ignoring" Rails.logger.debug "Delete for status #{id} was queued, ignoring"

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::Activity::Deletion < Ostatus::Activity::Base class OStatus::Activity::Deletion < OStatus::Activity::Base
def perform def perform
Rails.logger.debug "Deleting remote status #{id}" Rails.logger.debug "Deleting remote status #{id}"
status = Status.find_by(uri: id, account: @account) status = Status.find_by(uri: id, account: @account)

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::Activity::General < Ostatus::Activity::Base class OStatus::Activity::General < OStatus::Activity::Base
def specialize def specialize
special_class&.new(@xml, @account) special_class&.new(@xml, @account)
end end
@ -10,11 +10,11 @@ class Ostatus::Activity::General < Ostatus::Activity::Base
def special_class def special_class
case verb case verb
when :post when :post
Ostatus::Activity::Post OStatus::Activity::Post
when :share when :share
Ostatus::Activity::Share OStatus::Activity::Share
when :delete when :delete
Ostatus::Activity::Deletion OStatus::Activity::Deletion
end end
end end
end end

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::Activity::Post < Ostatus::Activity::Creation class OStatus::Activity::Post < OStatus::Activity::Creation
def perform def perform
status, just_created = super status, just_created = super

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::Activity::Remote < Ostatus::Activity::Base class OStatus::Activity::Remote < OStatus::Activity::Base
def perform def perform
find_status(id) || FetchRemoteStatusService.new.call(url) find_status(id) || FetchRemoteStatusService.new.call(url)
end end

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::Activity::Share < Ostatus::Activity::Creation class OStatus::Activity::Share < OStatus::Activity::Creation
def perform def perform
return if reblog.nil? return if reblog.nil?
@ -18,7 +18,7 @@ class Ostatus::Activity::Share < Ostatus::Activity::Creation
def reblog def reblog
return @reblog if defined? @reblog return @reblog if defined? @reblog
original_status = Ostatus::Activity::Remote.new(object).perform original_status = OStatus::Activity::Remote.new(object).perform
return if original_status.nil? return if original_status.nil?
@reblog = original_status.reblog? ? original_status.reblog : original_status @reblog = original_status.reblog? ? original_status.reblog : original_status

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class Ostatus::AtomSerializer class OStatus::AtomSerializer
include RoutingHelper include RoutingHelper
include ActionView::Helpers::SanitizeHelper include ActionView::Helpers::SanitizeHelper

@ -10,6 +10,6 @@ class AuthorizeFollowService < BaseService
private private
def build_xml(follow_request) def build_xml(follow_request)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.authorize_follow_request_salmon(follow_request)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.authorize_follow_request_salmon(follow_request))
end end
end end

@ -18,6 +18,6 @@ class BlockService < BaseService
private private
def build_xml(block) def build_xml(block)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.block_salmon(block)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.block_salmon(block))
end end
end end

@ -2,6 +2,6 @@
module StreamEntryRenderer module StreamEntryRenderer
def stream_entry_to_xml(stream_entry) def stream_entry_to_xml(stream_entry)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.entry(stream_entry, true)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.entry(stream_entry, true))
end end
end end

@ -28,6 +28,6 @@ class FavouriteService < BaseService
private private
def build_xml(favourite) def build_xml(favourite)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.favourite_salmon(favourite)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.favourite_salmon(favourite))
end end
end end

@ -57,10 +57,10 @@ class FollowService < BaseService
end end
def build_follow_request_xml(follow_request) def build_follow_request_xml(follow_request)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.follow_request_salmon(follow_request)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.follow_request_salmon(follow_request))
end end
def build_follow_xml(follow) def build_follow_xml(follow)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.follow_salmon(follow)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.follow_salmon(follow))
end end
end end

@ -20,7 +20,7 @@ class ProcessFeedService < BaseService
end end
def process_entry(xml, account) def process_entry(xml, account)
activity = Ostatus::Activity::General.new(xml, account) activity = OStatus::Activity::General.new(xml, account)
activity.specialize&.perform if activity.status? activity.specialize&.perform if activity.status?
rescue ActiveRecord::RecordInvalid => e rescue ActiveRecord::RecordInvalid => e
Rails.logger.debug "Nothing was saved for #{id} because: #{e}" Rails.logger.debug "Nothing was saved for #{id} because: #{e}"

@ -10,6 +10,6 @@ class RejectFollowService < BaseService
private private
def build_xml(follow_request) def build_xml(follow_request)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.reject_follow_request_salmon(follow_request)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.reject_follow_request_salmon(follow_request))
end end
end end

@ -11,6 +11,6 @@ class UnblockService < BaseService
private private
def build_xml(block) def build_xml(block)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.unblock_salmon(block)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.unblock_salmon(block))
end end
end end

@ -13,6 +13,6 @@ class UnfavouriteService < BaseService
private private
def build_xml(favourite) def build_xml(favourite)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.unfavourite_salmon(favourite)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.unfavourite_salmon(favourite))
end end
end end

@ -14,6 +14,6 @@ class UnfollowService < BaseService
private private
def build_xml(follow) def build_xml(follow)
Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.unfollow_salmon(follow)) OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.unfollow_salmon(follow))
end end
end end

@ -22,7 +22,7 @@ class Pubsubhubbub::DistributionWorker
def distribute_public!(stream_entries) def distribute_public!(stream_entries)
return if stream_entries.empty? return if stream_entries.empty?
@payload = Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.feed(@account, stream_entries)) @payload = OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, stream_entries))
Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions) do |subscription| Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions) do |subscription|
[subscription.id, @payload] [subscription.id, @payload]
@ -32,7 +32,7 @@ class Pubsubhubbub::DistributionWorker
def distribute_hidden!(stream_entries) def distribute_hidden!(stream_entries)
return if stream_entries.empty? return if stream_entries.empty?
@payload = Ostatus::AtomSerializer.render(Ostatus::AtomSerializer.new.feed(@account, stream_entries)) @payload = OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, stream_entries))
@domains = @account.followers.domains @domains = @account.followers.domains
Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions.reject { |s| !allowed_to_receive?(s.callback_url, s.domain) }) do |subscription| Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions.reject { |s| !allowed_to_receive?(s.callback_url, s.domain) }) do |subscription|

@ -13,6 +13,7 @@
ActiveSupport::Inflector.inflections(:en) do |inflect| ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym 'StatsD' inflect.acronym 'StatsD'
inflect.acronym 'OEmbed' inflect.acronym 'OEmbed'
inflect.acronym 'OStatus'
inflect.acronym 'ActivityPub' inflect.acronym 'ActivityPub'
inflect.acronym 'PubSubHubbub' inflect.acronym 'PubSubHubbub'
inflect.acronym 'ActivityStreams' inflect.acronym 'ActivityStreams'

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save