summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-05-25 21:05:16 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-05-25 21:05:16 +0900
commit712c0ef27d72e522f8628c349b5ccf950cfeaed6 (patch)
tree01a1b87a980ef51aedf30be27dae8eed17d4523e /src/server/api/endpoints
parentoops (diff)
downloadsharkey-712c0ef27d72e522f8628c349b5ccf950cfeaed6.tar.gz
sharkey-712c0ef27d72e522f8628c349b5ccf950cfeaed6.tar.bz2
sharkey-712c0ef27d72e522f8628c349b5ccf950cfeaed6.zip
Refactor: Use better english
Diffstat (limited to 'src/server/api/endpoints')
-rw-r--r--src/server/api/endpoints/notes/conversation.ts (renamed from src/server/api/endpoints/notes/context.ts)15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/server/api/endpoints/notes/context.ts b/src/server/api/endpoints/notes/conversation.ts
index 1cd27250e2..02f7229ccf 100644
--- a/src/server/api/endpoints/notes/context.ts
+++ b/src/server/api/endpoints/notes/conversation.ts
@@ -5,11 +5,7 @@ import $ from 'cafy'; import ID from '../../../../cafy-id';
import Note, { pack } from '../../../../models/note';
/**
- * Show a context of a note
- *
- * @param {any} params
- * @param {any} user
- * @return {Promise<any>}
+ * Show conversation of a note
*/
module.exports = (params, user) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
@@ -33,7 +29,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
return rej('note not found');
}
- const context = [];
+ const conversation = [];
let i = 0;
async function get(id) {
@@ -41,10 +37,10 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const p = await Note.findOne({ _id: id });
if (i > offset) {
- context.push(p);
+ conversation.push(p);
}
- if (context.length == limit) {
+ if (conversation.length == limit) {
return;
}
@@ -58,6 +54,5 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
}
// Serialize
- res(await Promise.all(context.map(async note =>
- await pack(note, user))));
+ res(await Promise.all(conversation.map(note => pack(note, user))));
});