From 3e96d6021d5a93ca61fc8b82ffd73b89ce1c0868 Mon Sep 17 00:00:00 2001 From: odrling Date: Wed, 27 Nov 2024 22:49:00 +0100 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20send=20webhooks=20for=20importe?= =?UTF-8?q?d=20karas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ignore imported karas for now, probably we could have an option later when we support defining webhooks for more events --- server/model.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/model.go b/server/model.go index e53ee80..6c919a8 100644 --- a/server/model.go +++ b/server/model.go @@ -437,6 +437,18 @@ func (ki *KaraInfoDB) AfterUpdate(tx *gorm.DB) error { if err != nil { return err } + + // ignore imported karas + mugen_import := &MugenImport{} + err := tx.Where(&MugenImport{KaraID: ki.ID}).First(mugen_import).Error + if err == nil { + // kara was imported + return nil + } + if !errors.Is(err, gorm.ErrRecordNotFound) { + return err + } + go PostWebhooks(*ki) } }