about summary refs log tree commit diff
path: root/app/serializers/rest
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-12-11 22:00:22 -0600
committermultiple creatures <dev@multiple-creature.party>2019-12-11 22:00:22 -0600
commitdae7cda4abe135b3bb5fe9cfb3380721a2feb03e (patch)
tree4eda3ccfee17cb36a461d31cf74d266d80f6ebae /app/serializers/rest
parent9a435494c2efdd2ca8fc7f5fa3dbb81bf88633a1 (diff)
move sharekeys & import metadata to own tables
Diffstat (limited to 'app/serializers/rest')
-rw-r--r--app/serializers/rest/status_serializer.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index 75a1dc591..8b0bce61e 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -14,7 +14,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
   attribute :bookmarked, if: :current_user?
   attribute :pinned, if: :pinnable?
   attribute :local_only if :local?
-  attribute :sharekey, if: :owner?
+  attribute :sharekey, if: :has_sharekey?
   attribute :delete_after, if: :current_user?
 
   attribute :content, unless: :source_requested?
@@ -53,12 +53,16 @@ class REST::StatusSerializer < ActiveModel::Serializer
     current_user? && current_user.account_id == object.account_id
   end
 
+  def has_sharekey?
+    owner? && object.sharekey.present?
+  end
+
   def show_application?
     object.account.user_shows_application? || owner?
   end
 
-  def spoiler_text
-    redis.hget("custom_cw:#{current_user&.account_id}", object.id) || redis.hget("custom_cw:#{current_user&.account_id}", "c#{object.conversation_id}") || object.spoiler_text
+  def sharekey
+    object.sharekey.key
   end
 
   def visibility