aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo
Commit message (Collapse)AuthorAgeFilesLines
* Add reviewers selection to new pull request (#32403)Calvin K2024-11-094-85/+99
| | | | | | | | | | Users could add reviewers when creating new PRs. --------- Co-authored-by: splitt3r <splitt3r@users.noreply.github.com> Co-authored-by: Sebastian Sauer <sauer.sebastian@gmail.com> Co-authored-by: bb-ben <70356237+bboerben@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix issue sidebar (#32455)wxiaoguang2024-11-093-14/+13
| | | | | | | | | | | | | | | | | | | | | Fix #32453 Major changes: * revert the `<div class="divider"></div>` in `templates/repo/issue/branch_selector_field.tmpl` (it was removed by mistake in ##32444) * remove incorrect `<div class="inline field">` in `templates/repo/issue/sidebar/allow_maintainer_edit.tmpl` * use `gt-ellipsis` to replace the "title" class in the dependency list, then `.repository .issue-content-right .ui.list .title` could be removed * remove the "relaxed" from dependency list, then there is no padding, then `.repository .issue-content-right .ui.list .dependency` could be removed (`white-space` doesn't have effect either because there is `gt-ellipsis`) * remove dead code `.repository .issue-content-right #deadlineForm input ` The fixed UI should be the same as before.
* Refactor issue page info (#32445)wxiaoguang2024-11-083-11/+6
| | | Fix a longstanding TODO since 2021 (#14826) / 2018 (#2531)
* Split issue sidebar into small templates (#32444)wxiaoguang2024-11-0815-676/+675
| | | Only move code
* Support quote selected comments to reply (#32431)wxiaoguang2024-11-075-14/+14
| | | | | | | | | Many existing tests were quite hacky, these could be improved later. <details> ![image](https://github.com/user-attachments/assets/93aebb4f-9de5-4cb8-910b-50c64cbcd25a) </details>
* Fix milestone deadline and date related problems (#32339)Lunny Xiao2024-11-053-36/+23
| | | | | | | | | Use zero instead of 9999-12-31 for deadline Fix #32291 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor template ctx and render utils (#32422)wxiaoguang2024-11-0528-88/+88
| | | Clean up the templates
* Refactor DateUtils and merge TimeSince (#32409)wxiaoguang2024-11-0435-56/+56
| | | Follow #32383 and #32402
* Replace DateTime with proper functions (#32402)wxiaoguang2024-11-023-6/+8
| | | | | | | | | Follow #32383 This PR cleans up the "Deadline" usages in templates, make them call `ParseLegacy` first to get a `Time` struct then display by `DateUtils`. Now it should be pretty clear how "deadline string" works, it makes it possible to do further refactoring and correcting.
* Replace DateTime with DateUtils (#32383)wxiaoguang2024-11-029-10/+10
|
* remove unused call to $.HeadRepo in view_title template (#32317)Rowan Bohde2024-10-301-1/+1
| | | | | | | | | | | | This is only populated in [`ParseCompareInfo`](https://github.com/search?q=repo%3Ago-gitea%2Fgitea%20%20.Data%5B%22HeadRepo%22%5D&type=code) which is called in two handlers: * [`CompareAndPullRequestPost`](https://github.com/go-gitea/gitea/blob/9206fbb55fd28f21720072fce6a36cc22277934c/routers/web/repo/pull.go#L1246) - a JSON post handler that doesn't render templates * [`CompareDiff`](https://github.com/go-gitea/gitea/blob/9206fbb55fd28f21720072fce6a36cc22277934c/routers/web/repo/compare.go#L706) - which can render `diff/box.tmpl` and `diff/compare.tmpl`
* Make admins adhere to branch protection rules (#32248)Tim2024-10-232-1/+8
| | | | | | | | | | | | This introduces a new flag `BlockAdminMergeOverride` on the branch protection rules that prevents admins/repo owners from bypassing branch protection rules and merging without approvals or failing status checks. Fixes #17131 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* update git book link to v2 (#32221)Ehsan Shirvanian2024-10-091-1/+1
| | | | | | Fix the dead link `https://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository` for empty repositories to help how to clone the repository to `https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository` which is v2 of the git book. This also updates download git links
* Fix javascript error when an anonymous user visiting migration page (#32144)Lunny Xiao2024-10-021-1/+1
| | | | | | | | | | | | This PR fixes javascript errors when an anonymous user visits the migration page. It also makes task view checking more restrictive. The router moved from `/user/task/{id}/status` to `/username/reponame/-/migrate/status` because it's a migrate status. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support repo license (#24872)yp053272024-10-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close #278 Close #24076 ## Solutions: - Use [google/licenseclassifier](https://github.com/google/licenseclassifier/) Test result between [google/licensecheck](https://github.com/google/licensecheck) and [go-license-detector](https://github.com/go-enry/go-license-detector): https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167 Test result between [google/licensecheck](https://github.com/google/licensecheck) and [google/licenseclassifier](https://github.com/google/licenseclassifier/): https://github.com/go-gitea/gitea/pull/24872#issuecomment-1576092178 - Generate License Convert Name List to avoid import license templates with same contents Gitea automatically get latest license data from[ spdx/license-list-data](https://github.com/spdx/license-list-data). But unfortunately, some license templates have same contents. #20915 [click here to see the list](https://github.com/go-gitea/gitea/pull/24872#issuecomment-1584141684) So we will generate a list of these license templates with same contents and create a new file to save the result when using `make generate-license`. (Need to decide the save path) - Save License info into a new table `repo_license` Can easily support searching repo by license in the future. ## Screen shot Single License: ![image](https://github.com/go-gitea/gitea/assets/18380374/41260bd7-0b4c-4038-8592-508706cffa9f) Multiple Licenses: ![image](https://github.com/go-gitea/gitea/assets/18380374/34ce2f73-7e18-446b-9b96-ecc4fb61bd70) Triggers: - [x] Push commit to default branch - [x] Create repo - [x] Mirror repo - [x] When Default Branch is changed, licenses should be updated Todo: - [x] Save Licenses info in to DB when there's a change to license file in the commit - [x] DB Migration - [x] A nominal test? - [x] Select which library to use(https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167) - [x] API Support - [x] Add repo license table - ~Select license in settings if there are several licenses(Not recommended)~ - License board(later, not in this PR) ![image](https://github.com/go-gitea/gitea/assets/18380374/2c3c3bf8-bcc2-4c6d-8ce0-81d1a9733878) --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Denys Konovalov <kontakt@denyskon.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <m.huber@kithara.com> Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: techknowlogick <techknowlogick@gitea.com>
* Display head branch more comfortable on pull request view (#32000)Lunny Xiao2024-09-241-2/+7
| | | | | | | | | | This PR do some minor improvements for head branch display on pull request view UI. - [x] Remove the link if the head branch has been deleted with a tooltip, so that users will not result in a 404 page - [x] Display a label if this pull request is an agit based one. ![图片](https://github.com/user-attachments/assets/872f26b6-f1cf-4427-9e41-e3a5b176dfa4)
* Fix template bug of pull request view (#32072)Lunny Xiao2024-09-241-1/+1
| | | Caused by #31924
* Allow set branch protection in an empty repository (#32095)Lunny Xiao2024-09-242-17/+13
|
* Fix Bug in Issue/pulls list (#32081)cloudchamb3r2024-09-241-2/+2
| | | | | | | | | | | | | | | | fix #32080 ## After ### for opened issues <img width="1199" alt="Screenshot 2024-09-19 at 6 29 31 PM" src="https://github.com/user-attachments/assets/86cf48ad-5e4b-4dcb-8abe-4d7fd74e0aec"> ### for closed issues <img width="1208" alt="Screenshot 2024-09-19 at 6 29 37 PM" src="https://github.com/user-attachments/assets/a16bc545-bfcf-49a4-be52-3e7334910482"> ### for all issues <img width="1340" alt="Screenshot 2024-09-20 at 12 07 12 PM" src="https://github.com/user-attachments/assets/b2309c8f-e59d-44e9-ae3b-bf54e1196169">
* Fix rename branch permission bug (#32066)Lunny Xiao2024-09-221-1/+1
| | | | | | The previous implementation requires admin permission to rename branches which should be write permission. Fix #31993
* Included tag search capabilities (#32045)Bruno Sofiato2024-09-181-4/+12
| | | | | | | | | | | | | | | | | | | | | Resolves #31998 The first screenshot shows the tag page without any filter being applied: ![image](https://github.com/user-attachments/assets/eac0e51c-9e48-42b2-bb1c-a25896ca40cb) The second one, shows the page when the given filter returns no tag: ![image](https://github.com/user-attachments/assets/98df191e-1a7b-4947-b0ef-4987a0293c3e) The last one shows a single tag being filtered: ![image](https://github.com/user-attachments/assets/79c7e05e-8c86-4f06-b17e-15818b7b9291) Signed-off-by: Bruno Sofiato <bruno.sofiato@gmail.com>
* Support migration from AWS CodeCommit (#31981)Zettat1232024-09-111-0/+117
| | | | | | | | | | | | | | | | | | | | This PR adds support for migrating repos from [AWS CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html). The access key ID and secret access key are required to get repository information and pull requests. And [HTTPS Git credentials](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html) are required to clone the repository. <img src="https://github.com/user-attachments/assets/82ecb2d0-8d43-42b0-b5af-f5347a13b9d0" width="680" /> The AWS CodeCommit icon is from [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/). <img src="https://github.com/user-attachments/assets/3c44d21f-d753-40f5-9eae-5d3589e0d50d" width="320" />
* Distinguish official vs non-official reviews, add tool tips, and upgr… ↵william-allspice2024-09-063-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#31924) This Pull Request is a follow up to https://github.com/go-gitea/gitea/pull/31886: 1. Adds a UI indicator between official (green) and unofficial (grey) approved pull requests on the Pull Request page (as suggested by @kdumontnu ) 2. Adds tooltips adding clarity to the type and status of a review on the Pull Request page (as suggested by @kdumontnu) 3. Updates text adding more clarity to required approvals (as suggested by @kdumontnu) 4. Updates text on the branch settings page explaining what branch approval limitations (as suggested by @yp05327) Official approval: <img width="376" alt="Screenshot 2024-08-26 at 1 03 52 PM" src="https://github.com/user-attachments/assets/500f083d-bfc0-45c5-82b7-b98e20495696"> Unofficial approval: <img width="442" alt="Screenshot 2024-08-26 at 12 53 15 PM" src="https://github.com/user-attachments/assets/e8c565ff-5886-4ce1-8b79-a0fa26c282f7"> Rejected approval: <img width="452" alt="Screenshot 2024-08-26 at 12 53 06 PM" src="https://github.com/user-attachments/assets/aebc0e2f-7052-4dea-8098-7caa0db86617"> Stale approval: <img width="546" alt="Screenshot 2024-08-26 at 1 07 59 PM" src="https://github.com/user-attachments/assets/da599ff3-e35c-4fa3-8141-ed80b738dd77"> Requested review tooltip: <img width="434" alt="Screenshot 2024-08-26 at 12 53 22 PM" src="https://github.com/user-attachments/assets/460d163e-8724-43b6-8760-34b285da8fe2"> Updated text for approvals: <img width="991" alt="Screenshot 2024-08-26 at 12 54 00 PM" src="https://github.com/user-attachments/assets/ab3ff012-9742-4c1b-933d-21addcb89f2c"> Updated text for allowlisted/whitelisted approvals: <img width="990" alt="Screenshot 2024-08-26 at 1 01 40 PM" src="https://github.com/user-attachments/assets/1a5bae61-d9e0-4d96-b86f-92610b0940d1"> Protected branch settings text: <img width="1022" alt="Screenshot 2024-08-26 at 1 01 14 PM" src="https://github.com/user-attachments/assets/892ce208-e1c2-41f7-8fec-46d5a0e7e776"> Comments list: <img width="1048" alt="Screenshot 2024-08-28 at 9 25 31 AM" src="https://github.com/user-attachments/assets/9c5c00c5-06cf-43b3-b413-4f7f673609b2"> --------- Co-authored-by: Kyle D. <kdumontnu@gmail.com>
* Remove urls from translations (#31950)Denys Konovalov2024-09-023-5/+5
| | | | | | | Part of #27700 Removes all URLs from translation strings to easy up changing them in the future and to exclude people injecting malicious URLs through translations. First measure as long as #24402 is out of scope.
* Move lock icon position and add additional tooltips to branch list page (#31839)william-allspice2024-08-211-7/+11
| | | This Pull Request adds missing tool tips for the protected, copy, and rss icons on the branch list page. It also moved protected icon position after the branch name.
* Add tag name in the commits list (#31082)Lunny Xiao2024-08-193-3/+9
| | | | | | | | | | | | | | | Fix #10036 This PR adds some labels for tags of this commit after the commit message on the commits table. The tag template is share as commit graph's. Desktop: <img width="1302" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/ba94e1e6-2a3d-44f3-85a3-575fb5667c97"> Mobile: <img width="370" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/e3eb1f44-3686-4012-aa9d-52cd88b22c0e">
* Actions support workflow dispatch event (#28163)胖梁2024-08-182-0/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix #23668 My plan: * In the `actions.list` method, if workflow is selected and IsAdmin, check whether the on event contains `workflow_dispatch`. If so, display a `Run workflow` button to allow the user to manually trigger the run. * Providing a form that allows users to select target brach or tag, and these parameters can be configured in yaml * Simple form validation, `required` input cannot be empty * Add a route `/actions/run`, and an `actions.Run` method to handle * Add `WorkflowDispatchPayload` struct to pass the Webhook event payload to the runner when triggered, this payload carries the `inputs` values and other fields, doc: [workflow_dispatch payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_dispatch) Other PRs * the `Workflow.WorkflowDispatchConfig()` method still return non-nil when workflow_dispatch is not defined. I submitted a PR https://gitea.com/gitea/act/pulls/85 to fix it. Still waiting for them to process. Behavior should be same with github, but may cause confusion. Here's a quick reminder. * [Doc](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch) Said: This event will `only` trigger a workflow run if the workflow file is `on the default branch`. * If the workflow yaml file only exists in a non-default branch, it cannot be triggered. (It will not even show up in the workflow list) * If the same workflow yaml file exists in each branch at the same time, the version of the default branch is used. Even if `Use workflow from` selects another branch ![image](https://github.com/go-gitea/gitea/assets/3114995/4bf596f3-426b-48e8-9b8f-0f6d18defd79) ```yaml name: Docker Image CI on: workflow_dispatch: inputs: logLevel: description: 'Log level' required: true default: 'warning' type: choice options: - info - warning - debug tags: description: 'Test scenario tags' required: false type: boolean boolean_default_true: description: 'Test scenario tags' required: true type: boolean default: true boolean_default_false: description: 'Test scenario tags' required: false type: boolean default: false environment: description: 'Environment to run tests against' type: environment required: true default: 'environment values' number_required_1: description: 'number ' type: number required: true default: '100' number_required_2: description: 'number' type: number required: true default: '100' number_required_3: description: 'number' type: number required: true default: '100' number_1: description: 'number' type: number required: false number_2: description: 'number' type: number required: false number_3: description: 'number' type: number required: false env: inputs_logLevel: ${{ inputs.logLevel }} inputs_tags: ${{ inputs.tags }} inputs_boolean_default_true: ${{ inputs.boolean_default_true }} inputs_boolean_default_false: ${{ inputs.boolean_default_false }} inputs_environment: ${{ inputs.environment }} inputs_number_1: ${{ inputs.number_1 }} inputs_number_2: ${{ inputs.number_2 }} inputs_number_3: ${{ inputs.number_3 }} inputs_number_required_1: ${{ inputs.number_required_1 }} inputs_number_required_2: ${{ inputs.number_required_2 }} inputs_number_required_3: ${{ inputs.number_required_3 }} jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - run: ls -la - run: env | grep inputs - run: echo ${{ inputs.logLevel }} - run: echo ${{ inputs.boolean_default_false }} ``` ![image](https://github.com/go-gitea/gitea/assets/3114995/a58a842d-a0ff-4618-bc6d-83a9596d07c8) ![image](https://github.com/go-gitea/gitea/assets/3114995/44a7cca5-7bd4-42a9-8723-91751a501c88) --------- Co-authored-by: TKaxv_7S <954067342@qq.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Denys Konovalov <kontakt@denyskon.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fixes for unreachable project issues when transfer repository from ↵Edip Emre Bodur2024-08-131-1/+2
| | | | | | | | | | | | | | organization (#31770) When transferring repositories that have issues linked to a project board to another organization, the issues remain associated with the original project board. This causes the columns in the project board to become bugged, making it difficult to move other issues in or out of the affected columns. As a solution, I removed the issue relations since the other organization does not have this project table. Fix for #31538 Co-authored-by: Jason Song <i@wolfogre.com>
* Support issue template assignees (#31083)Zettat1232024-08-121-4/+4
| | | Resolve #13955
* Show lock owner instead of repo owner on LFS setting page (#31788)Jason Song2024-08-111-3/+3
| | | | | | | | | | | | | Fix #31784. Before: <img width="1648" alt="image" src="https://github.com/user-attachments/assets/03f32545-4a85-42ed-bafc-2b193a5d8023"> After: <img width="1653" alt="image" src="https://github.com/user-attachments/assets/e5bcaf93-49cb-421f-aac1-5122bc488b02">
* Move repository visibility to danger zone in the settings area (#31126)Fábio Barkoski2024-08-111-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved repository visibility to the danger zone in the settings area. To change the visibility, it is necessary to go to the danger zone, click on the private/public button, and accept the change in the modal. Resolves: #23826 --- ## Screenshots <details> <summary>Before</summary> Private repo: ![Private repo](https://github.com/go-gitea/gitea/assets/65479069/4313492a-4854-48bc-9f47-974e3539d791) Public repo: ![Public repo](https://github.com/go-gitea/gitea/assets/65479069/1c45f6e4-ee93-4799-9331-e9d4a7e0f16a) </details> <details> <summary>After</summary> Make private: ![Screenshot from 2024-05-28 21-35-38](https://github.com/go-gitea/gitea/assets/65479069/4887e28a-0514-4990-aa69-bf3ddc7e6c7d) Make private modal ![Screenshot from 2024-06-13 23-55-55](https://github.com/go-gitea/gitea/assets/65479069/9f5a7604-069b-41a2-973b-ee2d58e85953) ![Screenshot from 2024-06-13 23-53-09](https://github.com/go-gitea/gitea/assets/65479069/06c22726-eab2-4bce-8df7-62849dcce974) Make public: ![Screenshot from 2024-05-28 21-34-27](https://github.com/go-gitea/gitea/assets/65479069/6d388f99-0356-48a0-9d85-320cdba55179) Make public modal ![Screenshot from 2024-06-13 23-53-37](https://github.com/go-gitea/gitea/assets/65479069/8944972e-f2d4-4aea-ba96-b892febb5ced) </details> --------- Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
* Add warning message in merge instructions when `AutodetectManualMerge` was ↵a10121127962024-08-101-1/+7
| | | | | | | | | | | | | | | | | | | | not enabled (#31805) not enabled quick-f-i-x https://github.com/go-gitea/gitea/issues/31433 ? , maybe need more disscusion about better solutions. example view: ![image](https://github.com/user-attachments/assets/2af7e1e8-42b9-4473-89c7-12d4a9205d3f) adtion notes about how to enable `AutodetectManualMerge` ![image](https://github.com/user-attachments/assets/28f84317-367a-40d8-b50d-a19ef7c664d4) Signed-off-by: a1012112796 <1012112796@qq.com>
* Add issue comment when moving issues from one column to another of the ↵Lunny Xiao2024-08-091-0/+16
| | | | | | | | | | | | | | | | | project (#29311) Fix #27278 Replace #27816 This PR adds a meta-comment for an issue when dragging an issue from one column to another of a project. <img width="600" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/5fc1d954-430e-4db0-aaee-a00006fa91f5"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: yp05327 <576951401@qq.com>
* Fix the display of project type for deleted projects (#31732)yp053272024-07-301-4/+10
| | | | | | Fix: #31727 After: ![image](https://github.com/user-attachments/assets/1dfb4b31-3bd6-47f7-b126-650f33f453e2)
* Added default sorting milestones by name (#27084)Bartlomiej Komendarczuk2024-07-161-0/+1
| | | | | | | | | | #26996 Added default sorting for milestones by name. Additional, name for sorting closestduedate and furthestduedate was broken, so I fixed it. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Code editor theme enhancements (#31629)silverwind2024-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 1. Fixed border-radius 2. Monaco ignores the alpha channel on the shadow color, introduce `color-shadow-opaque` 3. Remove scrollbar color which follows https://github.com/go-gitea/gitea/pull/29800 Before: <img width="34" alt="Screenshot 2024-07-13 at 15 38 18" src="https://github.com/user-attachments/assets/042d9bde-6db9-4467-a2a4-8f61ecc773eb"> <img width="35" alt="Screenshot 2024-07-13 at 15 38 31" src="https://github.com/user-attachments/assets/04146ee0-551c-4ff2-9636-bd119b33595a"> After: <img width="45" alt="Screenshot 2024-07-13 at 15 38 06" src="https://github.com/user-attachments/assets/1f58fa5a-1289-4e45-83c9-18ca82a5e266"> <img width="39" alt="Screenshot 2024-07-13 at 21 16 56" src="https://github.com/user-attachments/assets/e12ebe22-b29b-4798-9f0d-4c100f311562">
* Don't show hidden labels when filling out an issue template (#31576)65432024-07-081-1/+1
| | | | | | | Related to #31574 --- *Sponsored by Kithara Software GmbH*
* Allow force push to protected branches (#28086)Henry Goodman2024-07-051-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #22722 ### Problem Currently, it is not possible to force push to a branch with branch protection rules in place. There are often times where this is necessary (CI workflows/administrative tasks etc). The current workaround is to rename/remove the branch protection, perform the force push, and then reinstate the protections. ### Solution Provide an additional section in the branch protection rules to allow users to specify which users with push access can also force push to the branch. The default value of the rule will be set to `Disabled`, and the UI is intuitive and very similar to the `Push` section. It is worth noting in this implementation that allowing force push does not override regular push access, and both will need to be enabled for a user to force push. This applies to manual force push to a remote, and also in Gitea UI updating a PR by rebase (which requires force push) This modifies the `BranchProtection` API structs to add: - `enable_force_push bool` - `enable_force_push_whitelist bool` - `force_push_whitelist_usernames string[]` - `force_push_whitelist_teams string[]` - `force_push_whitelist_deploy_keys bool` ### Updated Branch Protection UI: <img width="943" alt="image" src="https://github.com/go-gitea/gitea/assets/79623665/7491899c-d816-45d5-be84-8512abd156bf"> ### Pull Request `Update branch by Rebase` option enabled with source branch `test` being a protected branch: ![image](https://github.com/go-gitea/gitea/assets/79623665/e018e6e9-b7b2-4bd3-808e-4947d7da35cc) <img width="1038" alt="image" src="https://github.com/go-gitea/gitea/assets/79623665/57ead13e-9006-459f-b83c-7079e6f4c654"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Always use HTML attributes for avatar size (#31509)silverwind2024-06-284-7/+7
| | | | | | | | | | Many avatars were rendered in HTML with certain width/height but then resized again in CSS. This was pointless so I removed all these cases and made the HTML size match the previous render size. Also did a few CSS cleanups in the tribute rendering: <img width="648" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/cb2fafb3-5e20-46e9-814f-07df20038beb">
* use correct l10n string (#31487)CyberFlame2024-06-251-1/+1
| | | | | | | | Uses the correct string for searching - this is what it looks like prior to the change: ![image](https://github.com/go-gitea/gitea/assets/24910512/38519825-c347-44d6-85d4-6fa3c71ddb7c) (observe how the top box has "Search teams" even though collaborator would be user
* Disable issue/PR comment button given empty input (#31463)Kemal Zebari2024-06-231-1/+1
| | | | | | | | | | | Given an empty issue/PR comment, the comment history would not be updated if the user were to submit it. Therefore, it would make since to just disable the comment button when the text editor is empty. This is inline with what GitHub does when given empty text editor input. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor image diff (#31444)wxiaoguang2024-06-221-1/+1
| | | And remove some jQuery functions
* Fix the link for .git-blame-ignore-revs bypass (#31432)wxiaoguang2024-06-201-1/+1
| | | A quick fix for #31429
* Fix the wrong line number in the diff view page when expanded twice. (#31431)charles2024-06-201-3/+3
| | | close #31149, regression of #29385 (incorrect `data-query=`)
* Refactor repo unit "disabled" check (#31389)wxiaoguang2024-06-184-6/+4
| | | | | | | | 1. There are already global "unit consts", no need to use context data, which is fragile 2. Remove the "String()" method from "unit", it would only cause rendering problems in templates --------- Co-authored-by: silverwind <me@silverwind.io>
* Improve detecting empty files (#31332)wxiaoguang2024-06-134-6/+8
| | | Co-authored-by: silverwind <me@silverwind.io>
* Fix navbar `+` menu flashing on page load (#31281)silverwind2024-06-121-13/+11
| | | | | | | | | | | Fixes https://github.com/go-gitea/gitea/pull/31273#issuecomment-2153771331. Same method as used in https://github.com/go-gitea/gitea/pull/30215. All left-opening dropdowns need to use it method. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* code optimization (#31315)Kerwin Bryant2024-06-117-10/+10
| | | Simplifying complex if-else to existing Iif operations
* Remove jQuery `.text()` (#30506)silverwind2024-06-102-7/+7
| | | | | | | | | Remove and forbid [.text()](https://api.jquery.com/text/). Tested some, but not all functionality, but I think these are pretty safe replacements. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Allow including `Reviewed-on`/`Reviewed-by` lines for custom merge messages ↵Max Wipfli2024-06-061-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#31211) This PR introduces the `ReviewedOn` and `ReviewedBy` variables for the default merge message templates (e.g., `.gitea/default_merge_message/MERGE_TEMPLATE.md`). This allows customizing the default merge messages while retaining these trailers. This also moves the associated logic out of `pull.tmpl` into the relevant Go function. This is a first contribution towards #11077. --- For illustration, this allows to recreate the "default default" merge message with the following template: ``` .gitea/default_merge_message/MERGE_TEMPLATE.md Merge pull request '${PullRequestTitle}' (${PullRequestReference}) from ${HeadBranch} into ${BaseBranch} ${ReviewedOn} ${ReviewedBy} ```