mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 21:13:08 +02:00
Fix AP Announce detection (#2672)
This commit is contained in:
parent
424625846e
commit
ea4e2da58d
3 changed files with 3 additions and 4 deletions
|
@ -4,9 +4,8 @@ import parse from '../../../mfm/parse';
|
||||||
import config from '../../../config';
|
import config from '../../../config';
|
||||||
|
|
||||||
export default function(note: INote) {
|
export default function(note: INote) {
|
||||||
if (note.text == null) return null;
|
|
||||||
|
|
||||||
let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
|
let html = toHtml(parse(note.text), note.mentionedRemoteUsers);
|
||||||
|
if (html == null) html = '';
|
||||||
|
|
||||||
if (note.poll != null) {
|
if (note.poll != null) {
|
||||||
const url = `${config.url}/notes/${note._id}`;
|
const url = `${config.url}/notes/${note._id}`;
|
||||||
|
|
|
@ -105,7 +105,7 @@ export default async (ctx: Router.IRouterContext) => {
|
||||||
* @param note Note
|
* @param note Note
|
||||||
*/
|
*/
|
||||||
export async function packActivity(note: INote): Promise<object> {
|
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);
|
const renote = await Note.findOne(note.renoteId);
|
||||||
return renderAnnounce(renote.uri ? renote.uri : `${config.url}/notes/${renote._id}`, note);
|
return renderAnnounce(renote.uri ? renote.uri : `${config.url}/notes/${renote._id}`, note);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,7 +239,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
||||||
});
|
});
|
||||||
|
|
||||||
async function renderActivity(data: Option, note: INote) {
|
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)
|
? renderAnnounce(data.renote.uri ? data.renote.uri : `${config.url}/notes/${data.renote._id}`, note)
|
||||||
: renderCreate(await renderNote(note, false), note);
|
: renderCreate(await renderNote(note, false), note);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue