モバイルのデッキで返信が表示されない問題を修正

This commit is contained in:
syuilo 2019-03-02 08:06:03 +09:00
parent 139523b763
commit 1d02d9e0fe
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
3 changed files with 34 additions and 9 deletions

View File

@ -11,7 +11,7 @@
<a :href="note.url || note.uri" target="_blank">{{ $t('@.view-on-remote') }}</a> <a :href="note.url || note.uri" target="_blank">{{ $t('@.view-on-remote') }}</a>
</details> </details>
</div> </div>
<mk-note :note="note" :detail="true"/> <mk-note :note="note" :detail="true" :key="note.id"/>
</div> </div>
</x-column> </x-column>
</template> </template>
@ -20,13 +20,11 @@
import Vue from 'vue'; import Vue from 'vue';
import i18n from '../../../i18n'; import i18n from '../../../i18n';
import XColumn from './deck.column.vue'; import XColumn from './deck.column.vue';
import XNotes from './deck.notes.vue';
export default Vue.extend({ export default Vue.extend({
i18n: i18n(), i18n: i18n(),
components: { components: {
XColumn, XColumn,
XNotes,
}, },
data() { data() {

View File

@ -7,9 +7,7 @@
v-hotkey="keymap" v-hotkey="keymap"
:title="title" :title="title"
> >
<div class="conversation" v-if="detail && conversation.length > 0">
<x-sub v-for="note in conversation" :key="note.id" :note="note"/> <x-sub v-for="note in conversation" :key="note.id" :note="note"/>
</div>
<div class="reply-to" v-if="appearNote.reply && (!$store.getters.isSignedIn || $store.state.settings.showReplyTarget)"> <div class="reply-to" v-if="appearNote.reply && (!$store.getters.isSignedIn || $store.state.settings.showReplyTarget)">
<x-sub :note="appearNote.reply"/> <x-sub :note="appearNote.reply"/>
</div> </div>
@ -69,10 +67,8 @@
<div class="deleted" v-if="appearNote.deletedAt != null">{{ $t('deleted') }}</div> <div class="deleted" v-if="appearNote.deletedAt != null">{{ $t('deleted') }}</div>
</div> </div>
</article> </article>
<div class="replies" v-if="detail && replies.length > 0">
<x-sub v-for="note in replies" :key="note.id" :note="note"/> <x-sub v-for="note in replies" :key="note.id" :note="note"/>
</div> </div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@ -6,6 +6,7 @@
:class="{ renote: isRenote, smart: $store.state.device.postStyle == 'smart', mini: narrow }" :class="{ renote: isRenote, smart: $store.state.device.postStyle == 'smart', mini: narrow }"
v-hotkey="keymap" v-hotkey="keymap"
> >
<x-sub v-for="note in conversation" :key="note.id" :note="note"/>
<div class="reply-to" v-if="appearNote.reply && (!$store.getters.isSignedIn || $store.state.settings.showReplyTarget)"> <div class="reply-to" v-if="appearNote.reply && (!$store.getters.isSignedIn || $store.state.settings.showReplyTarget)">
<x-sub :note="appearNote.reply"/> <x-sub :note="appearNote.reply"/>
</div> </div>
@ -62,6 +63,7 @@
<div class="deleted" v-if="appearNote.deletedAt != null">{{ $t('deleted') }}</div> <div class="deleted" v-if="appearNote.deletedAt != null">{{ $t('deleted') }}</div>
</div> </div>
</article> </article>
<x-sub v-for="note in replies" :key="note.id" :note="note"/>
</div> </div>
</template> </template>
@ -91,6 +93,11 @@ export default Vue.extend({
type: Object, type: Object,
required: true required: true
}, },
detail: {
type: Boolean,
required: false,
default: false
},
}, },
inject: { inject: {
@ -98,6 +105,30 @@ export default Vue.extend({
default: false default: false
} }
}, },
data() {
return {
conversation: [],
replies: []
};
},
created() {
if (this.detail) {
this.$root.api('notes/replies', {
noteId: this.appearNote.id,
limit: 8
}).then(replies => {
this.replies = replies;
});
this.$root.api('notes/conversation', {
noteId: this.appearNote.replyId
}).then(conversation => {
this.conversation = conversation.reverse();
});
}
}
}); });
</script> </script>