diff options
author | 2022-05-18 23:13:03 +0200 | |
---|---|---|
committer | 2022-05-18 22:13:03 +0100 | |
commit | b2810fedf201dc9ae80ea8ec6d48e5cf7e21e6ea (patch) | |
tree | a6d7c2b7f349d72a383a7124e796c746c6a37111 /internal/processing/fromfederator.go | |
parent | [performance] Add further indexes to mitigate laggy queries (#586) (diff) | |
download | gotosocial-b2810fedf201dc9ae80ea8ec6d48e5cf7e21e6ea.tar.xz |
[bugfix] Clean up boosts of status when the status itself is deleted (#579)
* move status wiping logic to fromcommon.go
* delete reblogs of status when a status is deleted
* add admin boost of zork to test model
* update tests to make them more determinate
* Merge branch 'main' into status_reblog_cleanup
* move status wiping logic to fromcommon.go
* delete reblogs of status when a status is deleted
* add admin boost of zork to test model
* update tests to make them more determinate
* Merge branch 'main' into status_reblog_cleanup
* test status delete via client api
* go fmt
Diffstat (limited to 'internal/processing/fromfederator.go')
-rw-r--r-- | internal/processing/fromfederator.go | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/internal/processing/fromfederator.go b/internal/processing/fromfederator.go index bb2cb5323..06df17d91 100644 --- a/internal/processing/fromfederator.go +++ b/internal/processing/fromfederator.go @@ -26,7 +26,6 @@ import ( "github.com/sirupsen/logrus" "github.com/superseriousbusiness/gotosocial/internal/ap" - "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/messages" @@ -342,36 +341,12 @@ func (p *processor) processUpdateAccountFromFederator(ctx context.Context, feder // processDeleteStatusFromFederator handles Activity Delete and Object Note func (p *processor) processDeleteStatusFromFederator(ctx context.Context, federatorMsg messages.FromFederator) error { - // TODO: handle side effects of status deletion here: - // 1. delete all media associated with status - // 2. delete boosts of status - // 3. etc etc etc statusToDelete, ok := federatorMsg.GTSModel.(*gtsmodel.Status) if !ok { return errors.New("note was not parseable as *gtsmodel.Status") } - // delete all attachments for this status - for _, a := range statusToDelete.AttachmentIDs { - if err := p.mediaProcessor.Delete(ctx, a); err != nil { - return err - } - } - - // delete all mentions for this status - for _, m := range statusToDelete.MentionIDs { - if err := p.db.DeleteByID(ctx, m, >smodel.Mention{}); err != nil { - return err - } - } - - // delete all notifications for this status - if err := p.db.DeleteWhere(ctx, []db.Where{{Key: "status_id", Value: statusToDelete.ID}}, &[]*gtsmodel.Notification{}); err != nil { - return err - } - - // remove this status from any and all timelines - return p.deleteStatusFromTimelines(ctx, statusToDelete) + return p.wipeStatus(ctx, statusToDelete) } // processDeleteAccountFromFederator handles Activity Delete and Object Profile |