2023-03-10 12:10:39 -05:00
|
|
|
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
2023-03-10 19:24:01 -05:00
|
|
|
import EditStatusForm from 'src/components/edit_status_form/edit_status_form.vue'
|
2023-03-10 12:39:08 -05:00
|
|
|
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
|
2023-03-10 13:22:44 -05:00
|
|
|
import StatusContent from 'src/components/status_content/status_content.vue'
|
2024-12-30 02:07:49 +02:00
|
|
|
import Gallery from 'src/components/gallery/gallery.vue'
|
2023-03-10 12:10:39 -05:00
|
|
|
|
|
|
|
|
const Draft = {
|
|
|
|
|
components: {
|
2023-03-10 12:39:08 -05:00
|
|
|
PostStatusForm,
|
2023-03-10 19:24:01 -05:00
|
|
|
EditStatusForm,
|
2023-03-10 13:22:44 -05:00
|
|
|
ConfirmModal,
|
2024-12-30 02:07:49 +02:00
|
|
|
StatusContent,
|
|
|
|
|
Gallery
|
2023-03-10 12:10:39 -05:00
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
draft: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data () {
|
2024-12-30 02:07:49 +02:00
|
|
|
console.log('DRAFT', this.draft)
|
2023-03-10 12:10:39 -05:00
|
|
|
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
|
|
|
|
|
}
|
2023-03-10 13:22:44 -05:00
|
|
|
},
|
|
|
|
|
refStatus () {
|
|
|
|
|
return this.draft.refId ? this.$store.state.statuses.allStatusesObject[this.draft.refId] : undefined
|
2024-12-30 02:07:49 +02:00
|
|
|
},
|
|
|
|
|
localCollapseSubjectDefault () {
|
|
|
|
|
return this.$store.getters.mergedConfig.collapseMessageWithSubject
|
|
|
|
|
},
|
|
|
|
|
nsfwClickthrough () {
|
|
|
|
|
console.log(this.draft)
|
|
|
|
|
if (!this.draft.nsfw) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (this.draft.summary && this.localCollapseSubjectDefault) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
return true
|
2023-03-10 12:10:39 -05:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
toggleEditing () {
|
|
|
|
|
this.editing = !this.editing
|
2023-03-10 12:39:08 -05:00
|
|
|
},
|
|
|
|
|
abandon () {
|
|
|
|
|
this.showingConfirmDialog = true
|
|
|
|
|
},
|
|
|
|
|
doAbandon () {
|
|
|
|
|
this.$store.dispatch('abandonDraft', { id: this.draft.id })
|
|
|
|
|
.then(() => {
|
|
|
|
|
this.hideConfirmDialog()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
hideConfirmDialog () {
|
|
|
|
|
this.showingConfirmDialog = false
|
2023-03-10 12:10:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Draft
|