diff options
Diffstat (limited to 'src/client/app/desktop/views/components/notes.note.vue')
| -rw-r--r-- | src/client/app/desktop/views/components/notes.note.vue | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index 057c3c0956..8660a5f899 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -17,7 +17,7 @@ <header> <router-link class="name" :to="p.user | userPage" v-user-preview="p.user.id">{{ p.user | userName }}</router-link> <span class="is-bot" v-if="p.user.host === null && p.user.isBot">bot</span> - <span class="username">@{{ p.user | acct }}</span> + <span class="username"><mk-acct :user="p.user"/></span> <div class="info"> <span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span> <span class="mobile" v-if="p.viaMobile">%fa:mobile-alt%</span> @@ -44,7 +44,7 @@ <div class="text"> <span v-if="p.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span> <a class="reply" v-if="p.reply">%fa:reply%</a> - <mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/> + <mk-note-html v-if="p.text && !canHideText(p)" :text="p.text" :i="os.i" :class="$style.text"/> <a class="rp" v-if="p.renote">RP:</a> </div> <div class="media" v-if="p.media.length > 0"> @@ -94,6 +94,7 @@ <script lang="ts"> import Vue from 'vue'; import dateStringify from '../../../common/scripts/date-stringify'; +import canHideText from '../../../common/scripts/can-hide-text'; import parse from '../../../../../text/parse'; import MkPostFormWindow from './post-form-window.vue'; @@ -130,16 +131,17 @@ export default Vue.extend({ }, computed: { - isRenote(): boolean { return (this.note.renote && this.note.text == null && this.note.mediaIds.length == 0 && this.note.poll == null); }, + p(): any { return this.isRenote ? this.note.renote : this.note; }, + reactionsCount(): number { return this.p.reactionCounts ? Object.keys(this.p.reactionCounts) @@ -147,9 +149,11 @@ export default Vue.extend({ .reduce((a, b) => a + b) : 0; }, + title(): string { return dateStringify(this.p.createdAt); }, + urls(): string[] { if (this.p.text) { const ast = parse(this.p.text); @@ -205,6 +209,8 @@ export default Vue.extend({ }, methods: { + canHideText, + capture(withHandler = false) { if ((this as any).os.isSignedIn) { this.connection.send({ @@ -214,6 +220,7 @@ export default Vue.extend({ if (withHandler) this.connection.on('note-updated', this.onStreamNoteUpdated); } }, + decapture(withHandler = false) { if ((this as any).os.isSignedIn) { this.connection.send({ @@ -223,9 +230,11 @@ export default Vue.extend({ if (withHandler) this.connection.off('note-updated', this.onStreamNoteUpdated); } }, + onStreamConnected() { this.capture(); }, + onStreamNoteUpdated(data) { const note = data.note; if (note.id == this.note.id) { @@ -234,28 +243,33 @@ export default Vue.extend({ this.note.renote = note; } }, + reply() { (this as any).os.new(MkPostFormWindow, { reply: this.p }); }, + renote() { (this as any).os.new(MkRenoteFormWindow, { note: this.p }); }, + react() { (this as any).os.new(MkReactionPicker, { source: this.$refs.reactButton, note: this.p }); }, + menu() { (this as any).os.new(MkNoteMenu, { source: this.$refs.menuButton, note: this.p }); }, + onKeydown(e) { let shouldBeCancel = true; @@ -336,6 +350,7 @@ root(isDark) align-items center padding 16px 32px line-height 28px + white-space pre color #9dbb00 background isDark ? linear-gradient(to bottom, #314027 0%, #282c37 100%) : linear-gradient(to bottom, #edfde2 0%, #fff 100%) |