[backend/api] Mark entire note as sensitive when any attachments are marked as such
This commit is contained in:
parent
1dc942c78c
commit
248543528b
1 changed files with 4 additions and 2 deletions
|
@ -115,6 +115,8 @@ public class NoteRenderer(IOptions<Config.InstanceSection> config, MfmConverter
|
||||||
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 sensitive = note.Cw != null || (attachments?.OfType<ASDocument>().Any(p => p.Sensitive == true) ?? false);
|
||||||
|
|
||||||
if (note.HasPoll)
|
if (note.HasPoll)
|
||||||
{
|
{
|
||||||
var poll = await db.Polls.FirstOrDefaultAsync(p => p.Note == note);
|
var poll = await db.Polls.FirstOrDefaultAsync(p => p.Note == note);
|
||||||
|
@ -145,7 +147,7 @@ public class NoteRenderer(IOptions<Config.InstanceSection> config, MfmConverter
|
||||||
MkContent = note.Text,
|
MkContent = note.Text,
|
||||||
PublishedAt = note.CreatedAt,
|
PublishedAt = note.CreatedAt,
|
||||||
UpdatedAt = note.UpdatedAt,
|
UpdatedAt = note.UpdatedAt,
|
||||||
Sensitive = note.Cw != null,
|
Sensitive = sensitive,
|
||||||
InReplyTo = replyId,
|
InReplyTo = replyId,
|
||||||
Cc = cc,
|
Cc = cc,
|
||||||
To = to,
|
To = to,
|
||||||
|
@ -175,7 +177,7 @@ public class NoteRenderer(IOptions<Config.InstanceSection> config, MfmConverter
|
||||||
MkContent = note.Text,
|
MkContent = note.Text,
|
||||||
PublishedAt = note.CreatedAt,
|
PublishedAt = note.CreatedAt,
|
||||||
UpdatedAt = note.UpdatedAt,
|
UpdatedAt = note.UpdatedAt,
|
||||||
Sensitive = note.Cw != null,
|
Sensitive = sensitive,
|
||||||
InReplyTo = replyId,
|
InReplyTo = replyId,
|
||||||
Cc = cc,
|
Cc = cc,
|
||||||
To = to,
|
To = to,
|
||||||
|
|
Loading…
Add table
Reference in a new issue