squash! Expose expires_at datetime in mastoAPI only for the activity actor

NOTE: rewrite the commit msg
This commit is contained in:
Mike Verdone 2019-07-24 16:51:09 +02:00
commit 2981821db8
4 changed files with 10 additions and 6 deletions

View file

@ -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