[backend/federation] ASNote.Subject should be text, not html

This commit is contained in:
Laura Hausmann 2024-02-18 21:02:55 +01:00
parent 7824182371
commit 6c90d0554e
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 4 additions and 5 deletions

View file

@ -96,9 +96,7 @@ public class NoteRenderer(IOptions<Config.InstanceSection> config, MfmConverter
Content = note.Text != null
? await mfmConverter.ToHtmlAsync(note.Text, mentions, note.UserHost)
: null,
Summary = note.Cw != null
? await mfmConverter.ToHtmlAsync(note.Cw, mentions, note.UserHost)
: null,
Summary = note.Cw,
Source = note.Text != null
? new ASNoteSource { Content = note.Text, MediaType = "text/x.misskeymarkdown" }
: null

View file

@ -272,7 +272,7 @@ public class NoteService(
Uri = note.Id,
Url = note.Url?.Id, //FIXME: this doesn't seem to work yet
Text = note.MkContent ?? await mfmConverter.FromHtmlAsync(note.Content, mentions),
Cw = await mfmConverter.FromHtmlAsync(note.Summary), //TODO: mentions parsing?
Cw = note.Summary,
UserId = user.Id,
CreatedAt = createdAt,
UserHost = user.Host,
@ -363,7 +363,7 @@ public class NoteService(
mentionedLocalUserIds = mentionedLocalUserIds.Except(previousMentionedLocalUserIds).ToList();
dbNote.Text = note.MkContent ?? await mfmConverter.FromHtmlAsync(note.Content, mentions);
dbNote.Cw = await mfmConverter.FromHtmlAsync(note.Summary); //TODO: mentions parsing?
dbNote.Cw = note.Summary;
if (dbNote.Cw is { Length: > 100000 })
throw GracefulException.UnprocessableEntity("Summary cannot be longer than 100.000 characters");
@ -531,6 +531,7 @@ public class NoteService(
logger.LogDebug("Failed to fetch note, skipping");
return null;
}
if (fetchedNote.AttributedTo is not [{ Id: not null } attrTo])
{
logger.LogDebug("Invalid Note.AttributedTo, skipping");