From adc38078dde102d4b6e98d364ada47fa3dd3f22c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 24 Sep 2017 04:09:32 +0200 Subject: [PATCH] Make sure nil IDs to not get cast to empty string in REST API (#5068) --- app/serializers/rest/application_serializer.rb | 2 +- app/serializers/rest/status_serializer.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/serializers/rest/application_serializer.rb b/app/serializers/rest/application_serializer.rb index 5eb03a51..a8945f66 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 ef3c325b..e6270f90 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?