Merge branch 'fix/status-view/expires_at' into 'develop'
Fix `status.expires_at` type Closes #1573 See merge request pleroma/pleroma!2222
This commit is contained in:
commit
cf8307e71c
|
@ -175,9 +175,11 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity}
|
||||||
|
|
||||||
expires_at =
|
expires_at =
|
||||||
with true <- client_posted_this_activity,
|
with true <- client_posted_this_activity,
|
||||||
expiration when not is_nil(expiration) <-
|
%ActivityExpiration{scheduled_at: scheduled_at} <-
|
||||||
ActivityExpiration.get_by_activity_id(activity.id) do
|
ActivityExpiration.get_by_activity_id(activity.id) do
|
||||||
expiration.scheduled_at
|
scheduled_at
|
||||||
|
else
|
||||||
|
_ -> nil
|
||||||
end
|
end
|
||||||
|
|
||||||
thread_muted? =
|
thread_muted? =
|
||||||
|
|
|
@ -1254,4 +1254,23 @@ test "returns the favorites of a user" do
|
||||||
|
|
||||||
assert [] = json_response(third_conn, 200)
|
assert [] = json_response(third_conn, 200)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "expires_at is nil for another user" do
|
||||||
|
%{conn: conn, user: user} = oauth_access(["read:statuses"])
|
||||||
|
{:ok, activity} = CommonAPI.post(user, %{"status" => "foobar", "expires_in" => 1_000_000})
|
||||||
|
|
||||||
|
expires_at =
|
||||||
|
activity.id
|
||||||
|
|> ActivityExpiration.get_by_activity_id()
|
||||||
|
|> Map.get(:scheduled_at)
|
||||||
|
|> NaiveDateTime.to_iso8601()
|
||||||
|
|
||||||
|
assert %{"pleroma" => %{"expires_at" => ^expires_at}} =
|
||||||
|
conn |> get("/api/v1/statuses/#{activity.id}") |> json_response(:ok)
|
||||||
|
|
||||||
|
%{conn: conn} = oauth_access(["read:statuses"])
|
||||||
|
|
||||||
|
assert %{"pleroma" => %{"expires_at" => nil}} =
|
||||||
|
conn |> get("/api/v1/statuses/#{activity.id}") |> json_response(:ok)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue