only store statuses in the AS cache, not accounts (#210)
This commit is contained in:
parent
bac4ee9980
commit
793f9af6e6
|
@ -34,14 +34,6 @@ import (
|
||||||
// Converts a gts model account into an Activity Streams person type, following
|
// Converts a gts model account into an Activity Streams person type, following
|
||||||
// the spec laid out for mastodon here: https://docs.joinmastodon.org/spec/activitypub/
|
// the spec laid out for mastodon here: https://docs.joinmastodon.org/spec/activitypub/
|
||||||
func (c *converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab.ActivityStreamsPerson, error) {
|
func (c *converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab.ActivityStreamsPerson, error) {
|
||||||
// first check if we have this person in our asCache already
|
|
||||||
if personI, err := c.asCache.Fetch(a.ID); err == nil {
|
|
||||||
if person, ok := personI.(vocab.ActivityStreamsPerson); ok {
|
|
||||||
// we have it, so just return it as-is
|
|
||||||
return person, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
person := streams.NewActivityStreamsPerson()
|
person := streams.NewActivityStreamsPerson()
|
||||||
|
|
||||||
// id should be the activitypub URI of this user
|
// id should be the activitypub URI of this user
|
||||||
|
@ -272,11 +264,6 @@ func (c *converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab
|
||||||
person.SetActivityStreamsImage(headerProperty)
|
person.SetActivityStreamsImage(headerProperty)
|
||||||
}
|
}
|
||||||
|
|
||||||
// put the person in our cache in case we need it again soon
|
|
||||||
if err := c.asCache.Store(a.ID, person); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return person, nil
|
return person, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue