Custom reaction (#4517)
* Custom reaction
* increase limit of reactions/delete
* リアクションの場合は OS標準の絵文字を使用 を迂回する
* カスタムリアクションを無効にする設定
* fix
* disableCustomReaction --> enableEmojiReaction
* Avoid MFM rendering
* 🎨
* 🎨
* Auto accept
* custom emoji reaction
* Improve usability
* Extract emojiRegex
* Fix
* Clean up
* 🎨
* 🎨
* toDbReaction で reaction は必須に
あとフォールバックは like に
* Clean up
* Make required
* 3eb08748fe (r266241728)
* Refactor
* Allow null
This commit is contained in:
@ -194,6 +194,7 @@ export type IMeta = {
|
||||
disableRegistration?: boolean;
|
||||
disableLocalTimeline?: boolean;
|
||||
disableGlobalTimeline?: boolean;
|
||||
enableEmojiReaction?: boolean;
|
||||
hidedTags?: string[];
|
||||
mascotImageUrl?: string;
|
||||
bannerUrl?: string;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user