Merge branch 'fix_486' into 'develop'
[akkoma] / lib / pleroma / web / mastodon_api / views / filter_view.ex
index 3f8c62f242222f43c42015f505d99470c8c58533..1052a449d291bd851b56e4ca20775489c9ddfb32 100644 (file)
@@ -1,3 +1,7 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
 defmodule Pleroma.Web.MastodonAPI.FilterView do
   use Pleroma.Web, :view
   alias Pleroma.Web.MastodonAPI.FilterView
@@ -8,11 +12,18 @@ defmodule Pleroma.Web.MastodonAPI.FilterView do
   end
 
   def render("filter.json", %{filter: filter}) do
+    expires_at =
+      if filter.expires_at do
+        Utils.to_masto_date(filter.expires_at)
+      else
+        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
     }