Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Essem
Sharkey
Commits
af30959c
Commit
af30959c
authored
1 year ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
fix runtime error
parent
35ffe3c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/backend/src/core/activitypub/ApDeliverManagerService.ts
+67
-67
67 additions, 67 deletions
...s/backend/src/core/activitypub/ApDeliverManagerService.ts
with
67 additions
and
67 deletions
packages/backend/src/core/activitypub/ApDeliverManagerService.ts
+
67
−
67
View file @
af30959c
...
...
@@ -29,73 +29,6 @@ const isFollowers = (recipe: IRecipe): recipe is IFollowersRecipe =>
const
isDirect
=
(
recipe
:
IRecipe
):
recipe
is
IDirectRecipe
=>
recipe
.
type
===
'
Direct
'
;
@
Injectable
()
export
class
ApDeliverManagerService
{
constructor
(
@
Inject
(
DI
.
config
)
private
config
:
Config
,
@
Inject
(
DI
.
usersRepository
)
private
usersRepository
:
UsersRepository
,
@
Inject
(
DI
.
followingsRepository
)
private
followingsRepository
:
FollowingsRepository
,
private
userEntityService
:
UserEntityService
,
private
queueService
:
QueueService
,
)
{
}
/**
* Deliver activity to followers
* @param actor
* @param activity Activity
*/
@
bindThis
public
async
deliverToFollowers
(
actor
:
{
id
:
LocalUser
[
'
id
'
];
host
:
null
;
},
activity
:
IActivity
):
Promise
<
void
>
{
const
manager
=
new
DeliverManager
(
this
.
userEntityService
,
this
.
followingsRepository
,
this
.
queueService
,
actor
,
activity
,
);
manager
.
addFollowersRecipe
();
await
manager
.
execute
();
}
/**
* Deliver activity to user
* @param actor
* @param activity Activity
* @param to Target user
*/
@
bindThis
public
async
deliverToUser
(
actor
:
{
id
:
LocalUser
[
'
id
'
];
host
:
null
;
},
activity
:
IActivity
,
to
:
RemoteUser
):
Promise
<
void
>
{
const
manager
=
new
DeliverManager
(
this
.
userEntityService
,
this
.
followingsRepository
,
this
.
queueService
,
actor
,
activity
,
);
manager
.
addDirectRecipe
(
to
);
await
manager
.
execute
();
}
@
bindThis
public
createDeliverManager
(
actor
:
{
id
:
User
[
'
id
'
];
host
:
null
;
},
activity
:
IActivity
|
null
):
DeliverManager
{
return
new
DeliverManager
(
this
.
userEntityService
,
this
.
followingsRepository
,
this
.
queueService
,
actor
,
activity
,
);
}
}
class
DeliverManager
{
private
actor
:
ThinUser
;
private
activity
:
IActivity
|
null
;
...
...
@@ -210,3 +143,70 @@ class DeliverManager {
this
.
queueService
.
deliverMany
(
this
.
actor
,
this
.
activity
,
inboxes
);
}
}
@
Injectable
()
export
class
ApDeliverManagerService
{
constructor
(
@
Inject
(
DI
.
config
)
private
config
:
Config
,
@
Inject
(
DI
.
usersRepository
)
private
usersRepository
:
UsersRepository
,
@
Inject
(
DI
.
followingsRepository
)
private
followingsRepository
:
FollowingsRepository
,
private
userEntityService
:
UserEntityService
,
private
queueService
:
QueueService
,
)
{
}
/**
* Deliver activity to followers
* @param actor
* @param activity Activity
*/
@
bindThis
public
async
deliverToFollowers
(
actor
:
{
id
:
LocalUser
[
'
id
'
];
host
:
null
;
},
activity
:
IActivity
):
Promise
<
void
>
{
const
manager
=
new
DeliverManager
(
this
.
userEntityService
,
this
.
followingsRepository
,
this
.
queueService
,
actor
,
activity
,
);
manager
.
addFollowersRecipe
();
await
manager
.
execute
();
}
/**
* Deliver activity to user
* @param actor
* @param activity Activity
* @param to Target user
*/
@
bindThis
public
async
deliverToUser
(
actor
:
{
id
:
LocalUser
[
'
id
'
];
host
:
null
;
},
activity
:
IActivity
,
to
:
RemoteUser
):
Promise
<
void
>
{
const
manager
=
new
DeliverManager
(
this
.
userEntityService
,
this
.
followingsRepository
,
this
.
queueService
,
actor
,
activity
,
);
manager
.
addDirectRecipe
(
to
);
await
manager
.
execute
();
}
@
bindThis
public
createDeliverManager
(
actor
:
{
id
:
User
[
'
id
'
];
host
:
null
;
},
activity
:
IActivity
|
null
):
DeliverManager
{
return
new
DeliverManager
(
this
.
userEntityService
,
this
.
followingsRepository
,
this
.
queueService
,
actor
,
activity
,
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment