diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index cd7e44296e..a6d764bf37 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -27,6 +27,11 @@ export const paramDef = { properties: { limit: { type: "integer", minimum: 1, maximum: 100, default: 10 }, offset: { type: "integer", default: 0 }, + origin: { + type: "string", + enum: ["combined", "local", "remote"], + default: "local", + }, }, required: [], } as const; @@ -37,7 +42,7 @@ export default define(meta, paramDef, async (ps, user) => { const query = Notes.createQueryBuilder("note") .addSelect("note.score") - .where("note.userHost IS NULL") + // .where("note.userHost IS NULL") .andWhere("note.score > 0") .andWhere("note.createdAt > :date", { date: new Date(Date.now() - day) }) .andWhere("note.visibility = 'public'") @@ -53,6 +58,15 @@ export default define(meta, paramDef, async (ps, user) => { .leftJoinAndSelect("renoteUser.avatar", "renoteUserAvatar") .leftJoinAndSelect("renoteUser.banner", "renoteUserBanner"); + switch (ps.origin) { + case "local": + query.andWhere("note.userHost IS NULL"); + break; + case "remote": + query.andWhere("note.userHost IS NOT NULL"); + break; + } + if (user) generateMutedUserQuery(query, user); if (user) generateBlockedUserQuery(query, user); diff --git a/packages/client/src/pages/explore.featured.vue b/packages/client/src/pages/explore.featured.vue index 18a371a086..37dbb4b0c3 100644 --- a/packages/client/src/pages/explore.featured.vue +++ b/packages/client/src/pages/explore.featured.vue @@ -1,11 +1,11 @@ @@ -14,17 +14,24 @@ import XNotes from '@/components/MkNotes.vue'; import MkTab from '@/components/MkTab.vue'; import { i18n } from '@/i18n'; -const paginationForNotes = { +const paginationForLocal = { endpoint: 'notes/featured' as const, limit: 10, offsetMode: true, }; -const paginationForPolls = { - endpoint: 'notes/polls/recommendation' as const, +const paginationForRemote = { + endpoint: 'notes/featured' as const, limit: 10, + origin: 'remote', offsetMode: true, -}; +} + +// const paginationForRemote = { +// endpoint: 'notes/polls/recommendation' as const, +// limit: 10, +// offsetMode: true, +// }; let tab = $ref('notes');