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
Dima Krasner
Sharkey
Commits
0163cb7b
Commit
0163cb7b
authored
2 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
test
parent
6c5a42e7
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/remote/activitypub/ApInboxService.ts
+14
-9
14 additions, 9 deletions
...ges/backend/src/core/remote/activitypub/ApInboxService.ts
with
14 additions
and
9 deletions
packages/backend/src/core/remote/activitypub/ApInboxService.ts
+
14
−
9
View file @
0163cb7b
import
{
Inject
,
Injectable
}
from
'
@nestjs/common
'
;
import
{
In
}
from
'
typeorm
'
;
import
{
ModuleRef
}
from
'
@nestjs/core
'
;
import
{
DI
}
from
'
@/di-symbols.js
'
;
import
{
Config
}
from
'
@/config.js
'
;
import
type
{
CacheableRemoteUser
}
from
'
@/models/entities/User.js
'
;
...
...
@@ -22,21 +23,24 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
import
{
QueueService
}
from
'
@/core/QueueService.js
'
;
import
{
MessagingService
}
from
'
@/core/MessagingService.js
'
;
import
{
getApId
,
getApIds
,
getApType
,
isAccept
,
isActor
,
isAdd
,
isAnnounce
,
isBlock
,
isCollection
,
isCollectionOrOrderedCollection
,
isCreate
,
isDelete
,
isFlag
,
isFollow
,
isLike
,
isPost
,
isRead
,
isReject
,
isRemove
,
isTombstone
,
isUndo
,
isUpdate
,
validActor
,
validPost
}
from
'
./type.js
'
;
import
{
ApNoteService
}
from
'
./models/ApNoteService.js
'
;
import
{
ApLoggerService
}
from
'
./ApLoggerService.js
'
;
import
{
ApDbResolverService
}
from
'
./ApDbResolverService.js
'
;
import
{
ApResolverService
}
from
'
./ApResolverService.js
'
;
import
{
ApAudienceService
}
from
'
./ApAudienceService.js
'
;
import
{
ApPersonService
}
from
'
./models/ApPersonService.js
'
;
import
{
ApQuestionService
}
from
'
./models/ApQuestionService.js
'
;
import
type
{
ApNoteService
}
from
'
./models/ApNoteService.js
'
;
import
type
{
Resolver
}
from
'
./ApResolverService.js
'
;
import
type
{
IAccept
,
IAdd
,
IAnnounce
,
IBlock
,
ICreate
,
IDelete
,
IFlag
,
IFollow
,
ILike
,
IObject
,
IRead
,
IReject
,
IRemove
,
IUndo
,
IUpdate
}
from
'
./type.js
'
;
@
Injectable
()
export
class
ApInboxService
{
private
apNoteService
:
ApNoteService
;
#
logger
:
Logger
;
constructor
(
private
moduleRef
:
ModuleRef
,
@
Inject
(
DI
.
config
)
private
config
:
Config
,
...
...
@@ -75,12 +79,13 @@ export class ApInboxService {
private
apResolverService
:
ApResolverService
,
private
apDbResolverService
:
ApDbResolverService
,
private
apLoggerService
:
ApLoggerService
,
private
apNoteService
:
ApNoteService
,
//
private apNoteService: ApNoteService,
private
apPersonService
:
ApPersonService
,
private
apQuestionService
:
ApQuestionService
,
private
queueService
:
QueueService
,
private
messagingService
:
MessagingService
,
)
{
this
.
apNoteService
=
this
.
moduleRef
.
get
(
'
ApNoteService
'
);
this
.
#
logger
=
this
.
apLoggerService
.
logger
;
}
...
...
@@ -170,11 +175,11 @@ export class ApInboxService {
await
this
.
apNoteService
.
extractEmojis
(
activity
.
tag
??
[],
actor
.
host
).
catch
(()
=>
null
);
return
await
this
.
reactionService
.
create
(
actor
,
note
,
activity
.
_misskey_reaction
??
activity
.
content
??
activity
.
name
).
catch
(
e
=>
{
if
(
e
.
id
===
'
51c42bb4-931a-456b-bff7-e5a8a70dd298
'
)
{
return
await
this
.
reactionService
.
create
(
actor
,
note
,
activity
.
_misskey_reaction
??
activity
.
content
??
activity
.
name
).
catch
(
e
rr
=>
{
if
(
e
rr
.
id
===
'
51c42bb4-931a-456b-bff7-e5a8a70dd298
'
)
{
return
'
skip: already reacted
'
;
}
else
{
throw
e
;
throw
e
rr
;
}
}).
then
(()
=>
'
ok
'
);
}
...
...
@@ -400,11 +405,11 @@ export class ApInboxService {
await
this
.
apNoteService
.
createNote
(
note
,
resolver
,
silent
);
return
'
ok
'
;
}
catch
(
e
)
{
if
(
e
instanceof
StatusError
&&
e
.
isClientError
)
{
return
`skip
${
e
.
statusCode
}
`
;
}
catch
(
e
rr
)
{
if
(
e
rr
instanceof
StatusError
&&
e
rr
.
isClientError
)
{
return
`skip
${
e
rr
.
statusCode
}
`
;
}
else
{
throw
e
;
throw
e
rr
;
}
}
finally
{
unlock
();
...
...
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