MCPcopy Create free account
hub / github.com/davecheney/pub / createObject

Method createObject

activitypub/inbox.go:264–281  ·  view source on GitHub ↗
(props map[string]any)

Source from the content-addressed store, hash-verified

262 typ := stringFromAny(create["type"])
263 switch typ {
264 case "Note", "Question":
265 return i.processCreateNote(create)
266 default:
267 return fmt.Errorf("unknown create object type: %q", typ)
268 }
269}
270
271func (i *inboxProcessor) processCreateNote(create map[string]any) error {
272 uri := stringFromAny(create["atomUri"])
273 _, err := models.NewStatuses(i.db).FindByURI(uri)
274 switch err {
275 case nil:
276 // we already have this status
277 return nil
278 case gorm.ErrRecordNotFound:
279 // we don't have this status
280 actors := NewRemoteActorFetcher(i.signAs)
281 actor, err := models.NewActors(i.db).FindOrCreate(stringFromAny(create["attributedTo"]), actors.Fetch)
282 if err != nil {
283 return err
284 }

Callers 3

processAnnounceMethod · 0.95
processCreateMethod · 0.95
processUpdateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected