about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2017-07-20 11:24:32 -0400
committerGitHub <noreply@github.com>2017-07-20 11:24:32 -0400
commite7edb4d1eeba6c12a1c71271faa30d2bbf00d054 (patch)
treef373d05c4ea43bd335910f3603fab3d866a2486e /app/lib
parentd2352246920800e491466d84b0146feb4d1d791f (diff)
parent1fcdaafa6fbe6d746a096c33263d76e6819da46d (diff)
Merge pull request #87 from tootsuite/master
merge upstream
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/exceptions.rb10
-rw-r--r--app/lib/ostatus/activity/base.rb2
-rw-r--r--app/lib/ostatus/activity/creation.rb2
-rw-r--r--app/lib/ostatus/activity/deletion.rb2
-rw-r--r--app/lib/ostatus/activity/general.rb8
-rw-r--r--app/lib/ostatus/activity/post.rb2
-rw-r--r--app/lib/ostatus/activity/remote.rb2
-rw-r--r--app/lib/ostatus/activity/share.rb4
-rw-r--r--app/lib/ostatus/atom_serializer.rb2
9 files changed, 22 insertions, 12 deletions
diff --git a/app/lib/exceptions.rb b/app/lib/exceptions.rb
index 9bc802c12..34d84a34f 100644
--- a/app/lib/exceptions.rb
+++ b/app/lib/exceptions.rb
@@ -5,4 +5,14 @@ module Mastodon
   class NotPermittedError < Error; end
   class ValidationError < Error; end
   class RaceConditionError < Error; end
+
+  class UnexpectedResponseError < Error
+    def initialize(response = nil)
+      @response = response
+    end
+
+    def to_s
+      "#{@response.uri} returned code #{@response.code}"
+    end
+  end
 end
diff --git a/app/lib/ostatus/activity/base.rb b/app/lib/ostatus/activity/base.rb
index f528815b3..e1477f0eb 100644
--- a/app/lib/ostatus/activity/base.rb
+++ b/app/lib/ostatus/activity/base.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::Activity::Base
+class OStatus::Activity::Base
   def initialize(xml, account = nil)
     @xml = xml
     @account = account
diff --git a/app/lib/ostatus/activity/creation.rb b/app/lib/ostatus/activity/creation.rb
index c54d64fd7..e22f746f2 100644
--- a/app/lib/ostatus/activity/creation.rb
+++ b/app/lib/ostatus/activity/creation.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::Activity::Creation < Ostatus::Activity::Base
+class OStatus::Activity::Creation < OStatus::Activity::Base
   def perform
     if redis.exists("delete_upon_arrival:#{@account.id}:#{id}")
       Rails.logger.debug "Delete for status #{id} was queued, ignoring"
diff --git a/app/lib/ostatus/activity/deletion.rb b/app/lib/ostatus/activity/deletion.rb
index c4d05a467..860faf501 100644
--- a/app/lib/ostatus/activity/deletion.rb
+++ b/app/lib/ostatus/activity/deletion.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::Activity::Deletion < Ostatus::Activity::Base
+class OStatus::Activity::Deletion < OStatus::Activity::Base
   def perform
     Rails.logger.debug "Deleting remote status #{id}"
     status = Status.find_by(uri: id, account: @account)
diff --git a/app/lib/ostatus/activity/general.rb b/app/lib/ostatus/activity/general.rb
index 3ff7a039a..b3bef9861 100644
--- a/app/lib/ostatus/activity/general.rb
+++ b/app/lib/ostatus/activity/general.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::Activity::General < Ostatus::Activity::Base
+class OStatus::Activity::General < OStatus::Activity::Base
   def specialize
     special_class&.new(@xml, @account)
   end
@@ -10,11 +10,11 @@ class Ostatus::Activity::General < Ostatus::Activity::Base
   def special_class
     case verb
     when :post
-      Ostatus::Activity::Post
+      OStatus::Activity::Post
     when :share
-      Ostatus::Activity::Share
+      OStatus::Activity::Share
     when :delete
-      Ostatus::Activity::Deletion
+      OStatus::Activity::Deletion
     end
   end
 end
diff --git a/app/lib/ostatus/activity/post.rb b/app/lib/ostatus/activity/post.rb
index 8028db2f8..755ed8656 100644
--- a/app/lib/ostatus/activity/post.rb
+++ b/app/lib/ostatus/activity/post.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::Activity::Post < Ostatus::Activity::Creation
+class OStatus::Activity::Post < OStatus::Activity::Creation
   def perform
     status, just_created = super
 
diff --git a/app/lib/ostatus/activity/remote.rb b/app/lib/ostatus/activity/remote.rb
index 755f885e6..ecec6886c 100644
--- a/app/lib/ostatus/activity/remote.rb
+++ b/app/lib/ostatus/activity/remote.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::Activity::Remote < Ostatus::Activity::Base
+class OStatus::Activity::Remote < OStatus::Activity::Base
   def perform
     find_status(id) || FetchRemoteStatusService.new.call(url)
   end
diff --git a/app/lib/ostatus/activity/share.rb b/app/lib/ostatus/activity/share.rb
index 73aac58ed..290008021 100644
--- a/app/lib/ostatus/activity/share.rb
+++ b/app/lib/ostatus/activity/share.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::Activity::Share < Ostatus::Activity::Creation
+class OStatus::Activity::Share < OStatus::Activity::Creation
   def perform
     return if reblog.nil?
 
@@ -18,7 +18,7 @@ class Ostatus::Activity::Share < Ostatus::Activity::Creation
   def 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?
 
     @reblog = original_status.reblog? ? original_status.reblog : original_status
diff --git a/app/lib/ostatus/atom_serializer.rb b/app/lib/ostatus/atom_serializer.rb
index 909d84df3..0d62361be 100644
--- a/app/lib/ostatus/atom_serializer.rb
+++ b/app/lib/ostatus/atom_serializer.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-class Ostatus::AtomSerializer
+class OStatus::AtomSerializer
   include RoutingHelper
   include ActionView::Helpers::SanitizeHelper