summaryrefslogtreecommitdiff
path: root/internal/processing/workers/fromclientapi.go
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2025-12-03 19:37:17 +0100
committerLibravatar tobi <tobi.smethurst@protonmail.com>2026-01-22 13:26:54 +0100
commit5ca7f0b20785bac1e17e783b2505260283ef5385 (patch)
treecf85644171d8a78c01913e7038a949bff4598ce6 /internal/processing/workers/fromclientapi.go
parent[bugfix] don't apply visibility / status filtering when requesting your own a... (diff)
downloadgotosocial-5ca7f0b20785bac1e17e783b2505260283ef5385.tar.xz
[bugfix] Remove follow (req) notifications on Follow Undo (#4604)
# Description > If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements. > > If this is a documentation change, please briefly describe what you've changed and why. Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4590 ## Checklist Please put an x inside each checkbox to indicate that you've read and followed it: `[ ]` -> `[x]` If this is a documentation change, only the first two checkboxes must be filled (you can delete the others if you want). - [x] I/we have read the [GoToSocial contribution guidelines](https://codeberg.org/superseriousbusiness/gotosocial/src/branch/main/CONTRIBUTING.md). - [x] I/we have not used so-called 'AI' to create the proposed changes. - [x] I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat. - [x] I/we have performed a self-review of added code. - [x] I/we have written code that is legible and maintainable by others. - [x] I/we have commented the added code, particularly in hard-to-understand areas. - [ ] I/we have made any necessary changes to documentation. - [x] I/we have added tests that cover new code. - [x] I/we have run tests and they pass locally with the changes. - [x] I/we have run `go fmt ./...` and `golangci-lint run`. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4604 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/processing/workers/fromclientapi.go')
-rw-r--r--internal/processing/workers/fromclientapi.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/processing/workers/fromclientapi.go b/internal/processing/workers/fromclientapi.go
index 75201c7dc..e18f941fa 100644
--- a/internal/processing/workers/fromclientapi.go
+++ b/internal/processing/workers/fromclientapi.go
@@ -871,6 +871,20 @@ func (p *clientAPI) UndoFollow(ctx context.Context, cMsg *messages.FromClientAPI
follow.TargetAccountID,
follow.AccountID,
)
+
+ // Clear any notifications that were
+ // generated by this follow (request).
+ if err := p.state.DB.DeleteNotifications(
+ ctx,
+ []gtsmodel.NotificationType{
+ gtsmodel.NotificationFollow,
+ gtsmodel.NotificationFollowRequest,
+ },
+ follow.TargetAccountID,
+ follow.AccountID,
+ ); err != nil {
+ return gtserror.Newf("db error deleting notifications: %w", err)
+ }
}
if err := p.federate.UndoFollow(ctx, follow); err != nil {