Fix: various small fixes

This commit is contained in:
Pieter Vander Vennet 2024-12-26 23:19:47 +01:00
parent e7f0291038
commit 5284d94427
6 changed files with 17 additions and 15 deletions

View file

@ -91,7 +91,6 @@ export default class AllImageProviders {
However, we override them if a custom image tag is set, e.g. 'image:menu'
*/
const prefixes = tagKey ?? imageProvider.defaultKeyPrefixes
console.log("Prefixes are", tagKey, prefixes)
const singleSource = tags.bindD((tags) => imageProvider.getRelevantUrls(tags, prefixes))
allSources.push(singleSource)
singleSource.addCallbackAndRunD((_) => {

View file

@ -312,8 +312,8 @@ export default class NameSuggestionIndex {
}
const hasSpecial =
i.locationSet.include?.some((i) => i.endsWith(".geojson") || Array.isArray(i)) ||
i.locationSet.exclude?.some((i) => i.endsWith(".geojson") || Array.isArray(i))
i.locationSet.include?.some((i) => Array.isArray(i) || i.endsWith(".geojson")) ||
i.locationSet.exclude?.some((i) => Array.isArray(i) || i.endsWith(".geojson"))
if (!hasSpecial) {
return false
}

View file

@ -29,6 +29,7 @@
html?.remove()
uiElement?.Destroy()
})
</script>
{#if isSvelte}
@ -42,6 +43,6 @@
{:else}
<svelte:component this={svelteElem?._svelteComponent} {...svelteElem._props} />
{/if}
{:else}
{:else if elem !== undefined}
<span bind:this={elem} />
{/if}

View file

@ -43,14 +43,13 @@ export class DeleteFlowState {
console.log("Checking deleteability (internet?", useTheInternet, ")")
const t = Translations.t.delete
const id = this._id
const self = this
if (!id.startsWith("node")) {
this.canBeDeleted.setData(false)
this.canBeDeletedReason.setData(t.isntAPoint)
return
}
// Does the currently logged in user have enough experience to delete this point?
// Does the currently logged-in user have enough experience to delete this point?
const deletingPointsOfOtherAllowed = this._osmConnection.userDetails.map((ud) => {
if (ud === undefined) {
return undefined
@ -74,10 +73,10 @@ export class DeleteFlowState {
// Not yet downloaded
return null
}
const userId = self._osmConnection.userDetails.data.uid
const userId = this._osmConnection.userDetails.data.uid
return !previous.some((editor) => editor !== userId)
},
[self._osmConnection.userDetails]
[this._osmConnection.userDetails]
)
// User allowed OR only edited by self?
@ -96,14 +95,13 @@ export class DeleteFlowState {
if (allByMyself.data === null && useTheInternet) {
// We kickoff the download here as it hasn't yet been downloaded. Note that this is mapped onto 'all by myself' above
const hist = this.objectDownloader
.downloadHistory(id)
.map((versions) =>
UIEventSource.FromPromise(this.objectDownloader
.downloadHistory(id))
.mapD((versions) =>
versions.map((version) =>
Number(version.tags["_last_edit:contributor:uid"])
)
)
hist.addCallbackAndRunD((hist) => previousEditors.setData(hist))
).addCallbackAndRunD((hist) => previousEditors.setData(hist))
}
if (allByMyself.data === true) {

View file

@ -12,7 +12,6 @@
import Translations from "../../i18n/Translations.js"
import { Utils } from "../../../Utils"
import { onDestroy } from "svelte"
import TagRenderingQuestion from "./TagRenderingQuestion.svelte"
import TagRenderingQuestionDynamic from "./TagRenderingQuestionDynamic.svelte"
export let layer: LayerConfig
@ -54,6 +53,7 @@
let skippedQuestions = new UIEventSource<Set<string>>(new Set<string>())
let layerDisabledForTheme = state.userRelatedState.getThemeDisabled(state.theme.id, layer.id)
layerDisabledForTheme.addCallbackAndRunD((disabled) => {
console.log("Disabled questions are ", disabled)
skippedQuestions.set(new Set(disabled.concat(Array.from(skippedQuestions.data))))
})
let questionboxElem: HTMLDivElement

View file

@ -49,9 +49,13 @@
function createVisualisation(specpart: Exclude<RenderingSpecification, string>): BaseUIElement {
{
try {
return specpart.func
const uiEl = specpart.func
.constr(state, tags, specpart.args, feature, layer)
?.SetClass(specpart.style)
if (uiEl === undefined) {
console.error("Invalid special translation")
}
return uiEl
} catch (e) {
console.error(
"Could not construct a special visualisation with specification",