summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Changelog 1.18.5 (#23045)v1.18.5John Olheiser2023-02-211-0/+13
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Return empty url for submodule tree entries (#23043) (#23048)Yarden Shoham2023-02-211-0/+5
| | | | | | | | | | | | | Backport #23043 Close #22614. Refer to [Github's API](https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#get-a-tree), if a tree entry is a submodule, its url will be an empty string. Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: delvh <leon@kske.dev> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Display attachments of review comment when comment content is blank (#23035) ↵John Olheiser2023-02-211-1/+1
| | | | | | | (#23046) Backport #23035 Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
* Use beforeCommit instead of baseCommit (#22949) (#22996)Kyle D2023-02-2119-10/+109
| | | | | | | Backport #22949 Fixes https://github.com/go-gitea/gitea/issues/22946 Probably related to https://github.com/go-gitea/gitea/issues/19530 Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Add force_merge to merge request and fix checking mergable (#23010) (#23032)Jason Song2023-02-216-20/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | Backport #23010. Fix #23000. The bug was introduced in #22633, and it seems that it has been noticed: https://github.com/go-gitea/gitea/pull/22633#discussion_r1095395359 . However, #22633 did nothing wrong, the logic should be "check if they is admin only when `force` is true". So we should provide the `ForceMerge` when merging from UI. After this, an admin can also send a normal merge request with `ForceMerge` false. So it fixes a potential bug: if the admin doesn't want to do a force merge, they just see the green "Merge" button and click it. At the same time, the status of the PR changed, and it shouldn't be merged now, so the admin could send an unexpected force merge. In addition, I updated `ForceMerge *bool` to `ForceMerge bool`, I don't see the reason to use a pointer. And fixed the logic of CheckPullMergable to handle auto merge and force merge correctly.
* Render access log template as text instead of HTML (#23013) (#23025)Yarden Shoham2023-02-211-1/+1
| | | | | | | Backport #23013 Fix https://github.com/go-gitea/gitea/pull/22906#discussion_r1112106675 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix the Manually Merged form (#23015) (#23017)wxiaoguang2023-02-212-13/+11
| | | | | | | Backport #23015 --------- Co-authored-by: Jason Song <i@wolfogre.com>
* Use `--message=%s` for git commit message (#23028) (#23029)wxiaoguang2023-02-213-6/+6
| | | | | Backport #23028 This backport is done by manually because the git module is different.
* Hide 2FA status from other members in organization members list (#22999) ↵Yarden Shoham2023-02-201-0/+2
| | | | | | | | | | (#23023) Backport #22999 This is rather private information that should not be given to all members in the same organization. Only show it to organization owners. Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* Add 1.18.4 changelog (#22991)v1.18.4Lunny Xiao2023-02-201-0/+37
| | | | | | | Feel free to change the content. @go-gitea/maintainers --------- Co-authored-by: delvh <dev.lh@web.de>
* Provide the ability to set password hash algorithm parameters (#22942) (#22943)zeripath2023-02-1925-151/+805
| | | | | | | | | | | | | | | | | | | | | | | | Backport #22942 This PR refactors and improves the password hashing code within gitea and makes it possible for server administrators to set the password hashing parameters In addition it takes the opportunity to adjust the settings for `pbkdf2` in order to make the hashing a little stronger. The majority of this work was inspired by PR #14751 and I would like to thank @boppy for their work on this. Thanks to @gusted for the suggestion to adjust the `pbkdf2` hashing parameters. Close #14751 --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Notify on container image create (#22806) (#22965)Yarden Shoham2023-02-181-4/+22
| | | | | | | | | | | Backport #22806 Fixes #22791 --------- Signed-off-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix 404 error viewing the LFS file (#22945) (#22948)Yarden Shoham2023-02-171-1/+1
| | | | | | | | | | | | Backport #22945 Fix #22734. According to [`view_file.tmpl`](https://github.com/go-gitea/gitea/blob/main/templates/repo/view_file.tmpl#L82), `lfs_file.tmpl` should use `AssetUrlPrefix` instead of `AppSubUrl`. Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com>
* Fix blame view missing lines (#22826) (#22929)zeripath2023-02-172-24/+22
| | | | | | | | | | | | | Backport #22826 Creating a new buffered reader for every part of the blame can miss lines, as it will read and buffer bytes that the next buffered reader will not get. --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Brecht Van Lommel <brecht@blender.org> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* some refactor about code comments(#20821) (#22707)Lunny Xiao2023-02-167-188/+260
| | | | | | fix #22691 backport #20821 Co-authored-by: zeripath <art27@cantab.net>
* Add command to bulk set must-change-password (#22823) (#22928)zeripath2023-02-1610-396/+587
| | | | | | | | | | | | | Backport #22823 As part of administration sometimes it is appropriate to forcibly tell users to update their passwords. This PR creates a new command `gitea admin user must-change-password` which will set the `MustChangePassword` flag on the provided users. --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Jason Song <i@wolfogre.com>
* fix incorrect role labels for migrated issues and comments (#22914) (#22923)Yarden Shoham2023-02-163-4/+18
| | | | | | | | | | | | | | | | Backport #22914 Fix #22797. ## Reason If a comment was migrated from other platforms, this comment may have an original author and its poster is always not the original author. When the `roleDescriptor` func get the poster's role descriptor for a comment, it does not check if the comment has an original author. So the migrated comments' original authors might be marked as incorrect roles. Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Improve trace logging for pulls and processes (#22633) (#22812)zeripath2023-02-139-144/+227
| | | | | | | | | | | | | | | | | | Backport #22633 Our trace logging is far from perfect and is difficult to follow. This PR: * Add trace logging for process manager add and remove. * Fixes an errant read file for git refs in getMergeCommit * Brings in the pullrequest `String` and `ColorFormat` methods introduced in #22568 * Adds a lot more logging in to testPR etc. Ref #22578 --------- Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix PR file tree folders no longer collapsing (#22864) (#22872)Yarden Shoham2023-02-122-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #22864 Collapsing folders currently just throws a console error ``` index.js?v=1.19.0~dev-403-gb6b8feb3d:10 TypeError: this.$set is not a function at Proxy.handleClick (index.js?v=1.19.0~dev-403-gb6b8feb3d:58:7159) at index.js?v=1.19.0~dev-403-gb6b8feb3d:58:6466 at index.js?v=1.19.0~dev-403-gb6b8feb3d:10:93922 at ce (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:1472) at Q (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:1567) at HTMLDivElement.$e (index.js?v=1.19.0~dev-403-gb6b8feb3d:10:79198) ``` This PR fixes this and allows folders to be collapsed again. Also: - better cursor interaction with folders - added some color to the diff detail stats - remove green link color from all the file names Screenshots: ![image](https://user-images.githubusercontent.com/9765622/218269712-2f3dda55-6d70-407f-8d34-2a5d9c8df548.png) ![image](https://user-images.githubusercontent.com/9765622/218269714-6ce8a954-daea-4ed6-9eea-8b2323db4d8f.png) Co-authored-by: gempir <daniel.pasch.s@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* escape filename when assemble URL (#22850) (#22871)Yarden Shoham2023-02-122-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #22850 Fixes: #22843 ### Cause: https://github.com/go-gitea/gitea/blob/affdd40296960a08a4223330ccbd1fb88c96ea1a/services/repository/files/content.go#L161 Previously, we did not escape the **"%"** that might be in "treePath" when call "url.parse()". ![image](https://user-images.githubusercontent.com/33891828/218066318-5a909e50-2a17-46e6-b32f-684b2aa4b91f.png) This function will check whether "%" is the beginning of an escape character. Obviously, the "%" in the example (hello%mother.txt) is not that. So, the function will return a error. ### Solution: We can escape "treePath" by call "url.PathEscape()" function firstly. ### Screenshot: ![image](https://user-images.githubusercontent.com/33891828/218069781-1a030f8b-18d0-4804-b0f8-73997849ef43.png) Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Use proxy for pull mirror (#22771) (#22772)Gusted2023-02-113-4/+20
| | | | | | | | | | | - Backport #22771 - Use the proxy (if one is specified) for pull mirrors syncs. - Pulled the code from https://github.com/go-gitea/gitea/blob/c2774d9e80d9a436d9c2044960369c4db227e3a0/modules/git/repo.go#L164-L170 - Downstream issue: https://codeberg.org/forgejo/forgejo/issues/302 --------- Co-authored-by: zeripath <art27@cantab.net>
* Fix isAllowed of escapeStreamer (#22814) (#22837)Jason Song2023-02-101-17/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #22814. The use of `sort.Search` is wrong: The slice should be sorted, and `return >= 0` doen't mean it exists, see the [manual](https://pkg.go.dev/sort#Search). Could be fixed like this if we really need it: ```diff diff --git a/modules/charset/escape_stream.go b/modules/charset/escape_stream.go index 823b63513..fcf1ffbc1 100644 --- a/modules/charset/escape_stream.go +++ b/modules/charset/escape_stream.go @@ -20,6 +20,9 @@ import ( var defaultWordRegexp = regexp.MustCompile(`(-?\d*\.\d\w*)|([^\` + "`" + `\~\!\@\#\$\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s\x00-\x1f]+)`) func NewEscapeStreamer(locale translation.Locale, next HTMLStreamer, allowed ...rune) HTMLStreamer { + sort.Slice(allowed, func(i, j int) bool { + return allowed[i] < allowed[j] + }) return &escapeStreamer{ escaped: &EscapeStatus{}, PassthroughHTMLStreamer: *NewPassthroughStreamer(next), @@ -284,14 +287,8 @@ func (e *escapeStreamer) runeTypes(runes ...rune) (types []runeType, confusables } func (e *escapeStreamer) isAllowed(r rune) bool { - if len(e.allowed) == 0 { - return false - } - if len(e.allowed) == 1 { - return e.allowed[0] == r - } - - return sort.Search(len(e.allowed), func(i int) bool { + i := sort.Search(len(e.allowed), func(i int) bool { return e.allowed[i] >= r - }) >= 0 + }) + return i < len(e.allowed) && e.allowed[i] == r } ``` But I don't think so, a map is better to do it.
* Load issue before accessing index in merge message (#22822) (#22830)John Olheiser2023-02-091-0/+3
| | | | | | | Backport #22822 --------- Signed-off-by: jolheiser <john.olheiser@gmail.com>
* add default user visibility to cli command "admin user create" (#22750) (#22760)Yarden Shoham2023-02-081-0/+4
| | | | | | | Backport #22750 Fixes https://github.com/go-gitea/gitea/issues/22523 Co-authored-by: yp05327 <576951401@qq.com>
* Fix color of tertiary button on dark theme (#22739) (#22744)Yarden Shoham2023-02-081-3/+10
| | | | | | | | | | | | | | | | | Backport #22739 Before: <img width="266" alt="Screenshot 2023-02-03 at 14 07 34" src="https://user-images.githubusercontent.com/115237/216611151-92e98305-c4b5-42f3-b2e2-8b1b805fa644.png"> After: <img width="271" alt="Screenshot 2023-02-03 at 14 07 52" src="https://user-images.githubusercontent.com/115237/216611156-878a8a75-39a1-415b-9b6d-4f035985444e.png"> This is the only instance of such a button in all templates. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix restore repo bug, clarify the problem of ForeignIndex (#22776) (#22794)Yarden Shoham2023-02-083-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #22776 Fix #22581 TLDR: #18446 made a mess with ForeignIndex and triggered a design flaw/bug of #16356, then a quick patch #21271 helped #18446, then the the bug was re-triggered by #21721 . Related: * #16356 * BasicIssueContext https://github.com/go-gitea/gitea/pull/16356/files#diff-7938eb670d42a5ead6b08121e16aa4537a4d716c1cf37923c70470020fb9d036R16-R27 * #18446 * If some issues were dumped without ForeignIndex, then they would be imported as ForeignIndex=0 https://github.com/go-gitea/gitea/pull/18446/files#diff-1624a3e715d8fc70edf2db1630642b7d6517f8c359cc69d58c3958b34ba4ce5eR38-R39 * #21271 * It patched the above bug (somewhat), made the issues without ForeignIndex could have the same value as LocalIndex * #21721 * It re-triggered the zero-ForeignIndex bug. ps: I am not sure whether the changes in `GetForeignIndex` are ideal (at least, now it has almost the same behavior as BasicIssueContext in #16356), it's just a quick fix. Feel free to edit on this PR directly or replace it. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Use import of OCI structs (#22765) (#22805)KN4CK3R2023-02-0812-326/+90
| | | | | Backport of #22765 Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* upgrade golangcilint to v1.51.0 (#22764)Lunny Xiao2023-02-078-9/+18
| | | | | With the upgrade to go 1.20 golangci-lint no longer correctly works. We must therefore upgrade to the latest golangci-lint. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Escape path for the file list (#22741) (#22757)wxiaoguang2023-02-062-2/+11
| | | | | Backport #22741 Fix #22740
* use drone secrets for s3 config (#22770) (#22773)Yarden Shoham2023-02-051-12/+30
|
* Fix bugs with WebAuthn preventing sign in and registration. (#22651) (#22721)zeripath2023-02-021-15/+22
| | | | | | | | | | | | | | Partial Backport #22651 This PR fixes a longstanding bug within webauthn due to the backend using URLEncodedBase64 but the javascript using decoding using plain base64. This causes intermittent issues with users reporting decoding errors. Fix #22507 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix line spacing for plaintext previews (#22699) (#22701)crystal2023-02-011-5/+1
| | | | | | | | | Backport #22699 Adding `<br>` between each line is not necessary since the entire file is rendered inside a `<pre>` fixes https://codeberg.org/Codeberg/Community/issues/915
* Add missing close bracket in imagediff (#22710) (#22712)Yarden Shoham2023-02-011-1/+1
| | | | | | | | | | | | | | | Backport #22710 There was a missing `]` in imagediff.js: ``` const $range = $container.find("input[type='range'"); ``` This PR simply adds this. Fix #22702 Co-authored-by: zeripath <art27@cantab.net>
* Fix wrong hint when deleting a branch successfully from pull request UI ↵Yarden Shoham2023-02-012-2/+2
| | | | | | | | | (#22673) (#22698) Backport #22673 Fix #18785 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix README TOC links (#22577) (#22677)crystal2023-01-311-2/+9
| | | | | | | | Backport #22577 Fixes anchored markup links by adding `user-content-` (which is prepended to IDs) Closes https://codeberg.org/Codeberg/Community/issues/894
* Don't return duplicated users who can create org repo (#22560) (#22562)Gusted2023-01-306-9/+28
| | | | | | | | | | | - Backport of #22560 - Currently the function `GetUsersWhoCanCreateOrgRepo` uses a query that is able to have duplicated users in the result, this is can happen under the condition that a user is in team that either is the owner team or has permission to create organization repositories. - Add test code to simulate the above condition for user 3, [`TestGetUsersWhoCanCreateOrgRepo`](https://github.com/go-gitea/gitea/blob/a1fcb1cfb84fd6b36c8fe9fd56588119fa4377bc/models/organization/org_test.go#L435) is the test function that tests for this. - The fix is quite trivial, use a map as a set to get distinct orgs.
* Fix missing message in git hook when pull requests disabled on fork (#22625) ↵John Olheiser2023-01-301-10/+13
| | | | | | | (#22658) Backport #22625 Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* Improve checkIfPRContentChanged (#22611) (#22644)zeripath2023-01-282-53/+61
| | | | | | | | | | | | | | | | | | Backport #22611 The code for checking if a commit has caused a change in a PR is extremely inefficient and affects the head repository instead of using a temporary repository. This PR therefore makes several significant improvements: * A temporary repo like that used in merging. * The diff code is then significant improved to use a three-way diff instead of comparing diffs (possibly binary) line-by-line - in memory... Ref #22578 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Link issue and pull requests status change in UI notifications directly to ↵Yarden Shoham2023-01-281-0/+1
| | | | | | | | | | | | their event in the timelined view. (#22627) (#22642) Backport #22627 Adding the related comment to the issue and pull request status change in the UI notifications allows to navigate directly to the specific event in its dedicated view, easing the reading of last comments and to the editor for additional comments if desired. Co-authored-by: Felipe Leopoldo Sologuren Gutiérrez <fsologureng@users.noreply.github.com>
* Use `--index-url` in PyPi description (#22620) (#22636)Yarden Shoham2023-01-282-1/+3
|
* Prevent duplicate labels when importing more than 99 (#22591) (#22598)Yarden Shoham2023-01-241-1/+1
| | | | | | | | | | | | | | Backport #22591 Importing labels (via `gitea restore-repo`) did not split them up into batches properly. The first "batch" would create all labels, the second "batch" would create all labels except those in the first "batch", etc. This meant that when importing more than 99 labels (the batch size) there would always be duplicate ones. This is solved by actually passing `labels[:lbBatchSize]` to the `CreateLabels()` function, instead of the entire list `labels`. Co-authored-by: Sybren <122987084+drsybren@users.noreply.github.com>
* Changelog 1.18.3 (#22575)v1.18.3John Olheiser2023-01-231-0/+8
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Prevent multiple `To` recipients (#22566) (#22569)Yarden Shoham2023-01-227-20/+23
| | | | | | | | | Backport #22566 Change the mailer interface to prevent the leaking of possible hidden email addresses when sending to multiple recipients. Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Truncate commit summary on repo files table. (#22551) (#22552)Yarden Shoham2023-01-201-0/+5
| | | | | | | | | | | | | Backport #22551 There was an unintended regression in #21124 which assumed that .commits-list .message-wrapper would only match the commit summaries on /{owner}/{name}/commits/*. This assumption is incorrect as the directory/file view also uses a .commits-list wrapper. Rather than completely restructure this page this PR simply adjusts the styling to again use display: inline-block; for #repo-files-table .commit-list .message-wrapper Fix #22360
* Mute all links in issue timeline (#22534)silverwind2023-01-201-49/+49
| | | | | | | | | Backport of https://github.com/go-gitea/gitea/pull/22533. https://github.com/go-gitea/gitea/pull/21799 introduced a regression where some links in the issue timeline were not muted any more. Fix it by replacing all `class="text grey"` with `class="text grey muted-links"` in the file. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* When updating by rebase we need to set the environment for head repo ↵v1.18.2zeripath2023-01-193-10/+19
| | | | | | | | | | | | | | | | | | | | (#22535) (#22536) Backport #22535 The update by rebase code reuses the merge code but shortcircuits and pushes back up to the head. However, it doesn't set the correct pushing environment - and just uses the same environment as the base repo. This leads to the push update failing and thence the PR becomes out-of-sync with the head. This PR fixes this and adjusts the trace logging elsewhere to help make this clearer. Fix #18802 Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net>
* chore: changelog 1.18.2 (#22530)John Olheiser2023-01-191-0/+11
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix issue not auto-closing when it includes a reference to a branch (#22514) ↵John Olheiser2023-01-191-1/+3
| | | | | | | (#22521) Backport #22514 Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* Fix invalid issue branch reference if not specified in template (#22513) ↵John Olheiser2023-01-191-1/+2
| | | | | | | (#22520) Backport #22513 Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* cgo cross-compile for freebsd (#22397) (#22519)techknowlogick2023-01-181-1/+8
| | | | | Provide pre-compiled cgo binaries for freebsd Co-authored-by: John Olheiser <john.olheiser@gmail.com>