multiple layers for edits too

This commit is contained in:
j 2021-11-24 11:53:13 +01:00
parent 83228a5ead
commit db6a2f25bd

View file

@ -300,24 +300,22 @@ async function loadClips(annotations) {
}
function loadAnnotations(config) {
var layers = config.layer
if (!Array.isArray(layers)) {
layers = [layers]
}
if (config.item) {
pandoraAPI('get', {id: config.item, keys: [
'layers'
]}).then(response => {
var annotations = []
if (Array.isArray(config.layer)) {
config.layer.forEach(layer => {
layers.forEach(layer => {
response.data.layers[layer].forEach(annotation => {
if (!(config.user && annotation.user != config.user)) {
annotations.push(annotation)
}
})
})
} else {
annotations = response.data.layers[config.layer].filter(annotation => {
return !(config.user && annotation.user != config.user)
})
}
loadClips(annotations).then(annotations => {
config.annotations = annotations.filter(annotation => {
if (config.only_e) {
@ -344,7 +342,8 @@ function loadAnnotations(config) {
director: clip.director,
id: clip.item
}
clip.layers[config.layer].forEach(annotation => {
layers.forEach(layer => {
clip.layers[layer].forEach(annotation => {
if (config.user && annotation.user != config.user) {
return
}
@ -362,6 +361,7 @@ function loadAnnotations(config) {
}
}
})
}
})
loadClips(annotations).then(annotations => {
config.annotations = annotations