diff --git a/source/plugins/activity/index.mjs b/source/plugins/activity/index.mjs index 9160d4b7..a31f912e 100644 --- a/source/plugins/activity/index.mjs +++ b/source/plugins/activity/index.mjs @@ -15,11 +15,11 @@ export default async function({login, data, rest, q, account, imports}, {enabled } //Load inputs - let {limit, days, filter, visibility, timestamps, skipped} = imports.metadata.plugins.activity.inputs({data, q, account}) + let {limit, load, days, filter, visibility, timestamps, skipped} = imports.metadata.plugins.activity.inputs({data, q, account}) if (!days) days = Infinity skipped.push(...data.shared["repositories.skipped"]) - const pages = Math.ceil(limit / 100) + const pages = Math.ceil(load / 100) const codelines = 2 //Get user recent activity @@ -27,8 +27,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled const events = [] try { for (let page = 1; page <= pages; page++) { - console.debug(`metrics/compute/${login}/plugins > activity > loading page ${page}`) - events.push(...(context.mode === "repository" ? await rest.activity.listRepoEvents({owner:context.owner, repo:context.repo}) : await rest.activity.listEventsForAuthenticatedUser({username:login, per_page:100})).data) + console.debug(`metrics/compute/${login}/plugins > activity > loading page ${page}/${pages}`) + events.push(...(context.mode === "repository" ? await rest.activity.listRepoEvents({owner:context.owner, repo:context.repo}) : await rest.activity.listEventsForAuthenticatedUser({username:login, per_page:100, page})).data) } } catch { @@ -67,7 +67,8 @@ export default async function({login, data, rest, q, account, imports}, {enabled } //Forked repository case "ForkEvent": { - return {type:"fork", actor, timestamp, repo} + const {forkee:{full_name:forked}} = payload + return {type:"fork", actor, timestamp, repo, forked} } //Wiki editions case "GollumEvent": { diff --git a/source/plugins/activity/metadata.yml b/source/plugins/activity/metadata.yml index 2167cac4..0aa80b2e 100644 --- a/source/plugins/activity/metadata.yml +++ b/source/plugins/activity/metadata.yml @@ -22,6 +22,16 @@ inputs: min: 1 max: 1000 + # Number of activity events to load + # This should be higher than "plugin_activity_limit" + # A high number will consume more requests + plugin_activity_load: + description: Number of events to load + type: number + default: 300 + min: 100 + max: 1000 + # Filter events by age # Note that it only filter fetched events, you may need to increase "plugin_activity_limit" to display older events # Set to 0 to disable age filtering