Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
baf9b65801 | |||
401d0b1298 | |||
fce7dc0f4e | |||
35489ef5b7 | |||
546d494587 | |||
e8afa2c940 | |||
c1ef1bf605 | |||
4ab0dbe7e3 | |||
44f86a94f4 | |||
a0278154a3 | |||
8b7e6b200e | |||
d6f6c26725 | |||
cf66343b31 | |||
d53689332f | |||
4105237027 | |||
436962e4b8 | |||
a85efa1392 | |||
f0115a5e21 | |||
80105239dc | |||
baad11288a |
28
package.json
28
package.json
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "9.3.1",
|
||||
"clientVersion": "1.0.10062",
|
||||
"version": "9.6.0",
|
||||
"clientVersion": "1.0.10090",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
@ -60,10 +60,10 @@
|
||||
"@types/mocha": "5.2.3",
|
||||
"@types/mongodb": "3.1.7",
|
||||
"@types/ms": "0.7.30",
|
||||
"@types/node": "10.10.3",
|
||||
"@types/node": "10.11.4",
|
||||
"@types/portscanner": "2.1.0",
|
||||
"@types/pug": "2.0.4",
|
||||
"@types/qrcode": "1.2.0",
|
||||
"@types/qrcode": "1.3.0",
|
||||
"@types/ratelimiter": "2.1.28",
|
||||
"@types/redis": "2.8.6",
|
||||
"@types/request": "2.47.1",
|
||||
@ -78,7 +78,7 @@
|
||||
"@types/tinycolor2": "1.4.1",
|
||||
"@types/tmp": "0.0.33",
|
||||
"@types/uuid": "3.4.4",
|
||||
"@types/webpack": "4.4.12",
|
||||
"@types/webpack": "4.4.14",
|
||||
"@types/webpack-stream": "3.2.10",
|
||||
"@types/websocket": "0.0.40",
|
||||
"@types/ws": "6.0.1",
|
||||
@ -98,7 +98,7 @@
|
||||
"debug": "4.0.1",
|
||||
"deep-equal": "1.0.1",
|
||||
"deepcopy": "0.6.3",
|
||||
"diskusage": "0.2.4",
|
||||
"diskusage": "0.2.5",
|
||||
"dompurify": "1.0.5",
|
||||
"double-ended-queue": "2.1.0-0",
|
||||
"elasticsearch": "15.1.1",
|
||||
@ -113,7 +113,7 @@
|
||||
"fuckadblock": "3.2.1",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-cssnano": "2.1.3",
|
||||
"gulp-htmlmin": "4.0.0",
|
||||
"gulp-htmlmin": "5.0.1",
|
||||
"gulp-imagemin": "4.1.0",
|
||||
"gulp-mocha": "6.0.0",
|
||||
"gulp-pug": "4.0.1",
|
||||
@ -133,7 +133,7 @@
|
||||
"is-root": "2.0.0",
|
||||
"is-url": "1.2.4",
|
||||
"js-yaml": "3.12.0",
|
||||
"jsdom": "11.12.0",
|
||||
"jsdom": "12.1.0",
|
||||
"json5": "2.1.0",
|
||||
"json5-loader": "1.0.1",
|
||||
"koa": "2.5.1",
|
||||
@ -142,7 +142,7 @@
|
||||
"koa-favicon": "2.0.1",
|
||||
"koa-json-body": "5.3.0",
|
||||
"koa-logger": "3.2.0",
|
||||
"koa-mount": "3.0.0",
|
||||
"koa-mount": "4.0.0",
|
||||
"koa-multer": "1.0.2",
|
||||
"koa-router": "7.4.0",
|
||||
"koa-send": "5.0.0",
|
||||
@ -159,7 +159,7 @@
|
||||
"mongodb": "3.1.1",
|
||||
"monk": "6.0.6",
|
||||
"ms": "2.1.1",
|
||||
"nan": "2.11.0",
|
||||
"nan": "2.11.1",
|
||||
"nested-property": "0.0.7",
|
||||
"nprogress": "0.2.0",
|
||||
"object-assign-deep": "0.4.0",
|
||||
@ -171,7 +171,7 @@
|
||||
"promise-sequential": "1.1.1",
|
||||
"pug": "2.0.3",
|
||||
"punycode": "2.1.1",
|
||||
"qrcode": "1.2.2",
|
||||
"qrcode": "1.3.0",
|
||||
"ratelimiter": "3.2.0",
|
||||
"recaptcha-promise": "0.1.3",
|
||||
"reconnecting-websocket": "3.2.2",
|
||||
@ -203,7 +203,7 @@
|
||||
"ts-node": "7.0.1",
|
||||
"tslint": "5.10.0",
|
||||
"typescript": "2.9.2",
|
||||
"typescript-eslint-parser": "18.0.0",
|
||||
"typescript-eslint-parser": "19.0.2",
|
||||
"uglify-es": "3.3.9",
|
||||
"url-loader": "1.1.1",
|
||||
"uuid": "3.3.2",
|
||||
@ -225,8 +225,8 @@
|
||||
"vuex-persistedstate": "2.5.4",
|
||||
"web-push": "3.3.3",
|
||||
"webfinger.js": "2.6.6",
|
||||
"webpack": "4.19.1",
|
||||
"webpack-cli": "3.1.0",
|
||||
"webpack-cli": "3.1.2",
|
||||
"webpack": "4.20.2",
|
||||
"websocket": "1.0.28",
|
||||
"ws": "6.0.0",
|
||||
"xev": "2.0.1"
|
||||
|
@ -46,15 +46,15 @@
|
||||
noteHeaderBadgeBg: 'rgba(0, 0, 0, 0.25)',
|
||||
noteHeaderAdminFg: '#f15f71',
|
||||
noteHeaderAdminBg: '#5d282e',
|
||||
noteHeaderAcct: '#606984',
|
||||
noteHeaderInfo: '#606984',
|
||||
noteHeaderAcct: ':alpha<0.65<$text',
|
||||
noteHeaderInfo: ':alpha<0.5<$text',
|
||||
|
||||
noteActions: '#606984',
|
||||
noteActionsHover: '#a1a8bf',
|
||||
noteActions: ':alpha<0.45<$text',
|
||||
noteActionsHover: ':alpha<0.6<$text',
|
||||
noteActionsReplyHover: '#0af',
|
||||
noteActionsRenoteHover: '#8d0',
|
||||
noteActionsReactionHover: '#fa0',
|
||||
noteActionsHighlighted: '#707b97',
|
||||
noteActionsHighlighted: ':alpha<0.7<$text',
|
||||
|
||||
noteAttachedFile: 'rgba(255, 255, 255, 0.1)',
|
||||
|
||||
|
@ -23,13 +23,13 @@
|
||||
scrollbarHandleHover: '#00000066',
|
||||
|
||||
face: '$secondary',
|
||||
faceText: '#444',
|
||||
faceText: '$text',
|
||||
faceHeader: ':lighten<5<$secondary',
|
||||
faceHeaderText: '#888',
|
||||
faceHeaderText: '$text',
|
||||
faceDivider: 'rgba(0, 0, 0, 0.082)',
|
||||
faceTextButton: '#ccc',
|
||||
faceTextButtonHover: '#aaa',
|
||||
faceTextButtonActive: '#999',
|
||||
faceTextButton: ':alpha<0.7<$text',
|
||||
faceTextButtonHover: ':alpha<0.7<:darken<7<$text',
|
||||
faceTextButtonActive: ':alpha<0.7<:darken<10<$text',
|
||||
faceClearButtonHover: 'rgba(0, 0, 0, 0.025)',
|
||||
faceClearButtonActive: 'rgba(0, 0, 0, 0.05)',
|
||||
popupBg: ':lighten<5<$secondary',
|
||||
@ -40,7 +40,7 @@
|
||||
renoteGradient: '#edfde2',
|
||||
renoteText: '#9dbb00',
|
||||
quoteBorder: '#c0dac6',
|
||||
noteText: '#717171',
|
||||
noteText: '$text',
|
||||
noteHeaderName: ':darken<2<$text',
|
||||
noteHeaderBadgeFg: '#aaa',
|
||||
noteHeaderBadgeBg: 'rgba(0, 0, 0, 0.05)',
|
||||
@ -141,7 +141,7 @@
|
||||
|
||||
desktopHeaderBg: ':lighten<5<$secondary',
|
||||
desktopHeaderFg: '$text',
|
||||
desktopHeaderHoverFg: '#7b8c88',
|
||||
desktopHeaderHoverFg: ':darken<7<$text',
|
||||
desktopHeaderSearchBg: 'rgba(0, 0, 0, 0.05)',
|
||||
desktopHeaderSearchHoverBg: 'rgba(0, 0, 0, 0.08)',
|
||||
desktopHeaderSearchFg: '#000',
|
||||
@ -156,9 +156,9 @@
|
||||
desktopPostFormTransparentButtonActiveGradientEnd: ':lighten<33<$primary',
|
||||
desktopRenoteFormFooter: ':lighten<33<$primary',
|
||||
desktopTimelineHeaderShadow: 'rgba(0, 0, 0, 0.08)',
|
||||
desktopTimelineSrc: '#6f7477',
|
||||
desktopTimelineSrcHover: '#525a5f',
|
||||
desktopWindowTitle: '#666',
|
||||
desktopTimelineSrc: '$text',
|
||||
desktopTimelineSrcHover: ':darken<7<$text',
|
||||
desktopWindowTitle: '$text',
|
||||
desktopWindowShadow: 'rgba(0, 0, 0, 0.2)',
|
||||
desktopDriveBg: '#fff',
|
||||
desktopDriveFolderBg: ':lighten<31<$primary',
|
||||
|
@ -127,6 +127,15 @@ export async function deleteDriveFile(driveFile: string | mongo.ObjectID | IDriv
|
||||
});
|
||||
}
|
||||
|
||||
export const packMany = async (
|
||||
files: any[],
|
||||
options?: {
|
||||
detail: boolean
|
||||
}
|
||||
) => {
|
||||
return (await Promise.all(files.map(f => pack(f, options)))).filter(x => x != null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pack a drive file for API response
|
||||
*/
|
||||
@ -155,7 +164,11 @@ export const pack = (
|
||||
_file = deepcopy(file);
|
||||
}
|
||||
|
||||
if (!_file) return reject('invalid file arg.');
|
||||
// (データベースの欠損などで)ファイルがデータベース上に見つからなかったとき
|
||||
if (_file == null) {
|
||||
console.warn(`in packaging driveFile: driveFile not found on database: ${_file}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// rendered target
|
||||
let _target: any = {};
|
||||
|
@ -41,6 +41,13 @@ export async function deleteFavorite(favorite: string | mongo.ObjectID | IFavori
|
||||
});
|
||||
}
|
||||
|
||||
export const packMany = async (
|
||||
favorites: any[],
|
||||
me: any
|
||||
) => {
|
||||
return (await Promise.all(favorites.map(f => pack(f, me)))).filter(x => x != null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pack a favorite for API response
|
||||
*/
|
||||
@ -70,5 +77,11 @@ export const pack = (
|
||||
// Populate note
|
||||
_favorite.note = await packNote(_favorite.noteId, me);
|
||||
|
||||
// (データベースの不具合などで)投稿が見つからなかったら
|
||||
if (_favorite.note == null) {
|
||||
console.warn(`in packaging favorite: note not found on database: ${_favorite.noteId}`);
|
||||
return resolve(null);
|
||||
}
|
||||
|
||||
resolve(_favorite);
|
||||
});
|
||||
|
@ -7,7 +7,7 @@ import { IUser, pack as packUser } from './user';
|
||||
import { pack as packApp } from './app';
|
||||
import PollVote, { deletePollVote } from './poll-vote';
|
||||
import Reaction, { deleteNoteReaction } from './note-reaction';
|
||||
import { pack as packFile, IDriveFile } from './drive-file';
|
||||
import { packMany as packFileMany, IDriveFile } from './drive-file';
|
||||
import NoteWatching, { deleteNoteWatching } from './note-watching';
|
||||
import NoteReaction from './note-reaction';
|
||||
import Favorite, { deleteFavorite } from './favorite';
|
||||
@ -226,6 +226,17 @@ export const hideNote = async (packedNote: any, meId: mongo.ObjectID) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const packMany = async (
|
||||
notes: (string | mongo.ObjectID | INote)[],
|
||||
me?: string | mongo.ObjectID | IUser,
|
||||
options?: {
|
||||
detail?: boolean;
|
||||
skipHide?: boolean;
|
||||
}
|
||||
) => {
|
||||
return (await Promise.all(notes.map(n => pack(n, me, options)))).filter(x => x != null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pack a note for API response
|
||||
*
|
||||
@ -271,7 +282,11 @@ export const pack = async (
|
||||
_note = deepcopy(note);
|
||||
}
|
||||
|
||||
if (!_note) throw `invalid note arg ${note}`;
|
||||
// 投稿がデータベース上に見つからなかったとき
|
||||
if (_note == null) {
|
||||
console.warn(`note not found on database: ${note}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
const id = _note._id;
|
||||
|
||||
@ -294,9 +309,7 @@ export const pack = async (
|
||||
}
|
||||
|
||||
// Populate files
|
||||
_note.files = Promise.all((_note.fileIds || []).map((fileId: mongo.ObjectID) =>
|
||||
packFile(fileId)
|
||||
));
|
||||
_note.files = packFileMany(_note.fileIds || []);
|
||||
|
||||
// 後方互換性のため
|
||||
_note.mediaIds = _note.fileIds;
|
||||
@ -365,6 +378,12 @@ export const pack = async (
|
||||
// resolve promises in _note object
|
||||
_note = await rap(_note);
|
||||
|
||||
// (データベースの欠損などで)ユーザーがデータベース上に見つからなかったとき
|
||||
if (_note.user == null) {
|
||||
console.warn(`in packaging note: note user not found on database: note(${_note.id})`);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_note.user.isCat && _note.text) {
|
||||
_note.text = _note.text.replace(/な/g, 'にゃ').replace(/ナ/g, 'ニャ').replace(/ナ/g, 'ニャ');
|
||||
}
|
||||
|
@ -77,6 +77,12 @@ export async function deleteNotification(notification: string | mongo.ObjectID |
|
||||
});
|
||||
}
|
||||
|
||||
export const packMany = async (
|
||||
notifications: any[]
|
||||
) => {
|
||||
return (await Promise.all(notifications.map(n => pack(n)))).filter(x => x != null);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pack a notification for API response
|
||||
*/
|
||||
@ -123,6 +129,12 @@ export const pack = (notification: any) => new Promise<any>(async (resolve, reje
|
||||
case 'poll_vote':
|
||||
// Populate note
|
||||
_notification.note = await packNote(_notification.noteId, me);
|
||||
|
||||
// (データベースの不具合などで)投稿が見つからなかったら
|
||||
if (_notification.note == null) {
|
||||
console.warn(`in packaging notification: note not found on database: ${_notification.noteId}`);
|
||||
return resolve(null);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.error(`Unknown type: ${_notification.type}`);
|
||||
|
@ -3,7 +3,7 @@ const deepcopy = require('deepcopy');
|
||||
const sequential = require('promise-sequential');
|
||||
import rap from '@prezzemolo/rap';
|
||||
import db from '../db/mongodb';
|
||||
import Note, { pack as packNote, deleteNote } from './note';
|
||||
import Note, { packMany as packNoteMany, deleteNote } from './note';
|
||||
import Following, { deleteFollowing } from './following';
|
||||
import Mute, { deleteMute } from './mute';
|
||||
import { getFriendIds } from '../server/api/common/get-friends';
|
||||
@ -361,9 +361,11 @@ export const pack = (
|
||||
_user = deepcopy(user);
|
||||
}
|
||||
|
||||
// TODO: ここでエラーにするのではなくダミーのユーザーデータを返す
|
||||
// SEE: https://github.com/syuilo/misskey/issues/1432
|
||||
if (!_user) return reject('invalid user arg.');
|
||||
// (データベースの欠損などで)ユーザーがデータベース上に見つからなかったとき
|
||||
if (_user == null) {
|
||||
console.warn(`user not found on database: ${user}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Me
|
||||
const meId: mongo.ObjectID = me
|
||||
@ -468,9 +470,9 @@ export const pack = (
|
||||
if (opts.detail) {
|
||||
if (_user.pinnedNoteIds) {
|
||||
// Populate pinned notes
|
||||
_user.pinnedNotes = Promise.all(_user.pinnedNoteIds.map((id: mongo.ObjectId) => packNote(id, meId, {
|
||||
_user.pinnedNotes = packNoteMany(_user.pinnedNoteIds, meId, {
|
||||
detail: true
|
||||
})));
|
||||
});
|
||||
}
|
||||
|
||||
if (meId && !meId.equals(_user.id)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import DriveFile, { pack } from '../../../../models/drive-file';
|
||||
import DriveFile, { packMany } from '../../../../models/drive-file';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
export const meta = {
|
||||
@ -73,6 +73,5 @@ export default async (params: any, user: ILocalUser) => {
|
||||
});
|
||||
|
||||
// Serialize
|
||||
const _files = await Promise.all(files.map(file => pack(file)));
|
||||
return _files;
|
||||
return await packMany(files);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import DriveFile, { pack } from '../../../../models/drive-file';
|
||||
import DriveFile, { packMany } from '../../../../models/drive-file';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
export const meta = {
|
||||
@ -63,5 +63,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(files.map(file => pack(file))));
|
||||
res(await packMany(files));
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Favorite, { pack } from '../../../../models/favorite';
|
||||
import Favorite, { packMany } from '../../../../models/favorite';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
export const meta = {
|
||||
@ -55,5 +55,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
.find(query, { limit, sort });
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(favorites.map(favorite => pack(favorite, user))));
|
||||
res(await packMany(favorites, user));
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Notification from '../../../../models/notification';
|
||||
import Mute from '../../../../models/mute';
|
||||
import { pack } from '../../../../models/notification';
|
||||
import { packMany } from '../../../../models/notification';
|
||||
import { getFriendIds } from '../../common/get-friends';
|
||||
import read from '../../common/read-notification';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
@ -83,7 +83,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(notifications.map(notification => pack(notification))));
|
||||
res(await packMany(notifications));
|
||||
|
||||
// Mark all as read
|
||||
if (notifications.length > 0 && markAsRead) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'cafy'; import ID from '../../../misc/cafy-id';
|
||||
import Note, { pack } from '../../../models/note';
|
||||
import Note, { packMany } from '../../../models/note';
|
||||
import getParams from '../get-params';
|
||||
|
||||
export const meta = {
|
||||
@ -116,5 +116,5 @@ export default (params: any) => new Promise(async (res, rej) => {
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(notes.map(note => pack(note))));
|
||||
res(await packMany(notes));
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note, { pack, INote } from '../../../../models/note';
|
||||
import Note, { packMany, INote } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
/**
|
||||
@ -52,5 +52,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
}
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(conversation.map(note => pack(note, user))));
|
||||
res(await packMany(conversation, user));
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note from '../../../../models/note';
|
||||
import Mute from '../../../../models/mute';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
import { countIf } from '../../../../prelude/array';
|
||||
@ -113,5 +113,5 @@ export default async (params: any, user: ILocalUser) => {
|
||||
});
|
||||
|
||||
// Serialize
|
||||
return await Promise.all(timeline.map(note => pack(note, user)));
|
||||
return await packMany(timeline, user);
|
||||
};
|
||||
|
@ -2,7 +2,7 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note from '../../../../models/note';
|
||||
import Mute from '../../../../models/mute';
|
||||
import { getFriends } from '../../common/get-friends';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
import { countIf } from '../../../../prelude/array';
|
||||
@ -240,5 +240,5 @@ export default async (params: any, user: ILocalUser) => {
|
||||
});
|
||||
|
||||
// Serialize
|
||||
return await Promise.all(timeline.map(note => pack(note, user)));
|
||||
return await packMany(timeline, user);
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note from '../../../../models/note';
|
||||
import Mute from '../../../../models/mute';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
import { countIf } from '../../../../prelude/array';
|
||||
@ -141,5 +141,5 @@ export default async (params: any, user: ILocalUser) => {
|
||||
});
|
||||
|
||||
// Serialize
|
||||
return await Promise.all(timeline.map(note => pack(note, user)));
|
||||
return await packMany(timeline, user);
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note from '../../../../models/note';
|
||||
import { getFriendIds } from '../../common/get-friends';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
import read from '../../../../services/note/read';
|
||||
@ -89,5 +89,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
mentions.forEach(note => read(user._id, note._id));
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(mentions.map(mention => pack(mention, user))));
|
||||
res(await packMany(mentions, user));
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note, { pack } from '../../../../models/note';
|
||||
import Note, { packMany } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
/**
|
||||
@ -30,5 +30,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
const ids = (note._replyIds || []).slice(offset, offset + limit);
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(ids.map(id => pack(id, user))));
|
||||
res(await packMany(ids, user));
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note, { pack } from '../../../../models/note';
|
||||
import Note, { packMany } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
|
||||
/**
|
||||
@ -62,6 +62,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(renotes.map(async note =>
|
||||
await pack(note, user))));
|
||||
res(await packMany(renotes, user));
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import $ from 'cafy';
|
||||
import * as mongo from 'mongodb';
|
||||
import Note from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import es from '../../../../db/elasticsearch';
|
||||
|
||||
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
||||
@ -60,6 +60,6 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
||||
}
|
||||
});
|
||||
|
||||
res(await Promise.all(notes.map(note => pack(note, me))));
|
||||
res(await packMany(notes, me));
|
||||
});
|
||||
});
|
||||
|
@ -3,7 +3,7 @@ import Note from '../../../../models/note';
|
||||
import User, { ILocalUser } from '../../../../models/user';
|
||||
import Mute from '../../../../models/mute';
|
||||
import { getFriendIds } from '../../common/get-friends';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import getParams from '../../get-params';
|
||||
import { erase } from '../../../../prelude/array';
|
||||
|
||||
@ -363,5 +363,5 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(notes.map(note => pack(note, me))));
|
||||
res(await packMany(notes, me));
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note from '../../../../models/note';
|
||||
import Mute from '../../../../models/mute';
|
||||
import { getFriends } from '../../common/get-friends';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
import { countIf } from '../../../../prelude/array';
|
||||
@ -237,5 +237,5 @@ export default async (params: any, user: ILocalUser) => {
|
||||
});
|
||||
|
||||
// Serialize
|
||||
return await Promise.all(timeline.map(note => pack(note, user)));
|
||||
return await packMany(timeline, user);
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import Note from '../../../../models/note';
|
||||
import Mute from '../../../../models/mute';
|
||||
import { pack } from '../../../../models/note';
|
||||
import { packMany } from '../../../../models/note';
|
||||
import UserList from '../../../../models/user-list';
|
||||
import { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
@ -242,5 +242,5 @@ export default async (params: any, user: ILocalUser) => {
|
||||
});
|
||||
|
||||
// Serialize
|
||||
return await Promise.all(timeline.map(note => pack(note, user)));
|
||||
return await packMany(timeline, user);
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||
import getHostLower from '../../common/get-host-lower';
|
||||
import Note, { pack } from '../../../../models/note';
|
||||
import Note, { packMany } from '../../../../models/note';
|
||||
import User, { ILocalUser } from '../../../../models/user';
|
||||
import getParams from '../../get-params';
|
||||
import { countIf } from '../../../../prelude/array';
|
||||
@ -181,5 +181,5 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
||||
});
|
||||
|
||||
// Serialize
|
||||
res(await Promise.all(notes.map(note => pack(note, me))));
|
||||
res(await packMany(notes, me));
|
||||
});
|
||||
|
Reference in New Issue
Block a user