Don't load already loaded task attachments again when saving an edited task description
This commit is contained in:
parent
2854d3a0c2
commit
eac4f88a65
1 changed files with 14 additions and 5 deletions
|
@ -117,6 +117,7 @@ export default {
|
||||||
|
|
||||||
preview: '',
|
preview: '',
|
||||||
attachmentService: null,
|
attachmentService: null,
|
||||||
|
loadedAttachments: {},
|
||||||
|
|
||||||
config: {
|
config: {
|
||||||
autoDownloadFontAwesome: false,
|
autoDownloadFontAwesome: false,
|
||||||
|
@ -392,6 +393,13 @@ export default {
|
||||||
const parts = img.dataset.src.substr(window.API_URL.length + 1).split('/')
|
const parts = img.dataset.src.substr(window.API_URL.length + 1).split('/')
|
||||||
const taskId = parseInt(parts[1])
|
const taskId = parseInt(parts[1])
|
||||||
const attachmentId = parseInt(parts[3])
|
const attachmentId = parseInt(parts[3])
|
||||||
|
const cacheKey = `${taskId}-${attachmentId}`
|
||||||
|
|
||||||
|
if (typeof this.loadedAttachments[cacheKey] !== 'undefined') {
|
||||||
|
img.src = this.loadedAttachments[cacheKey]
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
const attachment = new AttachmentModel({taskId: taskId, id: attachmentId})
|
const attachment = new AttachmentModel({taskId: taskId, id: attachmentId})
|
||||||
|
|
||||||
if (this.attachmentService === null) {
|
if (this.attachmentService === null) {
|
||||||
|
@ -401,6 +409,7 @@ export default {
|
||||||
this.attachmentService.getBlobUrl(attachment)
|
this.attachmentService.getBlobUrl(attachment)
|
||||||
.then(url => {
|
.then(url => {
|
||||||
img.src = url
|
img.src = url
|
||||||
|
this.loadedAttachments[cacheKey] = url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue