[backend/federation] Fetch featured notes as following user, if one is available (ISH-262)
This is the same logic Mastodon uses to ensure follower-only pinned notes can be resolved.
This commit is contained in:
parent
08ced32e4d
commit
933361b0c6
1 changed files with 5 additions and 5 deletions
|
@ -1228,12 +1228,12 @@ public class NoteService(
|
|||
collection = await objectResolver.ResolveObject(collection, force: true) as ASOrderedCollection;
|
||||
if (collection is not { Items: not null }) return;
|
||||
|
||||
var items = await collection.Items.Take(10)
|
||||
.Select(p => objectResolver.ResolveObject(p))
|
||||
// ReSharper disable once EntityFramework.UnsupportedServerSideFunctionCall
|
||||
var followingUser = await db.Users.FirstOrDefaultAsync(p => p.IsFollowing(user));
|
||||
var notes = await collection.Items.Take(10)
|
||||
.Select(p => ResolveNoteAsync(p.Id, null, followingUser, true))
|
||||
.AwaitAllNoConcurrencyAsync();
|
||||
var notes = await items.OfType<ASNote>()
|
||||
.Select(p => ResolveNoteAsync(p.Id, p, null, true))
|
||||
.AwaitAllNoConcurrencyAsync();
|
||||
|
||||
var previousPins = await db.Users.Where(p => p.Id == user.Id)
|
||||
.Select(p => p.PinnedNotes.Select(i => i.Id))
|
||||
.FirstOrDefaultAsync() ?? [];
|
||||
|
|
Loading…
Add table
Reference in a new issue