mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 22:22:51 +09:00
Refactor: Use better english
This commit is contained in:
parent
94b2ddef45
commit
712c0ef27d
@ -2,16 +2,16 @@
|
|||||||
<div class="mk-note-detail" :title="title">
|
<div class="mk-note-detail" :title="title">
|
||||||
<button
|
<button
|
||||||
class="read-more"
|
class="read-more"
|
||||||
v-if="p.reply && p.reply.replyId && context.length == 0"
|
v-if="p.reply && p.reply.replyId && conversation.length == 0"
|
||||||
title="%i18n:@more%"
|
title="%i18n:@more%"
|
||||||
@click="fetchContext"
|
@click="fetchConversation"
|
||||||
:disabled="contextFetching"
|
:disabled="conversationFetching"
|
||||||
>
|
>
|
||||||
<template v-if="!contextFetching">%fa:ellipsis-v%</template>
|
<template v-if="!conversationFetching">%fa:ellipsis-v%</template>
|
||||||
<template v-if="contextFetching">%fa:spinner .pulse%</template>
|
<template v-if="conversationFetching">%fa:spinner .pulse%</template>
|
||||||
</button>
|
</button>
|
||||||
<div class="context">
|
<div class="conversation">
|
||||||
<x-sub v-for="note in context" :key="note.id" :note="note"/>
|
<x-sub v-for="note in conversation" :key="note.id" :note="note"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="reply-to" v-if="p.reply">
|
<div class="reply-to" v-if="p.reply">
|
||||||
<x-sub :note="p.reply"/>
|
<x-sub :note="p.reply"/>
|
||||||
@ -107,8 +107,8 @@ export default Vue.extend({
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
context: [],
|
conversation: [],
|
||||||
contextFetching: false,
|
conversationFetching: false,
|
||||||
replies: []
|
replies: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -176,15 +176,15 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchContext() {
|
fetchConversation() {
|
||||||
this.contextFetching = true;
|
this.conversationFetching = true;
|
||||||
|
|
||||||
// Fetch context
|
// Fetch conversation
|
||||||
(this as any).api('notes/context', {
|
(this as any).api('notes/conversation', {
|
||||||
noteId: this.p.replyId
|
noteId: this.p.replyId
|
||||||
}).then(context => {
|
}).then(conversation => {
|
||||||
this.contextFetching = false;
|
this.conversationFetching = false;
|
||||||
this.context = context.reverse();
|
this.conversation = conversation.reverse();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
reply() {
|
reply() {
|
||||||
@ -249,7 +249,7 @@ root(isDark)
|
|||||||
&:disabled
|
&:disabled
|
||||||
color isDark ? #21242b : #ccc
|
color isDark ? #21242b : #ccc
|
||||||
|
|
||||||
> .context
|
> .conversation
|
||||||
> *
|
> *
|
||||||
border-bottom 1px solid isDark ? #1c2023 : #eef0f2
|
border-bottom 1px solid isDark ? #1c2023 : #eef0f2
|
||||||
|
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
<div class="mk-note-detail">
|
<div class="mk-note-detail">
|
||||||
<button
|
<button
|
||||||
class="more"
|
class="more"
|
||||||
v-if="p.reply && p.reply.replyId && context.length == 0"
|
v-if="p.reply && p.reply.replyId && conversation.length == 0"
|
||||||
@click="fetchContext"
|
@click="fetchConversation"
|
||||||
:disabled="fetchingContext"
|
:disabled="conversationFetching"
|
||||||
>
|
>
|
||||||
<template v-if="!contextFetching">%fa:ellipsis-v%</template>
|
<template v-if="!conversationFetching">%fa:ellipsis-v%</template>
|
||||||
<template v-if="contextFetching">%fa:spinner .pulse%</template>
|
<template v-if="conversationFetching">%fa:spinner .pulse%</template>
|
||||||
</button>
|
</button>
|
||||||
<div class="context">
|
<div class="conversation">
|
||||||
<x-sub v-for="note in context" :key="note.id" :note="note"/>
|
<x-sub v-for="note in conversation" :key="note.id" :note="note"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="reply-to" v-if="p.reply">
|
<div class="reply-to" v-if="p.reply">
|
||||||
<x-sub :note="p.reply"/>
|
<x-sub :note="p.reply"/>
|
||||||
@ -99,8 +99,8 @@ export default Vue.extend({
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
context: [],
|
conversation: [],
|
||||||
contextFetching: false,
|
conversationFetching: false,
|
||||||
replies: []
|
replies: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -166,14 +166,14 @@ export default Vue.extend({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchContext() {
|
fetchContext() {
|
||||||
this.contextFetching = true;
|
this.conversationFetching = true;
|
||||||
|
|
||||||
// Fetch context
|
// Fetch conversation
|
||||||
(this as any).api('notes/context', {
|
(this as any).api('notes/conversation', {
|
||||||
noteId: this.p.replyId
|
noteId: this.p.replyId
|
||||||
}).then(context => {
|
}).then(conversation => {
|
||||||
this.contextFetching = false;
|
this.conversationFetching = false;
|
||||||
this.context = context.reverse();
|
this.conversation = conversation.reverse();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
reply() {
|
reply() {
|
||||||
@ -245,7 +245,7 @@ root(isDark)
|
|||||||
&:disabled
|
&:disabled
|
||||||
color #ccc
|
color #ccc
|
||||||
|
|
||||||
> .context
|
> .conversation
|
||||||
> *
|
> *
|
||||||
border-bottom 1px solid isDark ? #1c2023 : #eef0f2
|
border-bottom 1px solid isDark ? #1c2023 : #eef0f2
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ const endpoints: Endpoint[] = [
|
|||||||
name: 'notes/replies'
|
name: 'notes/replies'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'notes/context'
|
name: 'notes/conversation'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'notes/create',
|
name: 'notes/create',
|
||||||
|
@ -5,11 +5,7 @@ import $ from 'cafy'; import ID from '../../../../cafy-id';
|
|||||||
import Note, { pack } from '../../../../models/note';
|
import Note, { pack } from '../../../../models/note';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a context of a note
|
* Show conversation of a note
|
||||||
*
|
|
||||||
* @param {any} params
|
|
||||||
* @param {any} user
|
|
||||||
* @return {Promise<any>}
|
|
||||||
*/
|
*/
|
||||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// Get 'noteId' parameter
|
||||||
@ -33,7 +29,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
return rej('note not found');
|
return rej('note not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = [];
|
const conversation = [];
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
async function get(id) {
|
async function get(id) {
|
||||||
@ -41,10 +37,10 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
const p = await Note.findOne({ _id: id });
|
const p = await Note.findOne({ _id: id });
|
||||||
|
|
||||||
if (i > offset) {
|
if (i > offset) {
|
||||||
context.push(p);
|
conversation.push(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.length == limit) {
|
if (conversation.length == limit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +54,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
res(await Promise.all(context.map(async note =>
|
res(await Promise.all(conversation.map(note => pack(note, user))));
|
||||||
await pack(note, user))));
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user