From 656c06d5ce8f74847f8c1ac0ac646a793b27add7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Bouzour=C3=A8ne?= Date: Wed, 26 Mar 2025 18:56:22 +0100 Subject: [PATCH] Search: default to active if no params --- controllers/contacts.go | 12 ++++++++++++ controllers/members.go | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/controllers/contacts.go b/controllers/contacts.go index c49386f..8e59beb 100644 --- a/controllers/contacts.go +++ b/controllers/contacts.go @@ -58,6 +58,12 @@ func Contacts(c *fiber.Ctx) error { } } + // If active and archive are false, default to active + // This needs to be placed before the security verification + if !params.Active && !params.Archive { + params.Active = true + } + params.PageNumber, _ = strconv.Atoi(c.Query("p")) params.PageSize = 50 params.PersonType = "contacts" @@ -140,6 +146,12 @@ func ContactsExport(c *fiber.Ctx) error { } } + // If active and archive are false, default to active + // This needs to be placed before the security verification + if !params.Active && !params.Archive { + params.Active = true + } + params.PageSize = 0 params.PersonType = "members" diff --git a/controllers/members.go b/controllers/members.go index b42d472..f263fec 100644 --- a/controllers/members.go +++ b/controllers/members.go @@ -73,6 +73,12 @@ func Members(c *fiber.Ctx) error { } } + // If active and archive are false, default to active + // This needs to be placed before the security verification + if !params.Active && !params.Archive { + params.Active = true + } + params.PageNumber, _ = strconv.Atoi(c.Query("p")) params.PageSize = 50 params.PersonType = "members" @@ -155,6 +161,12 @@ func MembersExport(c *fiber.Ctx) error { } } + // If active and archive are false, default to active + // This needs to be placed before the security verification + if !params.Active && !params.Archive { + params.Active = true + } + params.PageSize = 0 params.PersonType = "members"