loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(ui/migrations): clarify desired autocompletion type for clone_addr (#7377)

* Firefox thinks that this is a login form and that `clone_addr` is it's username field
* It would have been an easy fix with with `autocomplete="off"`, but there's an issue with that approach: Firefox plays a cat-mouse game with web developers and intentionally ignores `autocomplete="off"` "for users' security".
* Set it to the `url` autocompletion type, Firefox and maybe other browsers give actually somewhat relevant completion entries. They will not be always relevant, but they may be when a migration has to be re-done with different settings.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7377
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>

authored by

0ko
0ko
and committed by
Gusted
a23d0453 bb4e1f42

+13 -11
+1 -1
templates/repo/migrate/codebase.tmpl
··· 13 13 {{template "base/alert" .}} 14 14 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 15 15 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 16 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 16 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 17 17 <span class="help"> 18 18 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} 19 19 </span>
+1 -1
templates/repo/migrate/git.tmpl
··· 13 13 {{template "base/alert" .}} 14 14 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 15 15 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 16 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 16 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 17 17 <span class="help"> 18 18 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} 19 19 </span>
+1 -1
templates/repo/migrate/gitbucket.tmpl
··· 13 13 {{template "base/alert" .}} 14 14 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 15 15 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 16 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 16 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 17 17 <span class="help"> 18 18 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} 19 19 </span>
+1 -1
templates/repo/migrate/gitea.tmpl
··· 12 12 {{template "base/alert" .}} 13 13 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 14 14 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 15 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 15 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 16 16 <span class="help"> 17 17 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} 18 18 </span>
+1 -1
templates/repo/migrate/github.tmpl
··· 12 12 {{template "base/alert" .}} 13 13 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 14 14 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 15 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 15 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 16 16 <span class="help"> 17 17 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}} 18 18 </span>
+1 -1
templates/repo/migrate/gitlab.tmpl
··· 12 12 {{template "base/alert" .}} 13 13 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 14 14 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 15 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 15 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 16 16 <span class="help"> 17 17 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} 18 18 </span>
+1 -1
templates/repo/migrate/gogs.tmpl
··· 12 12 {{template "base/alert" .}} 13 13 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 14 14 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 15 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 15 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 16 16 <span class="help"> 17 17 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} 18 18 </span>
+1 -1
templates/repo/migrate/onedev.tmpl
··· 13 13 {{template "base/alert" .}} 14 14 <div class="inline required field {{if .Err_CloneAddr}}error{{end}}"> 15 15 <label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label> 16 - <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required> 16 + <input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required autocomplete="url"> 17 17 <span class="help"> 18 18 {{ctx.Locale.Tr "repo.migrate.clone_address_desc"}}{{if .ContextUser.CanImportLocal}} {{ctx.Locale.Tr "repo.migrate.clone_local_path"}}{{end}} 19 19 </span>
+5 -3
tests/integration/repo_migration_ui_test.go
··· 79 79 items := page.Find("#migrate_items .field .checkbox input") 80 80 testRepoMigrationFormItems(t, items, migration.ExpectedItems) 81 81 82 - descriptionInput := page.Find("#description") 83 - assert.Equal(t, 1, descriptionInput.Length()) 82 + page.AssertElement(t, "#clone_addr", true) 83 + autocomplete, _ := page.Find("#clone_addr").Attr("autocomplete") 84 + assert.Equal(t, "url", autocomplete) 84 85 85 - _, descriptionHasPlaceholder := descriptionInput.Attr("placeholder") 86 + page.AssertElement(t, "#description", true) 87 + _, descriptionHasPlaceholder := page.Find("#description").Attr("placeholder") 86 88 assert.Equal(t, migration.DescriptionHasPlaceholder, descriptionHasPlaceholder) 87 89 }) 88 90 }