fix: include local user itself

This commit is contained in:
Namekuji 2023-08-12 03:08:38 -04:00
parent dbea0ee6fd
commit 6c0c6c7ad7
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
2 changed files with 8 additions and 5 deletions

View file

@ -116,7 +116,7 @@ export default define(meta, paramDef, async (ps, user) => {
UserBlockedCache.init(user.id).then((cache) => cache.getAll()),
RenoteMutingsCache.init(user.id).then((cache) => cache.getAll()),
]);
const validUserIds = [user.id].concat(followingUserIds);
const validUserIds = [user.id, ...followingUserIds];
const optFilter = (n: ScyllaNote) =>
!n.renoteId || !!n.text || n.files.length > 0 || n.hasPoll;
@ -154,10 +154,9 @@ export default define(meta, paramDef, async (ps, user) => {
const foundPacked = [];
while (foundPacked.length < ps.limit) {
const foundNotes = (await execNotePaginationQuery("home", ps, filter, user.id)).slice(
0,
ps.limit * 1.5,
); // Some may filtered out by Notes.packMany, thus we take more than ps.limit.
const foundNotes = (
await execNotePaginationQuery("home", ps, filter, user.id)
).slice(0, ps.limit * 1.5); // Some may filtered out by Notes.packMany, thus we take more than ps.limit.
foundPacked.push(
...(await Notes.packMany(foundNotes, user, { scyllaNote: true })),
);

View file

@ -845,6 +845,10 @@ async function insertNote(
const localFollowers = await LocalFollowersCache.init(user.id).then(
(cache) => cache.getAll(),
);
if (Users.isLocalUser(user)) {
// Include the local user itself
localFollowers.push(user.id);
}
// Do not issue BATCH because different queries of inserting post to home timelines involve different partitions
for (const follower of localFollowers) {
// no need to wait