mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Filtered out non-follower activities on home feed of the admin-x-activitypub
app (#21362)
refs [AP-477](https://linear.app/ghost/issue/AP-477/incorrect-posts-in-home-feed) Filtered out non-follower activities on home feed of the `admin-x-activitypub` app
This commit is contained in:
parent
f7fbb6edcd
commit
e75de41eac
3 changed files with 8 additions and 1 deletions
|
@ -245,6 +245,7 @@ export class ActivityPubAPI {
|
|||
async getActivities(
|
||||
includeOwn: boolean = false,
|
||||
includeReplies: boolean = false,
|
||||
excludeNonFollowers: boolean = false,
|
||||
filter: {type?: string[]} | null = null,
|
||||
cursor?: string
|
||||
): Promise<{data: Activity[], nextCursor: string | null}> {
|
||||
|
@ -258,6 +259,9 @@ export class ActivityPubAPI {
|
|||
if (includeReplies) {
|
||||
url.searchParams.set('includeReplies', includeReplies.toString());
|
||||
}
|
||||
if (excludeNonFollowers) {
|
||||
url.searchParams.set('excludeNonFollowers', excludeNonFollowers.toString());
|
||||
}
|
||||
if (filter) {
|
||||
url.searchParams.set('filter', JSON.stringify(filter));
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ const Inbox: React.FC<InboxProps> = ({}) => {
|
|||
} = useActivitiesForUser({
|
||||
handle: 'index',
|
||||
includeReplies: true,
|
||||
excludeNonFollowers: true,
|
||||
filter: {
|
||||
type: ['Create:Article:notReply', 'Create:Note:notReply', 'Announce:Note']
|
||||
}
|
||||
|
|
|
@ -218,11 +218,13 @@ export function useActivitiesForUser({
|
|||
handle,
|
||||
includeOwn = false,
|
||||
includeReplies = false,
|
||||
excludeNonFollowers = false,
|
||||
filter = null
|
||||
}: {
|
||||
handle: string;
|
||||
includeOwn?: boolean;
|
||||
includeReplies?: boolean;
|
||||
excludeNonFollowers?: boolean;
|
||||
filter?: {type?: string[]} | null;
|
||||
}) {
|
||||
return useInfiniteQuery({
|
||||
|
@ -230,7 +232,7 @@ export function useActivitiesForUser({
|
|||
async queryFn({pageParam}: {pageParam?: string}) {
|
||||
const siteUrl = await getSiteUrl();
|
||||
const api = createActivityPubAPI(handle, siteUrl);
|
||||
return api.getActivities(includeOwn, includeReplies, filter, pageParam);
|
||||
return api.getActivities(includeOwn, includeReplies, excludeNonFollowers, filter, pageParam);
|
||||
},
|
||||
getNextPageParam(prevPage) {
|
||||
return prevPage.nextCursor;
|
||||
|
|
Loading…
Add table
Reference in a new issue