Merge pull request 'Add delete & redraft button to posts' (#174) from sfr/pleroma-fe:feat/redraft into develop
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: AkkomaGang/pleroma-fe#174
This commit is contained in:
commit
eaf2bd05a0
7 changed files with 9196 additions and 8707 deletions
|
@ -20,7 +20,7 @@
|
||||||
"@chenfengyuan/vue-qrcode": "2.0.0",
|
"@chenfengyuan/vue-qrcode": "2.0.0",
|
||||||
"@fortawesome/fontawesome-svg-core": "1.3.0",
|
"@fortawesome/fontawesome-svg-core": "1.3.0",
|
||||||
"@fortawesome/free-regular-svg-icons": "^6.1.2",
|
"@fortawesome/free-regular-svg-icons": "^6.1.2",
|
||||||
"@fortawesome/free-solid-svg-icons": "5.15.4",
|
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
||||||
"@fortawesome/vue-fontawesome": "3.0.1",
|
"@fortawesome/vue-fontawesome": "3.0.1",
|
||||||
"@kazvmoe-infra/pinch-zoom-element": "1.2.0",
|
"@kazvmoe-infra/pinch-zoom-element": "1.2.0",
|
||||||
"@vuelidate/core": "2.0.0-alpha.42",
|
"@vuelidate/core": "2.0.0-alpha.42",
|
||||||
|
|
|
@ -8,7 +8,8 @@ import {
|
||||||
faThumbtack,
|
faThumbtack,
|
||||||
faShareAlt,
|
faShareAlt,
|
||||||
faExternalLinkAlt,
|
faExternalLinkAlt,
|
||||||
faHistory
|
faHistory,
|
||||||
|
faFilePen
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
import {
|
import {
|
||||||
faBookmark as faBookmarkReg,
|
faBookmark as faBookmarkReg,
|
||||||
|
@ -24,7 +25,8 @@ library.add(
|
||||||
faShareAlt,
|
faShareAlt,
|
||||||
faExternalLinkAlt,
|
faExternalLinkAlt,
|
||||||
faFlag,
|
faFlag,
|
||||||
faHistory
|
faHistory,
|
||||||
|
faFilePen
|
||||||
)
|
)
|
||||||
|
|
||||||
const ExtraButtons = {
|
const ExtraButtons = {
|
||||||
|
@ -36,7 +38,8 @@ const ExtraButtons = {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
expanded: false,
|
expanded: false,
|
||||||
showingDeleteDialog: false
|
showingDeleteDialog: false,
|
||||||
|
showingRedraftDialog: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -122,6 +125,34 @@ const ExtraButtons = {
|
||||||
const stripFieldsList = ['attachments', 'created_at', 'emojis', 'text', 'raw_html', 'nsfw', 'poll', 'summary', 'summary_raw_html']
|
const stripFieldsList = ['attachments', 'created_at', 'emojis', 'text', 'raw_html', 'nsfw', 'poll', 'summary', 'summary_raw_html']
|
||||||
stripFieldsList.forEach(p => delete originalStatus[p])
|
stripFieldsList.forEach(p => delete originalStatus[p])
|
||||||
this.$store.dispatch('openStatusHistoryModal', originalStatus)
|
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: {
|
computed: {
|
||||||
|
|
|
@ -95,6 +95,17 @@
|
||||||
icon="history"
|
icon="history"
|
||||||
/><span>{{ $t("status.edit_history") }}</span>
|
/><span>{{ $t("status.edit_history") }}</span>
|
||||||
</button>
|
</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
|
<button
|
||||||
v-if="canDelete"
|
v-if="canDelete"
|
||||||
class="button-default dropdown-item dropdown-item-icon"
|
class="button-default dropdown-item dropdown-item-icon"
|
||||||
|
@ -179,6 +190,16 @@
|
||||||
>
|
>
|
||||||
{{ $t('status.delete_confirm') }}
|
{{ $t('status.delete_confirm') }}
|
||||||
</ConfirmModal>
|
</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>
|
</teleport>
|
||||||
</template>
|
</template>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
|
|
@ -86,7 +86,8 @@ const PostStatusForm = {
|
||||||
'fileLimit',
|
'fileLimit',
|
||||||
'submitOnEnter',
|
'submitOnEnter',
|
||||||
'emojiPickerPlacement',
|
'emojiPickerPlacement',
|
||||||
'optimisticPosting'
|
'optimisticPosting',
|
||||||
|
'isRedraft'
|
||||||
],
|
],
|
||||||
emits: [
|
emits: [
|
||||||
'posted',
|
'posted',
|
||||||
|
@ -141,7 +142,7 @@ const PostStatusForm = {
|
||||||
contentType
|
contentType
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.statusId) {
|
if (this.statusId || this.isRedraft) {
|
||||||
const statusContentType = this.statusContentType || contentType
|
const statusContentType = this.statusContentType || contentType
|
||||||
statusParams = {
|
statusParams = {
|
||||||
spoilerText: this.subject || '',
|
spoilerText: this.subject || '',
|
||||||
|
@ -259,7 +260,7 @@ const PostStatusForm = {
|
||||||
return this.newStatus.files.length >= this.fileLimit
|
return this.newStatus.files.length >= this.fileLimit
|
||||||
},
|
},
|
||||||
isEdit () {
|
isEdit () {
|
||||||
return typeof this.statusId !== 'undefined' && this.statusId.trim() !== ''
|
return typeof this.statusId !== 'undefined' && this.statusId.trim() !== '' && !this.isRedraft
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapGetters(['mergedConfig']),
|
||||||
...mapState({
|
...mapState({
|
||||||
|
|
|
@ -28,7 +28,8 @@ const PostStatusModal = {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
params (newVal, oldVal) {
|
params (newVal, oldVal) {
|
||||||
if (get(newVal, 'repliedUser.id') !== get(oldVal, 'repliedUser.id')) {
|
if (get(newVal, 'repliedUser.id') !== get(oldVal, 'repliedUser.id') ||
|
||||||
|
get(newVal, 'statusId') !== get(oldVal, 'statusId')) {
|
||||||
this.resettingForm = true
|
this.resettingForm = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.resettingForm = false
|
this.resettingForm = false
|
||||||
|
|
|
@ -925,6 +925,11 @@
|
||||||
"pin": "Pin on profile",
|
"pin": "Pin on profile",
|
||||||
"pinned": "Pinned",
|
"pinned": "Pinned",
|
||||||
"plus_more": "+{number} more",
|
"plus_more": "+{number} more",
|
||||||
|
"redraft": "Delete & redraft",
|
||||||
|
"redraft_confirm": "Do you really want to delete and redraft this post? Interactions to the original post will not be preserved.",
|
||||||
|
"redraft_confirm_accept_button": "Yes, delete and redraft",
|
||||||
|
"redraft_confirm_cancel_button": "No, keep the original",
|
||||||
|
"redraft_confirm_title": "Confirm delete & redraft",
|
||||||
"remove_attachment": "Remove attachment",
|
"remove_attachment": "Remove attachment",
|
||||||
"repeat_confirm": "Do you really want to repeat this post?",
|
"repeat_confirm": "Do you really want to repeat this post?",
|
||||||
"repeat_confirm_accept_button": "Yes, repeat it",
|
"repeat_confirm_accept_button": "Yes, repeat it",
|
||||||
|
|
Loading…
Reference in a new issue