diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-04-29 13:06:34 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-04-29 13:07:43 +0200 |
| commit | d397d49acdafa061e252a803790407e749806eb7 (patch) | |
| tree | 217684b841b9b1e99b3fc0f48813af58ffdff774 | |
| parent | 49bb6b93d549c8ccb088328cac049d4b11679581 (diff) | |
dashboard/app: remove old namespace redirects
We kept redirects from old URLs for more than a year.
It's time to remove them. Old links, if they still exist,
need to be updated sooner or later.
| -rw-r--r-- | dashboard/app/handler.go | 25 | ||||
| -rw-r--r-- | dashboard/app/main.go | 4 | ||||
| -rw-r--r-- | dashboard/app/templates.html | 15 |
3 files changed, 3 insertions, 41 deletions
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go index c779f82a9..62294811c 100644 --- a/dashboard/app/handler.go +++ b/dashboard/app/handler.go @@ -97,7 +97,6 @@ type uiHeader struct { Subpage string Namespace string Namespaces []uiNamespace - Redirects []uiRedirect } type uiNamespace struct { @@ -139,7 +138,6 @@ func commonHeader(c context.Context, r *http.Request, w http.ResponseWriter, ns h := commonHeaderRaw(c, r) const adminPage = "admin" isAdminPage := r.URL.Path == "/"+adminPage - isBugPage := r.URL.Path == "/bug" found := false for ns1, cfg := range config.Namespaces { if accessLevel < cfg.AccessLevel { @@ -155,29 +153,6 @@ func commonHeader(c context.Context, r *http.Request, w http.ResponseWriter, ns Name: ns1, Caption: cfg.DisplayTitle, }) - // This handles redirects from old URL scheme to new scheme. - // This this should be removed at some point (Apr 5, 2019). - // Also see handling of "fixed" parameter in handleMain. - if isBugPage { - continue - } - h.Redirects = append(h.Redirects, uiRedirect{ - From: "#" + ns1, - To: "/" + ns1, - }) - fragments := []string{"managers", "open", "pending"} - for _, reporting := range cfg.Reporting { - if !reporting.moderation || accessLevel < reporting.AccessLevel { - continue - } - fragments = append(fragments, reporting.Name) - } - for _, frag := range fragments { - h.Redirects = append(h.Redirects, uiRedirect{ - From: "#" + ns1 + "-" + frag, - To: "/" + ns1 + "#" + frag, - }) - } } sort.Slice(h.Namespaces, func(i, j int) bool { return h.Namespaces[i].Caption < h.Namespaces[j].Caption diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 1196d29b7..4e6c81a2f 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -204,10 +204,6 @@ type uiJob struct { // handleMain serves main page. func handleMain(c context.Context, w http.ResponseWriter, r *http.Request) error { - if ns := r.FormValue("fixed"); ns != "" { - http.Redirect(w, r, fmt.Sprintf("/%v/fixed", ns), http.StatusFound) - return nil - } hdr, err := commonHeader(c, r, w, "") if err != nil { return err diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html index 30f1f4590..1e030ed8e 100644 --- a/dashboard/app/templates.html +++ b/dashboard/app/templates.html @@ -11,15 +11,6 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{/* Common page head part, invoked with *uiHeader */}} {{define "head"}} <link rel="stylesheet" href="/static/style.css"/> - {{if .Redirects}} - <script> - {{range $redir := .Redirects}} - if (window.location.hash == "{{$redir.From}}") { - window.location.href = "{{$redir.To}}"; - } - {{end}} - </script> - {{end}} <script src="/static/common.js"></script> {{if .AnalyticsTrackingID}} <script async src="https://www.googletagmanager.com/gtag/js?id={{.AnalyticsTrackingID}}"></script> @@ -40,11 +31,11 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the <td> <h1><a href="/{{$.Namespace}}">syzbot</a></h1> <select class="namespace" onchange="window.location.href = '/' + this.value + '{{.Subpage}}';"> - {{range $ns := .Namespaces}} + {{- range $ns := .Namespaces}} <option value="{{$ns.Name}}" {{if eq $.Namespace $ns.Name}}selected="1"{{end}}> - {{$ns.Caption}} + {{- $ns.Caption -}} </option> - {{end}} + {{- end -}} </select> </td> <td class="search"> |
