Fix AP Announce detection (#2672)

This commit is contained in:
MeiMei 2018-09-09 02:59:14 +09:00 committed by syuilo
parent 424625846e
commit ea4e2da58d
3 changed files with 3 additions and 4 deletions

View File

@ -4,9 +4,8 @@ import parse from '../../../mfm/parse';
import config from '../../../config';
export default function(note: INote) {
if (note.text == null) return null;
let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
if (html == null) html = '';
if (note.poll != null) {
const url = `${config.url}/notes/${note._id}`;

View File

@ -105,7 +105,7 @@ export default async (ctx: Router.IRouterContext) => {
* @param note Note
*/
export async function packActivity(note: INote): Promise<object> {
if (note.renoteId && note.text == null) {
if (note.renoteId && note.text == null && note.poll == null && (note.fileIds == null || note.fileIds.length == 0)) {
const renote = await Note.findOne(note.renoteId);
return renderAnnounce(renote.uri ? renote.uri : `${config.url}/notes/${renote._id}`, note);
}

View File

@ -239,7 +239,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
});
async function renderActivity(data: Option, note: INote) {
const content = data.renote && data.text == null
const content = data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length == 0)
? renderAnnounce(data.renote.uri ? data.renote.uri : `${config.url}/notes/${data.renote._id}`, note)
: renderCreate(await renderNote(note, false), note);