pleroma-fe/src/components/draft/draft.js

62 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-03-10 12:10:39 -05:00
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
2023-03-10 12:39:08 -05:00
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
2023-03-10 12:10:39 -05:00
const Draft = {
components: {
2023-03-10 12:39:08 -05:00
PostStatusForm,
ConfirmModal
2023-03-10 12:10:39 -05:00
},
props: {
draft: {
type: Object,
required: true
}
},
data () {
return {
2023-03-10 12:39:08 -05:00
editing: false,
showingConfirmDialog: false
2023-03-10 12:10:39 -05:00
}
},
computed: {
relAttrs () {
if (this.draft.type === 'edit') {
return { statusId: this.draft.refId }
} else if (this.draft.type === 'reply') {
return { replyTo: this.draft.refId }
} else {
return {}
}
},
postStatusFormProps () {
return {
draftId: this.draft.id,
...this.relAttrs
}
}
},
methods: {
toggleEditing () {
this.editing = !this.editing
2023-03-10 12:39:08 -05:00
},
abandon () {
this.showingConfirmDialog = true
},
doAbandon () {
console.debug('abandoning')
this.$store.dispatch('abandonDraft', { id: this.draft.id })
.then(() => {
this.hideConfirmDialog()
})
},
hideConfirmDialog () {
this.showingConfirmDialog = false
},
handlePosted () {
console.debug('posted')
this.doAbandon()
2023-03-10 12:10:39 -05:00
}
}
}
export default Draft