Store texts as HTML

This commit is contained in:
Akihiko Odaki
2018-03-31 19:53:30 +09:00
parent 8c41432907
commit 7da60a0147
31 changed files with 318 additions and 283 deletions

View File

@ -11,6 +11,8 @@ import DriveFile from '../../../../../models/drive-file';
import { pack } from '../../../../../models/messaging-message';
import publishUserStream from '../../../event';
import { publishMessagingStream, publishMessagingIndexStream, pushSw } from '../../../event';
import html from '../../../../../common/text/html';
import parse from '../../../../../common/text/parse';
import config from '../../../../../conf';
/**
@ -74,6 +76,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
fileId: file ? file._id : undefined,
recipientId: recipient._id,
text: text ? text : undefined,
textHtml: text ? html(parse(text)) : undefined,
userId: user._id,
isRead: false
});

View File

@ -3,7 +3,8 @@
*/
import $ from 'cafy';
import deepEqual = require('deep-equal');
import parse from '../../../../common/text';
import html from '../../../../common/text/html';
import parse from '../../../../common/text/parse';
import { default as Post, IPost, isValidText, isValidCw } from '../../../../models/post';
import { default as User, ILocalAccount, IUser } from '../../../../models/user';
import { default as Channel, IChannel } from '../../../../models/channel';
@ -259,6 +260,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
repostId: repost ? repost._id : undefined,
poll: poll,
text: text,
textHtml: tokens === null ? null : html(tokens),
cw: cw,
tags: tags,
userId: user._id,