about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-09-24 04:09:32 +0200
committerGitHub <noreply@github.com>2017-09-24 04:09:32 +0200
commitadc38078dde102d4b6e98d364ada47fa3dd3f22c (patch)
tree15b0510f396fa06d6f7a53a1e2a9b6a6f14eccbe /app/serializers/rest
parentdae0af1fd2499a2eca2becbbec13356a27c4e81c (diff)
Make sure nil IDs to not get cast to empty string in REST API (#5068)
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/application_serializer.rb2
-rw-r--r--app/serializers/rest/status_serializer.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/app/serializers/rest/application_serializer.rb b/app/serializers/rest/application_serializer.rb
index 5eb03a513..a8945f66e 100644
--- a/app/serializers/rest/application_serializer.rb
+++ b/app/serializers/rest/application_serializer.rb
@@ -9,7 +9,7 @@ class REST::ApplicationSerializer < ActiveModel::Serializer
   end
 
   def client_id
-    object.uid.to_s
+    object.uid
   end
 
   def client_secret
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index ef3c325ba..e6270f902 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -24,11 +24,11 @@ class REST::StatusSerializer < ActiveModel::Serializer
   end
 
   def in_reply_to_id
-    object.in_reply_to_id.to_s
+    object.in_reply_to_id&.to_s
   end
 
   def in_reply_to_account_id
-    object.in_reply_to_account_id.to_s
+    object.in_reply_to_account_id&.to_s
   end
 
   def current_user?