]> cat aescling's git repositories - mastodon.git/commitdiff
Fix wrong param name in scheduled statuses and return params in API (#9725)
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 6 Jan 2019 11:03:27 +0000 (12:03 +0100)
committerGitHub <noreply@github.com>
Sun, 6 Jan 2019 11:03:27 +0000 (12:03 +0100)
The database column and API param are called in_reply_to_id, not
in_reply_to_status_id, so it makes no sense to encode it that way

app/serializers/rest/scheduled_status_serializer.rb
app/services/post_status_service.rb
app/workers/publish_scheduled_status_worker.rb

index 522991bcfc79c93004d920d42927c1471ed0901e..5d6311b872156310a50a9c888607b1b8aad99747 100644 (file)
@@ -1,11 +1,15 @@
 # frozen_string_literal: true
 
 class REST::ScheduledStatusSerializer < ActiveModel::Serializer
-  attributes :id, :scheduled_at
+  attributes :id, :scheduled_at, :params
 
   has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
 
   def id
     object.id.to_s
   end
+
+  def params
+    object.params.without(:application_id)
+  end
 end
index 07fd969e5ada1be931f4d5bea42475686672f1d5..260765edfd4a3669c76752828d06ffb04a7a75db 100644 (file)
@@ -167,10 +167,10 @@ class PostStatusService < BaseService
 
   def scheduled_options
     @options.tap do |options_hash|
-      options_hash[:in_reply_to_status_id] = options_hash.delete(:thread)&.id
-      options_hash[:application_id]        = options_hash.delete(:application)&.id
-      options_hash[:scheduled_at]          = nil
-      options_hash[:idempotency]           = nil
+      options_hash[:in_reply_to_id] = options_hash.delete(:thread)&.id
+      options_hash[:application_id] = options_hash.delete(:application)&.id
+      options_hash[:scheduled_at]   = nil
+      options_hash[:idempotency]    = nil
     end
   end
 end
index 298a13001e26cae22b756465d5f97e2a2b5f7a27..641fcc61c72d8b4d4beb5e62a0c4ab22d3b67be4 100644 (file)
@@ -18,7 +18,7 @@ class PublishScheduledStatusWorker
   def options_with_objects(options)
     options.tap do |options_hash|
       options_hash[:application] = Doorkeeper::Application.find(options_hash.delete(:application_id)) if options[:application_id]
-      options_hash[:thread]      = Status.find(options_hash.delete(:in_reply_to_status_id)) if options_hash[:in_reply_to_status_id]
+      options_hash[:thread]      = Status.find(options_hash.delete(:in_reply_to_id)) if options_hash[:in_reply_to_id]
     end
   end
 end