Skip to content

Commit

Permalink
fix(backend): only include create activities in the outbox
Browse files Browse the repository at this point in the history
also order outbox and follower desc by date, to always include the latest
  • Loading branch information
maybeanerd committed Jun 28, 2024
1 parent f50f675 commit 1a8059f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selfhosted-api-trader-game",
"version": "0.1.18",
"version": "0.1.19",
"description": "A WIP game.",
"author": "Sebastian Di Luzio",
"packageManager": "[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ export class ActivityPubService {
const followers = await drizz.query.activityPubActor.findMany({
where: (actor) => eq(actor.isFollowingThisServer, true),
// TODO store and order by follow date
orderBy: (actor) => asc(actor.id),
orderBy: (actor) => desc(actor.id),
});

return {
Expand Down Expand Up @@ -994,8 +994,13 @@ export class ActivityPubService {
const { actor } = await getInstanceActor();
const activities = await drizz.query.activityPubActivity.findMany({
where: (activity) =>
and(eq(activity.actor, actor.id), isNotNull(activity.internalId)),
orderBy: (activity) => asc(activity.receivedOn),
and(
eq(activity.actor, actor.id),
isNotNull(activity.internalId),
// For now, provide only creations in outbox
inArray(activity.type, [SupportedActivityType.Create]),
),
orderBy: (activity) => desc(activity.receivedOn),
limit: 100,
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selfhosted-api-trader-game-frontend",
"version": "0.1.18",
"version": "0.1.19",
"description": "A WIP example client for the game.",
"author": "Sebastian Di Luzio",
"packageManager": "[email protected]",
Expand Down

0 comments on commit 1a8059f

Please sign in to comment.