Redirect to generated personal project slug

This commit is contained in:
Ben Visness 2021-11-09 11:23:36 -08:00
parent ff901e4fb8
commit 6ef391b2e8
1 changed files with 5 additions and 0 deletions

View File

@ -284,6 +284,11 @@ func NewWebsiteRoutes(longRequestContext context.Context, conn *pgxpool.Pool, pe
return c.Redirect(hmnurl.BuildOfficialProjectHomepage(p.Project.Slug), http.StatusSeeOther)
}
if c.PathParams["slug"] != models.GeneratePersonalProjectSlug(p.Project.Name) {
// TODO: Redirect to the same page on the other path
return c.Redirect(hmnurl.BuildPersonalProject(p.Project.ID, models.GeneratePersonalProjectSlug(p.Project.Name)), http.StatusSeeOther)
}
c.CurrentProject = &p.Project
return h(c)