This commit is contained in:
Pieter Vander Vennet 2025-02-04 01:02:57 +01:00
parent 963eabae23
commit 52d4adee84
2 changed files with 28 additions and 11 deletions

View file

@ -90,6 +90,9 @@ export default class AllImageProviders {
const allPrefixes = Utils.Dedup(prefixes ?? [].concat(...sources.map(s => s.defaultKeyPrefixes))) const allPrefixes = Utils.Dedup(prefixes ?? [].concat(...sources.map(s => s.defaultKeyPrefixes)))
for (const prefix of allPrefixes) { for (const prefix of allPrefixes) {
for (const k in tags) { for (const k in tags) {
if (!tags[k]) {
continue
}
if (k === prefix || k.startsWith(prefix + ":")) { if (k === prefix || k.startsWith(prefix + ":")) {
count++ count++
continue continue

View file

@ -18,6 +18,7 @@
import { DownloadIcon } from "@rgossiaux/svelte-heroicons/solid" import { DownloadIcon } from "@rgossiaux/svelte-heroicons/solid"
import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction" import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"
import { Tag } from "../../Logic/Tags/Tag" import { Tag } from "../../Logic/Tags/Tag"
import { MenuState } from "../../Models/MenuState"
export let image: ProvidedImage export let image: ProvidedImage
export let state: SpecialVisualizationState export let state: SpecialVisualizationState
@ -26,7 +27,7 @@
onDestroy( onDestroy(
showDeleteDialog.addCallbackAndRunD((shown) => { showDeleteDialog.addCallbackAndRunD((shown) => {
if (shown) { if (shown) {
state.previewedImage.set(undefined) MenuState.previewedImage.set(undefined)
} }
}) })
) )
@ -53,18 +54,31 @@
issue: reportReason.data, issue: reportReason.data,
sequence_id: imageInfo.collection, sequence_id: imageInfo.collection,
reporter_comments: (reportFreeText.data ?? "") + "\n\n" + "Reported from " + url, reporter_comments: (reportFreeText.data ?? "") + "\n\n" + "Reported from " + url,
reporter_email, reporter_email
}) })
reported.set(true) reported.set(true)
} }
async function unlink() { async function unlink() {
await state?.changes?.applyAction( console.log("Unlinking image", image.key, image.id)
new ChangeTagAction(tags.data.id, new Tag(image.key, ""), tags.data, { if (image.id.length < 10) {
changeType: "delete-image", console.error("Suspicious value, not deleting ", image.id)
theme: state.theme.id, return
}) }
) // The "key" is the provider key, but not necessarely the actual key that should be reset
// We iterate over all tags. *Every* tag for which the value contains the id will be deleted
const tgs = tags.data
for (const key in tgs) {
if (typeof tgs[key] !== "string" || tgs[key].indexOf(image.id) < 0) {
continue
}
await state?.changes?.applyAction(
new ChangeTagAction(tgs.id, new Tag(key, ""), tgs, {
changeType: "delete-image",
theme: state.theme.id
}))
}
} }
const t = Translations.t.image.panoramax const t = Translations.t.image.panoramax
@ -161,7 +175,7 @@
</div> </div>
<style> <style>
:global(.carousel-max-height) { :global(.carousel-max-height) {
max-height: var(--image-carousel-height); max-height: var(--image-carousel-height);
} }
</style> </style>