[Enhancement] Allow forcing a refresh of source metadata (#194)
* Stopped sources from fetching metadata on every update * Added action button to force a metadata refresh
This commit is contained in:
@@ -9,6 +9,7 @@ defmodule PinchflatWeb.SourceControllerTest do
|
||||
alias Pinchflat.Repo
|
||||
alias Pinchflat.Settings
|
||||
alias Pinchflat.Downloading.MediaDownloadWorker
|
||||
alias Pinchflat.Metadata.SourceMetadataStorageWorker
|
||||
alias Pinchflat.SlowIndexing.MediaCollectionIndexingWorker
|
||||
|
||||
setup do
|
||||
@@ -215,6 +216,23 @@ defmodule PinchflatWeb.SourceControllerTest do
|
||||
end
|
||||
end
|
||||
|
||||
describe "force_metadata_refresh" do
|
||||
test "forces a metadata refresh", %{conn: conn} do
|
||||
source = source_fixture()
|
||||
|
||||
assert [] = all_enqueued(worker: SourceMetadataStorageWorker)
|
||||
post(conn, ~p"/sources/#{source.id}/force_metadata_refresh")
|
||||
assert [_] = all_enqueued(worker: SourceMetadataStorageWorker)
|
||||
end
|
||||
|
||||
test "redirects to the source page", %{conn: conn} do
|
||||
source = source_fixture()
|
||||
|
||||
conn = post(conn, ~p"/sources/#{source.id}/force_metadata_refresh")
|
||||
assert redirected_to(conn) == ~p"/sources/#{source.id}"
|
||||
end
|
||||
end
|
||||
|
||||
defp create_source(_) do
|
||||
source = source_fixture()
|
||||
media_item = media_item_with_attachments(%{source_id: source.id})
|
||||
|
||||
Reference in New Issue
Block a user