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.

Merge pull request 'feat(i18n): Heading for new branch rule, colon consistency' (#4993) from fnetx/branchprotection-fixes into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4993
Reviewed-by: 0ko <0ko@noreply.codeberg.org>

Otto 66d06c2b 53187cd5

+40 -13
+11 -10
options/locale/locale_en-US.ini
··· 2468 2468 settings.protected_branch.save_rule = Save rule 2469 2469 settings.protected_branch.delete_rule = Delete rule 2470 2470 settings.branch_protection = Protection rules for branch "<b>%s</b>" 2471 + settings.protect_new_rule = Create a new branch protection rule 2471 2472 settings.protect_this_branch = Enable branch protection 2472 2473 settings.protect_this_branch_desc = Prevents deletion and restricts Git pushing and merging to the branch. 2473 2474 settings.protect_disable_push = Disable push ··· 2479 2480 settings.protect_whitelist_committers = Whitelist restricted push 2480 2481 settings.protect_whitelist_committers_desc = Only whitelisted users or teams will be allowed to push to this branch (but not force push). 2481 2482 settings.protect_whitelist_deploy_keys = Whitelist deploy keys with write access to push. 2482 - settings.protect_whitelist_users = Whitelisted users for pushing: 2483 - settings.protect_whitelist_teams = Whitelisted teams for pushing: 2483 + settings.protect_whitelist_users = Whitelisted users for pushing 2484 + settings.protect_whitelist_teams = Whitelisted teams for pushing 2484 2485 settings.protect_merge_whitelist_committers = Enable merge whitelist 2485 2486 settings.protect_merge_whitelist_committers_desc = Allow only whitelisted users or teams to merge pull requests into this branch. 2486 - settings.protect_merge_whitelist_users = Whitelisted users for merging: 2487 - settings.protect_merge_whitelist_teams = Whitelisted teams for merging: 2487 + settings.protect_merge_whitelist_users = Whitelisted users for merging 2488 + settings.protect_merge_whitelist_teams = Whitelisted teams for merging 2488 2489 settings.protect_check_status_contexts = Enable status check 2489 - settings.protect_status_check_patterns = Status check patterns: 2490 + settings.protect_status_check_patterns = Status check patterns 2490 2491 settings.protect_status_check_patterns_desc = Enter patterns to specify which status checks must pass before branches can be merged into a branch that matches this rule. Each line specifies a pattern. Patterns cannot be empty. 2491 2492 settings.protect_check_status_contexts_desc = Require status checks to pass before merging. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. If no contexts are matched, the last commit must be successful regardless of context. 2492 2493 settings.protect_check_status_contexts_list = Status checks found in the last week for this repository 2493 2494 settings.protect_status_check_matched = Matched 2494 2495 settings.protect_invalid_status_check_pattern = Invalid status check pattern: "%s". 2495 2496 settings.protect_no_valid_status_check_patterns = No valid status check patterns. 2496 - settings.protect_required_approvals = Required approvals: 2497 + settings.protect_required_approvals = Required approvals 2497 2498 settings.protect_required_approvals_desc = Allow only to merge pull request with enough positive reviews. 2498 2499 settings.protect_approvals_whitelist_enabled = Restrict approvals to whitelisted users or teams 2499 2500 settings.protect_approvals_whitelist_enabled_desc = Only reviews from whitelisted users or teams will count to the required approvals. Without approval whitelist, reviews from anyone with write access count to the required approvals. 2500 - settings.protect_approvals_whitelist_users = Whitelisted reviewers: 2501 - settings.protect_approvals_whitelist_teams = Whitelisted teams for reviews: 2501 + settings.protect_approvals_whitelist_users = Whitelisted reviewers 2502 + settings.protect_approvals_whitelist_teams = Whitelisted teams for reviews 2502 2503 settings.dismiss_stale_approvals = Dismiss stale approvals 2503 2504 settings.dismiss_stale_approvals_desc = When new commits that change the content of the pull request are pushed to the branch, old approvals will be dismissed. 2504 2505 settings.ignore_stale_approvals = Ignore stale approvals ··· 2508 2509 settings.protect_branch_name_pattern = Protected branch name pattern 2509 2510 settings.protect_branch_name_pattern_desc = Protected branch name patterns. See <a href="https://github.com/gobwas/glob">the documentation</a> for pattern syntax. Examples: main, release/** 2510 2511 settings.protect_patterns = Patterns 2511 - settings.protect_protected_file_patterns = Protected file patterns (separated using semicolon ";"): 2512 + settings.protect_protected_file_patterns = Protected file patterns (separated using semicolon ";") 2512 2513 settings.protect_protected_file_patterns_desc = Protected files are not allowed to be changed directly even if user has rights to add, edit, or delete files in this branch. Multiple patterns can be separated using semicolon (";"). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>. 2513 - settings.protect_unprotected_file_patterns = Unprotected file patterns (separated using semicolon ";"): 2514 + settings.protect_unprotected_file_patterns = Unprotected file patterns (separated using semicolon ";") 2514 2515 settings.protect_unprotected_file_patterns_desc = Unprotected files that are allowed to be changed directly if user has write access, bypassing push restriction. Multiple patterns can be separated using semicolon (";"). See <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> documentation for pattern syntax. Examples: <code>.drone.yml</code>, <code>/docs/**/*.txt</code>. 2515 2516 settings.add_protected_branch = Enable protection 2516 2517 settings.delete_protected_branch = Disable protection
+5 -1
templates/repo/settings/protected_branch.tmpl
··· 1 1 {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings branches")}} 2 2 <div class="repo-setting-content"> 3 3 <h4 class="ui top attached header"> 4 - {{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}} 4 + {{if .Rule.RuleName}} 5 + {{ctx.Locale.Tr "repo.settings.branch_protection" .Rule.RuleName}} 6 + {{else}} 7 + {{ctx.Locale.Tr "repo.settings.protect_new_rule"}} 8 + {{end}} 5 9 </h4> 6 10 <form class="ui form attached segment" action="{{.Link}}" method="post"> 7 11 {{.CsrfTokenHtml}}
+14 -2
tests/e2e/repo-settings.test.e2e.js
··· 31 31 const response = await page.goto('/user2/repo1/settings/branches/edit'); 32 32 await expect(response?.status()).toBe(200); 33 33 34 - // not yet accessible :( 35 - // await validate_form({page}, 'fieldset'); 34 + await validate_form({page}, 'fieldset'); 35 + 36 + // verify header is new 37 + await expect(page.locator('h4')).toContainText('new'); 38 + await page.locator('input[name="rule_name"]').fill('testrule'); 39 + await page.getByText('Save rule').click(); 40 + // verify header is in edit mode 41 + await page.waitForLoadState('networkidle'); 42 + await page.getByText('Edit').click(); 43 + await expect(page.locator('h4')).toContainText('Protection rules for branch'); 44 + // delete the rule for the next test 45 + await page.goBack(); 46 + await page.getByText('Delete rule').click(); 47 + await page.getByText('Yes').click(); 36 48 });
+10
tests/e2e/shared/forms.js
··· 4 4 export async function validate_form({page}, scope) { 5 5 scope ??= 'form'; 6 6 const accessibilityScanResults = await new AxeBuilder({page}) 7 + // disable checking for link style - should be fixed, but not now 8 + .disableRules('link-in-text-block') 7 9 .include(scope) 8 10 // exclude automated tooltips from accessibility scan, remove when fixed 9 11 .exclude('span[data-tooltip-content') 12 + // exclude weird non-semantic HTML disabled content 13 + .exclude('.disabled') 10 14 .analyze(); 11 15 expect(accessibilityScanResults.violations).toEqual([]); 12 16 ··· 16 20 await expect(b).toHaveCSS('margin-left', '0px'); 17 21 await expect(b).toHaveCSS('margin-top', '0px'); 18 22 await expect(b).toHaveCSS('vertical-align', 'baseline'); 23 + } 24 + // assert no (trailing) colon is used in labels 25 + // might be necessary to adjust in case colons are strictly necessary in help text 26 + for (const l of await page.locator('label').all()) { 27 + const str = await l.textContent(); 28 + await expect(str.split('\n')[0]).not.toContain(':'); 19 29 } 20 30 }