Skip to content

Commit

Permalink
Exclude opt-in campaign from public archive.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Nov 10, 2022
1 parent 23fb178 commit eac1240
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit eac1240

Please sign in to comment.