[backend/akko-api] Fix IsPleroma flag not being used correctly

This commit is contained in:
Laura Hausmann 2025-03-23 00:05:35 +01:00
parent 2e911805de
commit 2c3a9d49b1
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 9 additions and 7 deletions

View file

@ -20,11 +20,10 @@ public class NoteRenderer(
MfmConverter mfmConverter,
DatabaseContext db,
EmojiService emojiSvc,
AttachmentRenderer attachmentRenderer
AttachmentRenderer attachmentRenderer,
FlagService flags
) : IScopedService
{
public bool IsPleroma;
private static readonly FilterResultEntity InaccessibleFilter = new()
{
Filter = new FilterEntity
@ -172,9 +171,11 @@ public class NoteRenderer(
? (data?.Polls ?? await GetPollsAsync([note], user)).FirstOrDefault(p => p.Id == note.Id)
: null;
var visibility = IsPleroma && note.LocalOnly ? "local" : StatusEntity.EncodeVisibility(note.Visibility);
var visibility = flags.IsPleroma.Value && note.LocalOnly
? "local"
: StatusEntity.EncodeVisibility(note.Visibility);
var pleromaExtensions = IsPleroma
var pleromaExtensions = flags.IsPleroma.Value
? new PleromaStatusExtensions
{
LocalOnly = note.LocalOnly,

View file

@ -14,7 +14,8 @@ public class NotificationRenderer(
IOptions<Config.InstanceSection> instance,
DatabaseContext db,
NoteRenderer noteRenderer,
UserRenderer userRenderer
UserRenderer userRenderer,
FlagService flags
) : IScopedService
{
public async Task<NotificationEntity> RenderAsync(
@ -62,7 +63,7 @@ public class NotificationRenderer(
CreatedAt = notification.CreatedAt.ToStringIso8601Like(),
Emoji = notification.Reaction,
EmojiUrl = emojiUrl,
Pleroma = noteRenderer.IsPleroma ? new PleromaNotificationExtensions { IsSeen = notification.IsRead } : null
Pleroma = flags.IsPleroma.Value ? new PleromaNotificationExtensions { IsSeen = notification.IsRead } : null
};
return res;