[backend/akko-api] Fix IsPleroma flag not being used correctly
This commit is contained in:
parent
2e911805de
commit
2c3a9d49b1
2 changed files with 9 additions and 7 deletions
|
@ -20,11 +20,10 @@ public class NoteRenderer(
|
||||||
MfmConverter mfmConverter,
|
MfmConverter mfmConverter,
|
||||||
DatabaseContext db,
|
DatabaseContext db,
|
||||||
EmojiService emojiSvc,
|
EmojiService emojiSvc,
|
||||||
AttachmentRenderer attachmentRenderer
|
AttachmentRenderer attachmentRenderer,
|
||||||
|
FlagService flags
|
||||||
) : IScopedService
|
) : IScopedService
|
||||||
{
|
{
|
||||||
public bool IsPleroma;
|
|
||||||
|
|
||||||
private static readonly FilterResultEntity InaccessibleFilter = new()
|
private static readonly FilterResultEntity InaccessibleFilter = new()
|
||||||
{
|
{
|
||||||
Filter = new FilterEntity
|
Filter = new FilterEntity
|
||||||
|
@ -172,9 +171,11 @@ public class NoteRenderer(
|
||||||
? (data?.Polls ?? await GetPollsAsync([note], user)).FirstOrDefault(p => p.Id == note.Id)
|
? (data?.Polls ?? await GetPollsAsync([note], user)).FirstOrDefault(p => p.Id == note.Id)
|
||||||
: null;
|
: 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
|
? new PleromaStatusExtensions
|
||||||
{
|
{
|
||||||
LocalOnly = note.LocalOnly,
|
LocalOnly = note.LocalOnly,
|
||||||
|
|
|
@ -14,7 +14,8 @@ public class NotificationRenderer(
|
||||||
IOptions<Config.InstanceSection> instance,
|
IOptions<Config.InstanceSection> instance,
|
||||||
DatabaseContext db,
|
DatabaseContext db,
|
||||||
NoteRenderer noteRenderer,
|
NoteRenderer noteRenderer,
|
||||||
UserRenderer userRenderer
|
UserRenderer userRenderer,
|
||||||
|
FlagService flags
|
||||||
) : IScopedService
|
) : IScopedService
|
||||||
{
|
{
|
||||||
public async Task<NotificationEntity> RenderAsync(
|
public async Task<NotificationEntity> RenderAsync(
|
||||||
|
@ -62,7 +63,7 @@ public class NotificationRenderer(
|
||||||
CreatedAt = notification.CreatedAt.ToStringIso8601Like(),
|
CreatedAt = notification.CreatedAt.ToStringIso8601Like(),
|
||||||
Emoji = notification.Reaction,
|
Emoji = notification.Reaction,
|
||||||
EmojiUrl = emojiUrl,
|
EmojiUrl = emojiUrl,
|
||||||
Pleroma = noteRenderer.IsPleroma ? new PleromaNotificationExtensions { IsSeen = notification.IsRead } : null
|
Pleroma = flags.IsPleroma.Value ? new PleromaNotificationExtensions { IsSeen = notification.IsRead } : null
|
||||||
};
|
};
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Add table
Reference in a new issue