Change url to externalLink as requested by hj here: https://shigusegubu.club/notice/AcIjZjackKAt6e522a

This commit is contained in:
NEETzsche 2023-11-29 07:55:44 -07:00
parent 510a7b64f1
commit e216603477
4 changed files with 10 additions and 10 deletions

View File

@ -59,7 +59,7 @@ defp create_request do
album: %Schema{type: :string, description: "The album of the media playing"},
artist: %Schema{type: :string, description: "The artist of the media playing"},
length: %Schema{type: :integer, description: "The length of the media playing"},
url: %Schema{type: :string, description: "A URL referencing the media playing"},
externalLink: %Schema{type: :string, description: "A URL referencing the media playing"},
visibility: %Schema{
allOf: [VisibilityScope],
default: "public",
@ -71,7 +71,7 @@ defp create_request do
"artist" => "Some Artist",
"album" => "Some Album",
"length" => 180_000,
"url" => "https://www.last.fm/music/Some+Artist/_/Some+Title"
"externalLink" => "https://www.last.fm/music/Some+Artist/_/Some+Title"
}
}
end
@ -85,7 +85,7 @@ defp scrobble do
title: %Schema{type: :string, description: "The title of the media playing"},
album: %Schema{type: :string, description: "The album of the media playing"},
artist: %Schema{type: :string, description: "The artist of the media playing"},
url: %Schema{type: :string, description: "A URL referencing the media playing"},
externalLink: %Schema{type: :string, description: "A URL referencing the media playing"},
length: %Schema{
type: :integer,
description: "The length of the media playing",
@ -100,7 +100,7 @@ defp scrobble do
"artist" => "Some Artist",
"album" => "Some Album",
"length" => 180_000,
"url" => "https://www.last.fm/music/Some+Artist/_/Some+Title",
"externalLink" => "https://www.last.fm/music/Some+Artist/_/Some+Title",
"created_at" => "2019-09-28T12:40:45.000Z"
}
}

View File

@ -83,7 +83,7 @@ def listen(user, params) do
defp listen_object(draft) do
object =
draft.params
|> Map.take([:album, :artist, :title, :length, :url])
|> Map.take([:album, :artist, :title, :length, :externalLink])
|> Map.new(fn {key, value} -> {to_string(key), value} end)
|> Map.put("type", "Audio")
|> Map.put("to", draft.to)

View File

@ -27,7 +27,7 @@ def render("show.json", %{activity: %Activity{data: %{"type" => "Listen"}} = act
title: object.data["title"] |> HTML.strip_tags(),
artist: object.data["artist"] |> HTML.strip_tags(),
album: object.data["album"] |> HTML.strip_tags(),
url: object.data["url"],
externalLink: object.data["externalLink"],
length: object.data["length"]
}
end

View File

@ -19,7 +19,7 @@ test "works correctly" do
"artist" => "lain",
"album" => "lain radio",
"length" => "180000",
"url" => "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+1"
"externalLink" => "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+1"
})
assert %{"title" => "lain radio episode 1"} = json_response_and_validate_schema(conn, 200)
@ -35,7 +35,7 @@ test "works correctly" do
title: "lain radio episode 1",
artist: "lain",
album: "lain radio",
url: "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+1"
externalLink: "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+1"
})
{:ok, _activity} =
@ -43,7 +43,7 @@ test "works correctly" do
title: "lain radio episode 2",
artist: "lain",
album: "lain radio",
url: "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+2"
externalLink: "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+2"
})
{:ok, _activity} =
@ -51,7 +51,7 @@ test "works correctly" do
title: "lain radio episode 3",
artist: "lain",
album: "lain radio",
url: "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+3"
externalLink: "https://www.last.fm/music/lain/lain+radio/lain+radio+episode+3"
})
conn = get(conn, "/api/v1/pleroma/accounts/#{user.id}/scrobbles")