summaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/models')
-rw-r--r--src/models/meta.ts1
-rw-r--r--src/models/note.ts13
2 files changed, 9 insertions, 5 deletions
diff --git a/src/models/meta.ts b/src/models/meta.ts
index 5351c17c52..bea4714bf7 100644
--- a/src/models/meta.ts
+++ b/src/models/meta.ts
@@ -194,6 +194,7 @@ export type IMeta = {
disableRegistration?: boolean;
disableLocalTimeline?: boolean;
disableGlobalTimeline?: boolean;
+ enableEmojiReaction?: boolean;
hidedTags?: string[];
mascotImageUrl?: string;
bannerUrl?: string;
diff --git a/src/models/note.ts b/src/models/note.ts
index 369a009162..af45ff966d 100644
--- a/src/models/note.ts
+++ b/src/models/note.ts
@@ -12,6 +12,7 @@ import { packMany as packFileMany, IDriveFile } from './drive-file';
import Following from './following';
import Emoji from './emoji';
import { dbLogger } from '../db/logger';
+import { unique, concat } from '../prelude/array';
const Note = db.get<INote>('notes');
Note.createIndex('uri', { sparse: true, unique: true });
@@ -242,6 +243,11 @@ export const pack = async (
const id = _note._id;
+ // Some counts
+ _note.renoteCount = _note.renoteCount || 0;
+ _note.repliesCount = _note.repliesCount || 0;
+ _note.reactionCounts = _note.reactionCounts || {};
+
// _note._userを消す前か、_note.userを解決した後でないとホストがわからない
if (_note._user) {
const host = _note._user.host;
@@ -253,6 +259,8 @@ export const pack = async (
fields: { _id: false }
});
} else {
+ _note.emojis = unique(concat([_note.emojis, Object.keys(_note.reactionCounts)]));
+
_note.emojis = Emoji.find({
name: { $in: _note.emojis },
host: host
@@ -290,11 +298,6 @@ export const pack = async (
// Populate files
_note.files = packFileMany(_note.fileIds || []);
- // Some counts
- _note.renoteCount = _note.renoteCount || 0;
- _note.repliesCount = _note.repliesCount || 0;
- _note.reactionCounts = _note.reactionCounts || {};
-
// 後方互換性のため
_note.mediaIds = _note.fileIds;
_note.media = _note.files;