about summary refs log tree commit diff
path: root/app/lib/activitypub
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-01-02 20:03:32 +0100
committerGitHub <noreply@github.com>2019-01-02 20:03:32 +0100
commit0acd51acdc1e670bf57f58671cb8e30743782c63 (patch)
treef5ff0b5c3b1e8fd94691264f2bc147e5fa233ecb /app/lib/activitypub
parentb300948526d967aaf5608c93546ee0d54940c0ef (diff)
parente77ceb1b29547ed89b4110b3cc3edc9ac325b620 (diff)
Merge pull request #878 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/lib/activitypub')
-rw-r--r--app/lib/activitypub/activity/block.rb5
-rw-r--r--app/lib/activitypub/activity/create.rb2
-rw-r--r--app/lib/activitypub/activity/flag.rb2
-rw-r--r--app/lib/activitypub/activity/follow.rb2
4 files changed, 5 insertions, 6 deletions
diff --git a/app/lib/activitypub/activity/block.rb b/app/lib/activitypub/activity/block.rb
index 26da8bdf5..a17a2d50a 100644
--- a/app/lib/activitypub/activity/block.rb
+++ b/app/lib/activitypub/activity/block.rb
@@ -4,9 +4,10 @@ class ActivityPub::Activity::Block < ActivityPub::Activity
   def perform
     target_account = account_from_uri(object_uri)
 
-    return if target_account.nil? || !target_account.local? || delete_arrived_first?(@json['id']) || @account.blocking?(target_account)
+    return if target_account.nil? || !target_account.local? || @account.blocking?(target_account)
 
     UnfollowService.new.call(target_account, @account) if target_account.following?(@account)
-    @account.block!(target_account, uri: @json['id'])
+
+    @account.block!(target_account, uri: @json['id']) unless delete_arrived_first?(@json['id'])
   end
 end
diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb
index 9d2ddd3f6..2b238bc88 100644
--- a/app/lib/activitypub/activity/create.rb
+++ b/app/lib/activitypub/activity/create.rb
@@ -210,7 +210,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
   end
 
   def resolve_thread(status)
-    return unless status.reply? && status.thread.nil?
+    return unless status.reply? && status.thread.nil? && Request.valid_url?(in_reply_to_uri)
     ThreadResolveWorker.perform_async(status.id, in_reply_to_uri)
   end
 
diff --git a/app/lib/activitypub/activity/flag.rb b/app/lib/activitypub/activity/flag.rb
index 92e59bb81..0d10d6c3c 100644
--- a/app/lib/activitypub/activity/flag.rb
+++ b/app/lib/activitypub/activity/flag.rb
@@ -8,8 +8,6 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity
     target_statuses_by_account = object_uris.map { |uri| status_from_uri(uri) }.compact.select(&:local?).group_by(&:account_id)
 
     target_accounts.each do |target_account|
-      next if Report.where(account: @account, target_account: target_account).exists?
-
       target_statuses = target_statuses_by_account[target_account.id]
 
       ReportService.new.call(
diff --git a/app/lib/activitypub/activity/follow.rb b/app/lib/activitypub/activity/follow.rb
index c45832648..5e703dc61 100644
--- a/app/lib/activitypub/activity/follow.rb
+++ b/app/lib/activitypub/activity/follow.rb
@@ -28,7 +28,7 @@ class ActivityPub::Activity::Follow < ActivityPub::Activity
   end
 
   def reject_follow_request!(target_account)
-    json = Oj.dump(ActivityPub::LinkedDataSignature.new(ActiveModelSerializers::SerializableResource.new(FollowRequest.new(account: @account, target_account: target_account, uri: @json['id']), serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).as_json).sign!(target_account))
+    json = ActiveModelSerializers::SerializableResource.new(FollowRequest.new(account: @account, target_account: target_account, uri: @json['id']), serializer: ActivityPub::RejectFollowSerializer, adapter: ActivityPub::Adapter).to_json
     ActivityPub::DeliveryWorker.perform_async(json, target_account.id, @account.inbox_url)
   end
 end