[Pleroma.Web.MastodonAPI.FilterView]: expires_at should be null when N/A
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Tue, 21 Aug 2018 17:45:58 +0000 (19:45 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Mon, 27 Aug 2018 13:09:06 +0000 (15:09 +0200)
lib/pleroma/web/mastodon_api/views/filter_view.ex

index 3f8c62f242222f43c42015f505d99470c8c58533..e8401cc2d7e1e030fa11f4c28a02b9768d059d5e 100644 (file)
@@ -8,11 +8,17 @@ defmodule Pleroma.Web.MastodonAPI.FilterView do
   end
 
   def render("filter.json", %{filter: filter}) do
+    if filter.expires_at do
+      expires_at = Utils.to_masto_date(filter.expires_at)
+    else
+      expires_at = nil
+    end
+
     %{
       id: to_string(filter.filter_id),
       phrase: filter.phrase,
       context: filter.context,
-      expires_at: Utils.to_masto_date(filter.expires_at),
+      expires_at: expires_at,
       irreversible: filter.hide,
       whole_word: false
     }