Emoji support in profile (#3514)

* Emoji in profile

* Add emojis to fields
This commit is contained in:
MeiMei 2018-12-06 10:02:04 +09:00 committed by syuilo
parent fe891da886
commit 4522568749
41 changed files with 261 additions and 70 deletions

View file

@ -11,6 +11,7 @@ import { getFriendIds } from '../server/api/common/get-friends';
import config from '../config';
import FollowRequest from './follow-request';
import fetchMeta from '../misc/fetch-meta';
import Emoji from './emoji';
const User = db.get<IUser>('users');
@ -46,6 +47,7 @@ type IUserBase = {
description: string;
lang?: string;
pinnedNoteIds: mongo.ObjectID[];
emojis?: string[];
/**
*
@ -247,6 +249,7 @@ export const pack = (
host: true,
avatarColor: true,
avatarUrl: true,
emojis: true,
isCat: true,
isBot: true,
isAdmin: true,
@ -377,6 +380,16 @@ export const pack = (
delete _user.hasUnreadMentions;
}
// カスタム絵文字添付
if (_user.emojis) {
_user.emojis = Emoji.find({
name: { $in: _user.emojis },
host: _user.host
}, {
fields: { _id: false }
});
}
// resolve promises in _user object
_user = await rap(_user);