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

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>
</details>
</div>
<mk-note :note="note" :detail="true"/>
<mk-note :note="note" :detail="true" :key="note.id"/>
</div>
</x-column>
</template>
@ -20,13 +20,11 @@
import Vue from 'vue';
import i18n from '../../../i18n';
import XColumn from './deck.column.vue';
import XNotes from './deck.notes.vue';
export default Vue.extend({
i18n: i18n(),
components: {
XColumn,
XNotes,
},
data() {

View file

@ -7,9 +7,7 @@
v-hotkey="keymap"
:title="title"
>
<div class="conversation" v-if="detail && conversation.length > 0">
<x-sub v-for="note in conversation" :key="note.id" :note="note"/>
</div>
<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)">
<x-sub :note="appearNote.reply"/>
</div>
@ -69,9 +67,7 @@
<div class="deleted" v-if="appearNote.deletedAt != null">{{ $t('deleted') }}</div>
</div>
</article>
<div class="replies" v-if="detail && replies.length > 0">
<x-sub v-for="note in replies" :key="note.id" :note="note"/>
</div>
<x-sub v-for="note in replies" :key="note.id" :note="note"/>
</div>
</template>

View file

@ -6,6 +6,7 @@
:class="{ renote: isRenote, smart: $store.state.device.postStyle == 'smart', mini: narrow }"
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)">
<x-sub :note="appearNote.reply"/>
</div>
@ -62,6 +63,7 @@
<div class="deleted" v-if="appearNote.deletedAt != null">{{ $t('deleted') }}</div>
</div>
</article>
<x-sub v-for="note in replies" :key="note.id" :note="note"/>
</div>
</template>
@ -91,6 +93,11 @@ export default Vue.extend({
type: Object,
required: true
},
detail: {
type: Boolean,
required: false,
default: false
},
},
inject: {
@ -98,6 +105,30 @@ export default Vue.extend({
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>