summaryrefslogtreecommitdiff
path: root/internal/processing/workers/fromclientapi.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-08-11 09:23:36 +0000
committerLibravatar GitHub <noreply@github.com>2024-08-11 11:23:36 +0200
commit865b3aeaac8f165462796a7a5f8cf04ae7724d0f (patch)
treee17d58bf351e99fb512900ed5c3b6a60fe7c6196 /internal/processing/workers/fromclientapi.go
parent[bugfix] ensure testrig package only compiled-in when debug enabled (#3185) (diff)
downloadgotosocial-865b3aeaac8f165462796a7a5f8cf04ae7724d0f.tar.xz
[bugfix] updated pinned counts on status delete (#3188)
* include pinned status when incrementing / decrementing status counts * remove the pinned increment on status creation * code comments * microoptimize decr
Diffstat (limited to 'internal/processing/workers/fromclientapi.go')
-rw-r--r--internal/processing/workers/fromclientapi.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/internal/processing/workers/fromclientapi.go b/internal/processing/workers/fromclientapi.go
index 7f1b5780c..1a37341f8 100644
--- a/internal/processing/workers/fromclientapi.go
+++ b/internal/processing/workers/fromclientapi.go
@@ -251,10 +251,7 @@ func (p *clientAPI) CreateStatus(ctx context.Context, cMsg *messages.FromClientA
// If pending approval is true then status must
// reply to a status (either one of ours or a
// remote) that requires approval for the reply.
- pendingApproval := util.PtrOrValue(
- status.PendingApproval,
- false,
- )
+ pendingApproval := util.PtrOrZero(status.PendingApproval)
switch {
case pendingApproval && !status.PreApproved:
@@ -816,7 +813,7 @@ func (p *clientAPI) UndoAnnounce(ctx context.Context, cMsg *messages.FromClientA
}
// Update stats for the origin account.
- if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin); err != nil {
+ if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin, status); err != nil {
log.Errorf(ctx, "error updating account stats: %v", err)
}
@@ -873,7 +870,7 @@ func (p *clientAPI) DeleteStatus(ctx context.Context, cMsg *messages.FromClientA
}
// Update stats for the origin account.
- if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin); err != nil {
+ if err := p.utils.decrementStatusesCount(ctx, cMsg.Origin, status); err != nil {
log.Errorf(ctx, "error updating account stats: %v", err)
}