aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Verdone <spiral@arcseconds.net>2019-07-24 17:09:59 +0200
committerMike Verdone <spiral@arcseconds.net>2019-07-24 17:09:59 +0200
commit2c83eb0b157b2f574f55341e9171f0b5ab7bd3b2 (patch)
treec52ea70a7f01e436eedd0065e04e86911accb1f6
parent877575d0da830724e822eac2de243391aaea7ec8 (diff)
downloadpleroma-2c83eb0b157b2f574f55341e9171f0b5ab7bd3b2.tar.gz
Revert "squash! Expose expires_at datetime in mastoAPI only for the activity actor"
This reverts commit 2981821db834448bf9b2ba26590314e36201664c.
-rw-r--r--docs/api/differences_in_mastoapi_responses.md2
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex10
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs2
-rw-r--r--test/web/mastodon_api/status_view_test.exs2
4 files changed, 6 insertions, 10 deletions
diff --git a/docs/api/differences_in_mastoapi_responses.md b/docs/api/differences_in_mastoapi_responses.md
index 829468b13..168a13f4e 100644
--- a/docs/api/differences_in_mastoapi_responses.md
+++ b/docs/api/differences_in_mastoapi_responses.md
@@ -25,7 +25,7 @@ Has these additional fields under the `pleroma` object:
- `in_reply_to_account_acct`: the `acct` property of User entity for replied user (if any)
- `content`: a map consisting of alternate representations of the `content` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`
- `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being it's mimetype. Currently the only alternate representation supported is `text/plain`
-- `expires_in`: the number of minutes until a post will expire (be deleted automatically), or empty if the post won't expire
+- `expires_on`: a datetime (iso8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire
## Attachments
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 4a3686d72..7264dcafb 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -168,15 +168,11 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
client_posted_this_activity = opts[:for] && user.id == opts[:for].id
- expires_in =
+ expires_at =
with true <- client_posted_this_activity,
expiration when not is_nil(expiration) <-
ActivityExpiration.get_by_activity_id(activity.id) do
- expires_in_seconds =
- expiration.scheduled_at
- |> NaiveDateTime.diff(NaiveDateTime.utc_now(), :second)
-
- round(expires_in_seconds / 60)
+ expiration.scheduled_at
end
thread_muted? =
@@ -277,7 +273,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_in: expires_in
+ expires_at: expires_at
}
}
end
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index a9d38c06e..e59908979 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -170,7 +170,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert activity = Activity.get_by_id(fourth_id)
assert expiration = ActivityExpiration.get_by_activity_id(fourth_id)
assert expiration.scheduled_at == expires_at
- assert fourth_response["pleroma"]["expires_in"] > 0
+ assert fourth_response["pleroma"]["expires_at"] == NaiveDateTime.to_iso8601(expires_at)
end
test "replying to a status", %{conn: conn} do
diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs
index eb0874ab2..073c69659 100644
--- a/test/web/mastodon_api/status_view_test.exs
+++ b/test/web/mastodon_api/status_view_test.exs
@@ -134,7 +134,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
in_reply_to_account_acct: nil,
content: %{"text/plain" => HtmlSanitizeEx.strip_tags(object_data["content"])},
spoiler_text: %{"text/plain" => HtmlSanitizeEx.strip_tags(object_data["summary"])},
- expires_in: nil
+ expires_at: nil
}
}