diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-06 09:09:24 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-06 09:09:24 +0900 |
| commit | 416accbe789586ce3fabcca525a3e18658aeecaf (patch) | |
| tree | 454947d63bc09094023b476cffba106826fc4d94 /src/client/components/note.vue | |
| parent | 12.0.0-beta.2 (diff) | |
| download | misskey-416accbe789586ce3fabcca525a3e18658aeecaf.tar.gz misskey-416accbe789586ce3fabcca525a3e18658aeecaf.tar.bz2 misskey-416accbe789586ce3fabcca525a3e18658aeecaf.zip | |
Renoteを解除できるように
Resolve #2231
Diffstat (limited to 'src/client/components/note.vue')
| -rw-r--r-- | src/client/components/note.vue | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/client/components/note.vue b/src/client/components/note.vue index 8b3fa61a65..f143fe75ae 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -1,8 +1,8 @@ <template> <div class="note _panel" - v-show="appearNote.deletedAt == null && !hideThisNote" - :tabindex="appearNote.deletedAt == null ? '-1' : null" + v-show="!isDeleted && !hideThisNote" + :tabindex="!isDeleted ? '-1' : null" :class="{ renote: isRenote }" v-hotkey="keymap" v-size="[{ max: 500 }, { max: 450 }, { max: 350 }, { max: 300 }]" @@ -19,7 +19,7 @@ </router-link> </i18n> <div class="info"> - <mk-time :time="note.createdAt"/> + <button class="_button time" @click="showRenoteMenu"><mk-time :time="note.createdAt"/></button> <span class="visibility" v-if="note.visibility != 'public'"> <fa v-if="note.visibility == 'home'" :icon="faHome"/> <fa v-if="note.visibility == 'followers'" :icon="faUnlock"/> @@ -83,7 +83,7 @@ <script lang="ts"> import Vue from 'vue'; -import { faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan } from '@fortawesome/free-solid-svg-icons'; +import { faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faTrashAlt } from '@fortawesome/free-solid-svg-icons'; import { parse } from '../../mfm/parse'; import { sum, unique } from '../../prelude/array'; import i18n from '../i18n'; @@ -192,6 +192,10 @@ export default Vue.extend({ return this.isRenote ? this.note.renote : this.note; }, + isDeleted(): boolean { + return this.appearNote.deletedAt != null || this.note.deletedAt != null; + }, + isMyNote(): boolean { return this.$store.getters.isSignedIn && (this.$store.state.i.id === this.appearNote.userId); }, @@ -453,6 +457,23 @@ export default Vue.extend({ }); }, + showRenoteMenu(ev) { + if (!this.isMyNote) return; + this.$root.menu({ + items: [{ + text: this.$t('unrenote'), + icon: faTrashAlt, + action: () => { + this.$root.api('notes/delete', { + noteId: this.note.id + }); + Vue.set(this.note, 'deletedAt', new Date()); + } + }], + source: ev.currentTarget || ev.target, + }); + }, + toggleShowContent() { this.showContent = !this.showContent; }, @@ -609,8 +630,9 @@ export default Vue.extend({ margin-left: auto; font-size: 0.9em; - > .mk-time { + > .time { flex-shrink: 0; + color: inherit; } > .visibility { |