Add 削除して編集

This commit is contained in:
Xeltica 2020-03-08 21:59:33 +09:00
parent aeaf535ea2
commit dbd8cece77
2 changed files with 24 additions and 2 deletions

View File

@ -86,7 +86,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { faBolt, faTimes, faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight, faInfoCircle } from '@fortawesome/free-solid-svg-icons'; import { faBolt, faTimes, faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight, faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import { faCopy, faTrashAlt, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons'; import { faCopy, faTrashAlt, faEdit, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons';
import { parse } from '../../mfm/parse'; import { parse } from '../../mfm/parse';
import { sum, unique } from '../../prelude/array'; import { sum, unique } from '../../prelude/array';
import i18n from '../i18n'; import i18n from '../i18n';
@ -142,7 +142,7 @@ export default Vue.extend({
replies: [], replies: [],
showContent: false, showContent: false,
hideThisNote: false, hideThisNote: false,
faBolt, faTimes, faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan faEdit, faBolt, faTimes, faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan
}; };
}, },
@ -460,6 +460,22 @@ export default Vue.extend({
}); });
}, },
delEdit() {
this.$root.dialog({
type: 'warning',
text: this.$t('deleteAndEditConfirm'),
showCancelButton: true
}).then(({ canceled }) => {
if (canceled) return;
this.$root.api('notes/delete', {
noteId: this.appearNote.id
});
this.$root.post({ initialNote: this.appearNote });
});
},
toggleFavorite(favorite: boolean) { toggleFavorite(favorite: boolean) {
this.$root.api(favorite ? 'notes/favorites/create' : 'notes/favorites/delete', { this.$root.api(favorite ? 'notes/favorites/create' : 'notes/favorites/delete', {
noteId: this.appearNote.id noteId: this.appearNote.id
@ -547,6 +563,11 @@ export default Vue.extend({
), ),
...(this.appearNote.userId == this.$store.state.i.id ? [ ...(this.appearNote.userId == this.$store.state.i.id ? [
null, null,
{
icon: faEdit,
text: this.$t('deleteAndEdit'),
action: this.delEdit
},
{ {
icon: faTrashAlt, icon: faTrashAlt,
text: this.$t('delete'), text: this.$t('delete'),

View File

@ -300,6 +300,7 @@ export default Vue.extend({
}); });
} }
this.visibility = init.visibility; this.visibility = init.visibility;
this.localOnly = init.localOnly;
this.quoteId = init.renote ? init.renote.id : null; this.quoteId = init.renote ? init.renote.id : null;
} }