summaryrefslogtreecommitdiff
path: root/internal/processing/workers
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2025-05-02 16:01:30 +0000
committerLibravatar kim <gruf@noreply.codeberg.org>2025-05-02 16:01:30 +0000
commit1480f22aeaac1772bb9a98c0db6e9a13ff2761e1 (patch)
tree90f793c681eeb2cd28d8bdc20a96d150d226fa38 /internal/processing/workers
parent[bugfix] Fix wrong URI used in dereferenceLocal (#4097) (diff)
downloadgotosocial-1480f22aeaac1772bb9a98c0db6e9a13ff2761e1.tar.xz
[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>
Diffstat (limited to 'internal/processing/workers')
-rw-r--r--internal/processing/workers/fromclientapi.go3
-rw-r--r--internal/processing/workers/fromfediapi.go3
-rw-r--r--internal/processing/workers/surfacetimeline.go6
3 files changed, 12 insertions, 0 deletions
diff --git a/internal/processing/workers/fromclientapi.go b/internal/processing/workers/fromclientapi.go
index 8cd67dd2a..0e27eea0e 100644
--- a/internal/processing/workers/fromclientapi.go
+++ b/internal/processing/workers/fromclientapi.go
@@ -750,6 +750,9 @@ func (p *clientAPI) UpdateAccount(ctx context.Context, cMsg *messages.FromClient
log.Errorf(ctx, "error federating account update: %v", err)
}
+ // Account representation has changed, invalidate from timelines.
+ p.surface.invalidateTimelineEntriesByAccount(account.ID)
+
return nil
}
diff --git a/internal/processing/workers/fromfediapi.go b/internal/processing/workers/fromfediapi.go
index 0f0c7549e..93dd5b00e 100644
--- a/internal/processing/workers/fromfediapi.go
+++ b/internal/processing/workers/fromfediapi.go
@@ -811,6 +811,9 @@ func (p *fediAPI) UpdateAccount(ctx context.Context, fMsg *messages.FromFediAPI)
log.Errorf(ctx, "error refreshing account: %v", err)
}
+ // Account representation has changed, invalidate from timelines.
+ p.surface.invalidateTimelineEntriesByAccount(account.ID)
+
return nil
}
diff --git a/internal/processing/workers/surfacetimeline.go b/internal/processing/workers/surfacetimeline.go
index 2046d1995..ebb77b6bb 100644
--- a/internal/processing/workers/surfacetimeline.go
+++ b/internal/processing/workers/surfacetimeline.go
@@ -826,6 +826,12 @@ func (s *Surface) removeTimelineEntriesByAccount(accountID string) {
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) {
// Remove all statuses by target account
// from given account's home timeline.