From eac12404373b961e60cd9ed65622d57237920d5c Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Wed, 9 Nov 2022 22:36:31 +0530 Subject: [PATCH] Exclude opt-in campaign from public archive. --- cmd/archive.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/archive.go b/cmd/archive.go index d0c5094..d2fdf75 100644 --- a/cmd/archive.go +++ b/cmd/archive.go @@ -77,12 +77,19 @@ func handleCampaignArchivePage(c echo.Context) error { ) pubCamp, err := app.core.GetArchivedCampaign(0, uuid) - if err != nil { + if err != nil || pubCamp.Type != models.CampaignTypeRegular { + notFound := false if er, ok := err.(*echo.HTTPError); ok { if er.Code == http.StatusBadRequest { - return c.Render(http.StatusNotFound, tplMessage, - makeMsgTpl(app.i18n.T("public.notFoundTitle"), "", app.i18n.T("public.campaignNotFound"))) + notFound = true } + } else if pubCamp.Type != models.CampaignTypeRegular { + notFound = true + } + + if notFound { + return c.Render(http.StatusNotFound, tplMessage, + makeMsgTpl(app.i18n.T("public.notFoundTitle"), "", app.i18n.T("public.campaignNotFound"))) } return c.Render(http.StatusInternalServerError, tplMessage,