mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix/chore] Invalidate prepared statuses when account representation changes (#4107)
This pull requests adds logic to invalidate prepared statuses when an account's representation changes due to an update. Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4104 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4107 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
@ -750,6 +750,9 @@ func (p *clientAPI) UpdateAccount(ctx context.Context, cMsg *messages.FromClient
|
|||||||
log.Errorf(ctx, "error federating account update: %v", err)
|
log.Errorf(ctx, "error federating account update: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Account representation has changed, invalidate from timelines.
|
||||||
|
p.surface.invalidateTimelineEntriesByAccount(account.ID)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,6 +811,9 @@ func (p *fediAPI) UpdateAccount(ctx context.Context, fMsg *messages.FromFediAPI)
|
|||||||
log.Errorf(ctx, "error refreshing account: %v", err)
|
log.Errorf(ctx, "error refreshing account: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Account representation has changed, invalidate from timelines.
|
||||||
|
p.surface.invalidateTimelineEntriesByAccount(account.ID)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,6 +826,12 @@ func (s *Surface) removeTimelineEntriesByAccount(accountID string) {
|
|||||||
s.State.Caches.Timelines.List.RemoveByAccountIDs(accountID)
|
s.State.Caches.Timelines.List.RemoveByAccountIDs(accountID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// removeTimelineEntriesByAccount invalidates all cached timeline entries authored by account ID.
|
||||||
|
func (s *Surface) invalidateTimelineEntriesByAccount(accountID string) {
|
||||||
|
s.State.Caches.Timelines.Home.UnprepareByAccountIDs(accountID)
|
||||||
|
s.State.Caches.Timelines.List.UnprepareByAccountIDs(accountID)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Surface) removeRelationshipFromTimelines(ctx context.Context, timelineAccountID string, targetAccountID string) {
|
func (s *Surface) removeRelationshipFromTimelines(ctx context.Context, timelineAccountID string, targetAccountID string) {
|
||||||
// Remove all statuses by target account
|
// Remove all statuses by target account
|
||||||
// from given account's home timeline.
|
// from given account's home timeline.
|
||||||
|
Reference in New Issue
Block a user