diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-01 22:00:31 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-01 22:00:31 +0000 |
commit | b5591aa8deed658cd3bb032d4800d7eb1c5b8a3f (patch) | |
tree | 9ad828d39222b5fb0532e2cd077a6efe6d3acc54 /registry | |
parent | af4dc7f3f05fad8fe13edf0173a6dee5e4148bd3 (diff) | |
download | communique-b5591aa8deed658cd3bb032d4800d7eb1c5b8a3f.tar.gz |
working note lookups
Diffstat (limited to 'registry')
-rw-r--r-- | registry/registry.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/registry/registry.go b/registry/registry.go index 4a1329a..13f2889 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -96,6 +96,27 @@ func (r *Registry) Activity(name, id string) (map[string]interface{}, error) { return views.RenderActivity(handler.handlerCfg.Name, r.cfg.Domain, outboxItem) } +func (r *Registry) Note(name, id string) (map[string]interface{}, error) { + handler := r.findByName(name) + if handler == nil { + return nil, nil + } + lookup := models.NewOutboxItem(handler.handlerCfg) + lookup.Id = []byte(id) + result, err := r.persister.Find(lookup) + if err != nil { + return nil, err + } + buf := bytes.NewBuffer(result) + dec := gob.NewDecoder(buf) + var outboxItem models.OutboxItem + err = dec.Decode(&outboxItem) + if err != nil { + return nil, err + } + return views.RenderNote(handler.handlerCfg.Name, r.cfg.Domain, outboxItem) +} + func (r *Registry) WebfingerResource(fqn string) (*views.WebfingerResource, error) { handler := r.findByFQN(fqn) if handler == nil { |