resolves review
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2607>
This commit is contained in:
parent
ccb9987a95
commit
363a4b5d35
|
@ -41,9 +41,9 @@ class MbidTaggedContent(types.BooleanPreference):
|
||||||
name = "only_allow_musicbrainz_tagged_files"
|
name = "only_allow_musicbrainz_tagged_files"
|
||||||
verbose_name = "Only allow Musicbrainz tagged files"
|
verbose_name = "Only allow Musicbrainz tagged files"
|
||||||
help_text = (
|
help_text = (
|
||||||
"Only Musicbrainz tagged files will be allowed to be uploaded on the server. "
|
"Requires uploaded files to be tagged with a MusicBrainz ID. "
|
||||||
"If files where uploaded before this settings will not affect them. "
|
"Enabling this setting has no impact on previously uploaded files. "
|
||||||
"To clean the db from files not following mb tags use the funkwhale cli "
|
"You can use the CLI to clear files that don't contain an MBID or "
|
||||||
"or use quality filters"
|
"or enable quality filtering to hide untagged content from API calls. "
|
||||||
)
|
)
|
||||||
default = False
|
default = False
|
||||||
|
|
|
@ -248,7 +248,7 @@ def process_upload(upload, update_denormalization=True):
|
||||||
upload, "invalid_metadata", detail=detail, file_metadata=metadata_dump
|
upload, "invalid_metadata", detail=detail, file_metadata=metadata_dump
|
||||||
)
|
)
|
||||||
check_mbid = preferences.get("music__only_allow_musicbrainz_tagged_files")
|
check_mbid = preferences.get("music__only_allow_musicbrainz_tagged_files")
|
||||||
if check_mbid is True and not serializer.validated_data.get("mbid"):
|
if check_mbid and not serializer.validated_data.get("mbid"):
|
||||||
return fail_import(
|
return fail_import(
|
||||||
upload,
|
upload,
|
||||||
"Uploading files without a MusicBrainz ID is not permitted in this pod",
|
"Uploading files without a MusicBrainz ID is not permitted in this pod",
|
||||||
|
|
|
@ -1276,7 +1276,7 @@ def test_can_import_track_with_same_position_in_different_discs(factories, mocke
|
||||||
},
|
},
|
||||||
"position": upload.track.position,
|
"position": upload.track.position,
|
||||||
"disc_number": 2,
|
"disc_number": 2,
|
||||||
"mbid": str(uuid.uuid4()),
|
"mbid": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
mocker.patch.object(metadata.TrackMetadataSerializer, "validated_data", data)
|
mocker.patch.object(metadata.TrackMetadataSerializer, "validated_data", data)
|
||||||
|
@ -1310,7 +1310,7 @@ def test_can_import_track_with_same_position_in_same_discs_skipped(factories, mo
|
||||||
},
|
},
|
||||||
"position": upload.track.position,
|
"position": upload.track.position,
|
||||||
"disc_number": upload.track.disc_number,
|
"disc_number": upload.track.disc_number,
|
||||||
"mbid": str(uuid.uuid4()),
|
"mbid": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
mocker.patch.object(metadata.TrackMetadataSerializer, "validated_data", data)
|
mocker.patch.object(metadata.TrackMetadataSerializer, "validated_data", data)
|
||||||
|
@ -1407,7 +1407,6 @@ def test_upload_checks_mbid_tag(temp_signal, factories, mocker, preferences):
|
||||||
mocker.patch("funkwhale_api.federation.routes.outbox.dispatch")
|
mocker.patch("funkwhale_api.federation.routes.outbox.dispatch")
|
||||||
mocker.patch("funkwhale_api.music.tasks.populate_album_cover")
|
mocker.patch("funkwhale_api.music.tasks.populate_album_cover")
|
||||||
mocker.patch("funkwhale_api.music.metadata.Metadata.get_picture")
|
mocker.patch("funkwhale_api.music.metadata.Metadata.get_picture")
|
||||||
# mocker.spy(tasks, "get_track_from_import_metadata")
|
|
||||||
track = factories["music.Track"](album__attachment_cover=None, mbid=None)
|
track = factories["music.Track"](album__attachment_cover=None, mbid=None)
|
||||||
path = os.path.join(DATA_DIR, "with_cover.opus")
|
path = os.path.join(DATA_DIR, "with_cover.opus")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue