[backend/federation] Set MkContent to empty string when quote without text is rendered
This commit is contained in:
parent
4ed6e305b6
commit
729e32594b
1 changed files with 7 additions and 6 deletions
|
@ -131,6 +131,7 @@ public class NoteRenderer(
|
||||||
|
|
||||||
var quoteUri = note.IsQuote ? note.Renote?.Uri ?? note.Renote?.GetPublicUriOrNull(config.Value) : null;
|
var quoteUri = note.IsQuote ? note.Renote?.Uri ?? note.Renote?.GetPublicUriOrNull(config.Value) : null;
|
||||||
var text = quoteUri != null ? note.Text + $"\n\nRE: {quoteUri}" : note.Text;
|
var text = quoteUri != null ? note.Text + $"\n\nRE: {quoteUri}" : note.Text;
|
||||||
|
var rawText = note.Text ?? (note.IsQuote ? "" : null);
|
||||||
|
|
||||||
if (quoteUri != null)
|
if (quoteUri != null)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +171,7 @@ public class NoteRenderer(
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
AttributedTo = [new ASObjectBase(userId)],
|
AttributedTo = [new ASObjectBase(userId)],
|
||||||
MkContent = note.Text,
|
MkContent = rawText,
|
||||||
PublishedAt = note.CreatedAt,
|
PublishedAt = note.CreatedAt,
|
||||||
UpdatedAt = note.UpdatedAt,
|
UpdatedAt = note.UpdatedAt,
|
||||||
Sensitive = sensitive,
|
Sensitive = sensitive,
|
||||||
|
@ -183,8 +184,8 @@ public class NoteRenderer(
|
||||||
Attachments = attachments,
|
Attachments = attachments,
|
||||||
Content = text != null ? (await mfmConverter.ToHtmlAsync(text, mentions, note.UserHost, media: inlineMedia)).Html : null,
|
Content = text != null ? (await mfmConverter.ToHtmlAsync(text, mentions, note.UserHost, media: inlineMedia)).Html : null,
|
||||||
Summary = note.Cw,
|
Summary = note.Cw,
|
||||||
Source = note.Text != null
|
Source = rawText != null
|
||||||
? new ASNoteSource { Content = note.Text, MediaType = "text/x.misskeymarkdown" }
|
? new ASNoteSource { Content = rawText, MediaType = "text/x.misskeymarkdown" }
|
||||||
: null,
|
: null,
|
||||||
MkQuote = quoteUri,
|
MkQuote = quoteUri,
|
||||||
QuoteUri = quoteUri,
|
QuoteUri = quoteUri,
|
||||||
|
@ -202,7 +203,7 @@ public class NoteRenderer(
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
AttributedTo = [new ASObjectBase(userId)],
|
AttributedTo = [new ASObjectBase(userId)],
|
||||||
MkContent = note.Text,
|
MkContent = rawText,
|
||||||
PublishedAt = note.CreatedAt,
|
PublishedAt = note.CreatedAt,
|
||||||
UpdatedAt = note.UpdatedAt,
|
UpdatedAt = note.UpdatedAt,
|
||||||
Sensitive = sensitive,
|
Sensitive = sensitive,
|
||||||
|
@ -215,8 +216,8 @@ public class NoteRenderer(
|
||||||
Attachments = attachments,
|
Attachments = attachments,
|
||||||
Content = text != null ? (await mfmConverter.ToHtmlAsync(text, mentions, note.UserHost, media: inlineMedia)).Html : null,
|
Content = text != null ? (await mfmConverter.ToHtmlAsync(text, mentions, note.UserHost, media: inlineMedia)).Html : null,
|
||||||
Summary = note.Cw,
|
Summary = note.Cw,
|
||||||
Source = note.Text != null
|
Source = rawText != null
|
||||||
? new ASNoteSource { Content = note.Text, MediaType = "text/x.misskeymarkdown" }
|
? new ASNoteSource { Content = rawText, MediaType = "text/x.misskeymarkdown" }
|
||||||
: null,
|
: null,
|
||||||
MkQuote = quoteUri,
|
MkQuote = quoteUri,
|
||||||
QuoteUri = quoteUri,
|
QuoteUri = quoteUri,
|
||||||
|
|
Loading…
Add table
Reference in a new issue