aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Verdone <spiral@arcseconds.net>2019-07-24 16:51:09 +0200
committerMike Verdone <spiral@arcseconds.net>2019-07-24 16:51:09 +0200
commit2981821db834448bf9b2ba26590314e36201664c (patch)
tree3568aea050ebc9438eecfa8cafd8c3d9aaeede4d /lib
parent91d9fdc7decc664483625c11e44d4e053dd9c585 (diff)
downloadpleroma-2981821db834448bf9b2ba26590314e36201664c.tar.gz
squash! Expose expires_at datetime in mastoAPI only for the activity actor
NOTE: rewrite the commit msg
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 7264dcafb..4a3686d72 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -168,11 +168,15 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
client_posted_this_activity = opts[:for] && user.id == opts[:for].id
- expires_at =
+ expires_in =
with true <- client_posted_this_activity,
expiration when not is_nil(expiration) <-
ActivityExpiration.get_by_activity_id(activity.id) do
- expiration.scheduled_at
+ expires_in_seconds =
+ expiration.scheduled_at
+ |> NaiveDateTime.diff(NaiveDateTime.utc_now(), :second)
+
+ round(expires_in_seconds / 60)
end
thread_muted? =
@@ -273,7 +277,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
content: %{"text/plain" => content_plaintext},
spoiler_text: %{"text/plain" => summary_plaintext},
- expires_at: expires_at
+ expires_in: expires_in
}
}
end