mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Increased the number of notifications retrieved in admin-x-activitypub
(#21925)
refs [AP-626](https://linear.app/ghost/issue/AP-626/wrong-posts-showing-up-in-notifications) Increased the number of notifications retrieved in `admin-x-activitypub` to account for notifications being grouped and reduce the amount of time waiting on requests to finish (by making fewer requests)
This commit is contained in:
parent
c438f9442f
commit
e08959a1b5
4 changed files with 9 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@tryghost/admin-x-activitypub",
|
"name": "@tryghost/admin-x-activitypub",
|
||||||
"version": "0.3.40",
|
"version": "0.3.41",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -214,12 +214,13 @@ export class ActivityPubAPI {
|
||||||
includeOwn: boolean = false,
|
includeOwn: boolean = false,
|
||||||
includeReplies: boolean = false,
|
includeReplies: boolean = false,
|
||||||
filter: {type?: string[]} | null = null,
|
filter: {type?: string[]} | null = null,
|
||||||
|
limit: number = 50,
|
||||||
cursor?: string
|
cursor?: string
|
||||||
): Promise<{data: Activity[], next: string | null}> {
|
): Promise<{data: Activity[], next: string | null}> {
|
||||||
const LIMIT = 50;
|
|
||||||
|
|
||||||
const url = new URL(this.activitiesApiUrl);
|
const url = new URL(this.activitiesApiUrl);
|
||||||
url.searchParams.set('limit', LIMIT.toString());
|
|
||||||
|
url.searchParams.set('limit', limit.toString());
|
||||||
|
|
||||||
if (includeOwn) {
|
if (includeOwn) {
|
||||||
url.searchParams.set('includeOwn', includeOwn.toString());
|
url.searchParams.set('includeOwn', includeOwn.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,6 +185,7 @@ const Activities: React.FC<ActivitiesProps> = ({}) => {
|
||||||
filter: {
|
filter: {
|
||||||
type: ['Follow', 'Like', `Create:Note`]
|
type: ['Follow', 'Like', `Create:Note`]
|
||||||
},
|
},
|
||||||
|
limit: 250,
|
||||||
key: GET_ACTIVITIES_QUERY_KEY_NOTIFICATIONS
|
key: GET_ACTIVITIES_QUERY_KEY_NOTIFICATIONS
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -267,12 +267,14 @@ export function useActivitiesForUser({
|
||||||
includeOwn = false,
|
includeOwn = false,
|
||||||
includeReplies = false,
|
includeReplies = false,
|
||||||
filter = null,
|
filter = null,
|
||||||
|
limit = undefined,
|
||||||
key = null
|
key = null
|
||||||
}: {
|
}: {
|
||||||
handle: string;
|
handle: string;
|
||||||
includeOwn?: boolean;
|
includeOwn?: boolean;
|
||||||
includeReplies?: boolean;
|
includeReplies?: boolean;
|
||||||
filter?: {type?: string[]} | null;
|
filter?: {type?: string[]} | null;
|
||||||
|
limit?: number;
|
||||||
key?: string | null;
|
key?: string | null;
|
||||||
}) {
|
}) {
|
||||||
const queryKey = [`activities:${handle}`, key, {includeOwn, includeReplies, filter}];
|
const queryKey = [`activities:${handle}`, key, {includeOwn, includeReplies, filter}];
|
||||||
|
@ -283,7 +285,7 @@ export function useActivitiesForUser({
|
||||||
async queryFn({pageParam}: {pageParam?: string}) {
|
async queryFn({pageParam}: {pageParam?: string}) {
|
||||||
const siteUrl = await getSiteUrl();
|
const siteUrl = await getSiteUrl();
|
||||||
const api = createActivityPubAPI(handle, siteUrl);
|
const api = createActivityPubAPI(handle, siteUrl);
|
||||||
return api.getActivities(includeOwn, includeReplies, filter, pageParam);
|
return api.getActivities(includeOwn, includeReplies, filter, limit, pageParam);
|
||||||
},
|
},
|
||||||
getNextPageParam(prevPage) {
|
getNextPageParam(prevPage) {
|
||||||
return prevPage.next;
|
return prevPage.next;
|
||||||
|
|
Loading…
Add table
Reference in a new issue