Exclude opt-in campaign from public archive.

This commit is contained in:
Kailash Nadh 2022-11-09 22:36:31 +05:30
parent 23fb178ec4
commit eac1240437

View file

@ -77,13 +77,20 @@ 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 {
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,
makeMsgTpl(app.i18n.T("public.errorTitle"), "", app.i18n.Ts("public.errorFetchingCampaign")))