Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve copy comments from client #1590

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/components/widgets/AddComment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ import { mapGetters } from 'vuex'

import drafts from '@/lib/drafts'
import { remove } from '@/lib/models'
import { getDownloadAttachmentPath } from '@/lib/path'
import { replaceTimeWithTimecode } from '@/lib/render'
import strings from '@/lib/string'

Expand Down Expand Up @@ -689,9 +690,24 @@ export default {
this.checklist = remove(this.checklist, entry)
},

setValue(comment) {
this.checklist = comment.checklist
async setValue(comment) {
this.checklist = JSON.parse(JSON.stringify(comment.checklist))
this.text = comment.text

// duplicate attachment files
this.attachments = (
await Promise.all(
comment.attachment_files.map(async attachment => {
const fileUrl = getDownloadAttachmentPath(attachment)
const response = await fetch(fileUrl)
if (!response.ok) return
const fileBlob = await response.blob()
const formData = new FormData()
formData.append('file', fileBlob, attachment.name)
return formData
})
)
).filter(Boolean)
},

onAtTextChanged(input) {
Expand Down