Add delete & redraft button to posts
This commit is contained in:
parent
468eb12573
commit
ca646822f6
7 changed files with 9196 additions and 8707 deletions
|
@ -8,7 +8,8 @@ import {
|
|||
faThumbtack,
|
||||
faShareAlt,
|
||||
faExternalLinkAlt,
|
||||
faHistory
|
||||
faHistory,
|
||||
faFilePen
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import {
|
||||
faBookmark as faBookmarkReg,
|
||||
|
@ -24,7 +25,8 @@ library.add(
|
|||
faShareAlt,
|
||||
faExternalLinkAlt,
|
||||
faFlag,
|
||||
faHistory
|
||||
faHistory,
|
||||
faFilePen
|
||||
)
|
||||
|
||||
const ExtraButtons = {
|
||||
|
@ -36,7 +38,8 @@ const ExtraButtons = {
|
|||
data () {
|
||||
return {
|
||||
expanded: false,
|
||||
showingDeleteDialog: false
|
||||
showingDeleteDialog: false,
|
||||
showingRedraftDialog: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -122,6 +125,34 @@ const ExtraButtons = {
|
|||
const stripFieldsList = ['attachments', 'created_at', 'emojis', 'text', 'raw_html', 'nsfw', 'poll', 'summary', 'summary_raw_html']
|
||||
stripFieldsList.forEach(p => delete originalStatus[p])
|
||||
this.$store.dispatch('openStatusHistoryModal', originalStatus)
|
||||
},
|
||||
redraftStatus () {
|
||||
if (this.shouldConfirmDelete) {
|
||||
this.showRedraftStatusConfirmDialog()
|
||||
} else {
|
||||
this.doRedraftStatus()
|
||||
}
|
||||
},
|
||||
doRedraftStatus () {
|
||||
this.$store.dispatch('fetchStatusSource', { id: this.status.id })
|
||||
.then(data => this.$store.dispatch('openPostStatusModal', {
|
||||
isRedraft: true,
|
||||
statusId: this.status.id,
|
||||
subject: data.spoiler_text,
|
||||
statusText: data.text,
|
||||
statusIsSensitive: this.status.nsfw,
|
||||
statusPoll: this.status.poll,
|
||||
statusFiles: [...this.status.attachments],
|
||||
statusScope: this.status.visibility,
|
||||
statusContentType: data.content_type
|
||||
}))
|
||||
this.doDeleteStatus()
|
||||
},
|
||||
showRedraftStatusConfirmDialog () {
|
||||
this.showingRedraftDialog = true
|
||||
},
|
||||
hideRedraftStatusConfirmDialog () {
|
||||
this.showingRedraftDialog = false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -95,6 +95,17 @@
|
|||
icon="history"
|
||||
/><span>{{ $t("status.edit_history") }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="ownStatus"
|
||||
class="button-default dropdown-item dropdown-item-icon"
|
||||
@click.prevent="redraftStatus"
|
||||
@click="close"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
icon="file-pen"
|
||||
/><span>{{ $t("status.redraft") }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="canDelete"
|
||||
class="button-default dropdown-item dropdown-item-icon"
|
||||
|
@ -179,6 +190,16 @@
|
|||
>
|
||||
{{ $t('status.delete_confirm') }}
|
||||
</ConfirmModal>
|
||||
<ConfirmModal
|
||||
v-if="showingRedraftDialog"
|
||||
:title="$t('status.redraft_confirm_title')"
|
||||
:cancel-text="$t('status.redraft_confirm_cancel_button')"
|
||||
:confirm-text="$t('status.redraft_confirm_accept_button')"
|
||||
@cancelled="hideRedraftStatusConfirmDialog"
|
||||
@accepted="doRedraftStatus"
|
||||
>
|
||||
{{ $t('status.redraft_confirm') }}
|
||||
</ConfirmModal>
|
||||
</teleport>
|
||||
</template>
|
||||
</Popover>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue