diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-18 08:41:32 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-18 08:41:32 +0900 |
| commit | a54de07260c3555d0230492970448604ffb9d586 (patch) | |
| tree | 0650c5de48af1cd5b5945da6a3dff6093ceaefd1 /src/client/components | |
| parent | Fix type (diff) | |
| download | misskey-a54de07260c3555d0230492970448604ffb9d586.tar.gz misskey-a54de07260c3555d0230492970448604ffb9d586.tar.bz2 misskey-a54de07260c3555d0230492970448604ffb9d586.zip | |
Resolve #5963
Diffstat (limited to 'src/client/components')
| -rw-r--r-- | src/client/components/date-separated-list.vue | 2 | ||||
| -rw-r--r-- | src/client/components/note.vue | 38 | ||||
| -rw-r--r-- | src/client/components/notes.vue | 2 |
3 files changed, 38 insertions, 4 deletions
diff --git a/src/client/components/date-separated-list.vue b/src/client/components/date-separated-list.vue index 461459f3ba..c425c02dce 100644 --- a/src/client/components/date-separated-list.vue +++ b/src/client/components/date-separated-list.vue @@ -2,7 +2,7 @@ <sequential-entrance class="sqadhkmv" ref="list" :direction="direction" :reversed="reversed"> <template v-for="(item, i) in items"> <slot :item="item" :i="i"></slot> - <div class="separator" :key="item.id + '_date'" v-if="i != items.length - 1 && new Date(item.createdAt).getDate() != new Date(items[i + 1].createdAt).getDate()"> + <div class="separator" :key="item.id + '_date'" v-if="i != items.length - 1 && new Date(item.createdAt).getDate() != new Date(items[i + 1].createdAt).getDate() && !item._prInjectionId_ && !items[i + 1]._prInjectionId_"> <p class="date"> <span><fa class="icon" :icon="faAngleUp"/>{{ getDateText(item.createdAt) }}</span> <span>{{ getDateText(items[i + 1].createdAt) }}<fa class="icon" :icon="faAngleDown"/></span> diff --git a/src/client/components/note.vue b/src/client/components/note.vue index 963e2045f1..e6b522d8d0 100644 --- a/src/client/components/note.vue +++ b/src/client/components/note.vue @@ -10,6 +10,7 @@ <x-sub v-for="note in conversation" :key="note.id" :note="note"/> <x-sub :note="appearNote.reply" class="reply-to" v-if="appearNote.reply"/> <div class="pinned" v-if="pinned"><fa :icon="faThumbtack"/> {{ $t('pinnedNote') }}</div> + <div class="pinned" v-if="appearNote._prInjectionId_"><fa :icon="faBullhorn"/> {{ $t('promotion') }}</div> <div class="renote" v-if="isRenote"> <mk-avatar class="avatar" :user="note.user"/> <fa :icon="faRetweet"/> @@ -83,7 +84,7 @@ <script lang="ts"> import Vue from 'vue'; -import { faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight } from '@fortawesome/free-solid-svg-icons'; +import { faBullhorn, faStar, faLink, faExternalLinkSquareAlt, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan, faQuoteRight } from '@fortawesome/free-solid-svg-icons'; import { faCopy, faTrashAlt, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons'; import { parse } from '../../mfm/parse'; import { sum, unique } from '../../prelude/array'; @@ -140,7 +141,7 @@ export default Vue.extend({ replies: [], showContent: false, hideThisNote: false, - faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan + faBullhorn, faPlus, faMinus, faRetweet, faReply, faReplyAll, faEllipsisH, faHome, faUnlock, faEnvelope, faThumbtack, faBan }; }, @@ -522,6 +523,15 @@ export default Vue.extend({ text: this.$t('pin'), action: () => this.togglePin(true) } : undefined, + ...(this.$store.state.i.isModerator || this.$store.state.i.isAdmin ? [ + null, + { + icon: faBullhorn, + text: this.$t('promote'), + action: this.promote + }] + : [] + ), ...(this.appearNote.userId == this.$store.state.i.id ? [ null, { @@ -614,6 +624,30 @@ export default Vue.extend({ }); }, + async promote() { + const { canceled, result: days } = await this.$root.dialog({ + title: this.$t('numberOfDays'), + input: { type: 'number' } + }); + + if (canceled) return; + + this.$root.api('admin/promo/create', { + noteId: this.appearNote.id, + expiresAt: Date.now() + (86400000 * days) + }).then(() => { + this.$root.dialog({ + type: 'success', + iconOnly: true, autoClose: true + }); + }).catch(e => { + this.$root.dialog({ + type: 'error', + text: e + }); + }); + }, + focus() { this.$el.focus(); }, diff --git a/src/client/components/notes.vue b/src/client/components/notes.vue index fb3a4314ba..2bf6327b09 100644 --- a/src/client/components/notes.vue +++ b/src/client/components/notes.vue @@ -15,7 +15,7 @@ </div> <x-list ref="notes" class="notes" :items="notes" v-slot="{ item: note }" :direction="reversed ? 'up' : 'down'" :reversed="reversed"> - <x-note :note="note" :detail="detail" :key="note.id"/> + <x-note :note="note" :detail="detail" :key="note._prInjectionId_ || note.id"/> </x-list> <div class="more" v-if="more && !reversed" style="margin-top: var(--margin);"> |