0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-04-07 16:54:52 +02:00

4915 Commits

Author SHA1 Message Date
TheFox0x7
053592d847
fix org repo creation being limited by user limits (#34030)
fixes an issue where user is unable to create new repository in
organization via UI if repository limits are in place and user has
exhausted them for their own namespace.

closes: https://github.com/go-gitea/gitea/issues/15504

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-27 13:16:17 +00:00
Lunny Xiao
0c6957ef8d
Download actions job logs from API (#33858)
Related to #33709, #31416

It's similar with
https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run--code-samples.

This use `job_id` as path parameter which is consistent with Github's
APIs.

---------

Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-26 11:30:52 -07:00
wxiaoguang
41c946a66f
Prepare common tmpl functions in a middleware (#33957)
Fix the TODO in `routers/web/web.go`, and avoid the unnecessary
`GetActiveStopwatch` SQL query in non-related route handlers.
2025-03-25 06:17:58 +00:00
wxiaoguang
b1e326d09e
Auto expand "New PR" form (#33971)
Follow GitHub's behavior: use `?expand=1` to expand the "New PR" form
2025-03-24 14:28:02 +00:00
Lunny Xiao
25b6f38865
Move ParseBool to optional (#33979) 2025-03-24 03:53:30 +00:00
Lunny Xiao
30ee082e48
Only use prev and next buttons for pagination on user dashboard (#33981)
The pagination on the user dashboard sounds unnecessary, this will
change it to a prev/next buttons. For instances with around `10 million`
records in the action table, this option affects how the user dashboard
is loaded on first visit.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-03-23 19:52:43 +00:00
wxiaoguang
e1bba9c1a2
Improve oauth2 error handling (#33969)
Show the callback error to end users, it should be safe.
Fix #33967
2025-03-22 10:15:45 +08:00
wxiaoguang
279473f467
Fix oauth2 auth and UI (#33961) 2025-03-21 20:50:39 +08:00
Andreas Svanberg
0da7318cf3
Allow filtering issues by any assignee (#33343)
This is the opposite of the "No assignee" filter, it will match all
issues that have at least one assignee.

Before
![Before
change](https://github.com/user-attachments/assets/4aea194b-9add-4a84-8d6b-61bfd8d9e58e)

After
![After change with any
filter](https://github.com/user-attachments/assets/99f1205d-ba9f-4a0a-a60b-cc1a0c0823fe)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-21 04:25:36 +00:00
Lunny Xiao
a4df01b580
Optimize total count of feed when loading activities in user dashboard. (#33841)
Two SQLs are very slow when `action` table have over 5M records.

```
database duration=1.8881s db.sql="SELECT created_unix DIV 900 * 900 AS timestamp, count(user_id) as contributions FROM `action` WHERE user_id=? AND act_user_id=? AND (created_unix > ?) GROUP BY timestamp ORDER BY timestamp"

database duration=1.5408s db.sql="SELECT count(*) FROM `action` WHERE (user_id = ?) AND (is_deleted = ?)"
```

This will cache the count for the first loading or when the activities
changed.
2025-03-20 10:46:18 -07:00
Lunny Xiao
a9e8ac0fe0
Don't create duplicated functions for code repositories and wiki repositories (#33924)
Fix
https://github.com/go-gitea/gitea/pull/33910#pullrequestreview-2688913865

This PR changed the Repositroy interface in `gitrepo` package which
makes it only focus the relative path in the disk and abstract whether
it's a wiki repository or not.
2025-03-19 11:17:19 -07:00
John Smith
8f051d598c
Added Description Field for Secrets and Variables (#33526)
Fixes #33484

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-17 19:24:54 +00:00
Lunny Xiao
0056fdb942
Move git references checking to gitrepo packages to reduce expose of repository path (#33891) 2025-03-15 19:48:59 -07:00
Job
30b13942f0
Give organisation members access to organisation feeds (#33508)
Currently the organisation feed only includes items for public
repositories (for non-administrators). This pull requests adds
notifications from private repositories to the organisation-feed (for
accounts that have access to the organisation).

Feed-items only get shown for repositories where the users team(s)
should have access to, this filtering seems to get done by some existing
code.

Needs some tests, but am unsure where/how to add them.

Before:

![image](https://github.com/user-attachments/assets/8b63f430-227a-4b19-ad1a-f6f5175de301)

After:

![image](https://github.com/user-attachments/assets/b439ce0e-4946-421c-a399-421806c7a6d8)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-15 17:49:06 +00:00
Kerwin Bryant
92f997ce6b
Add file tree to file view page (#32721)
Resolve #29328

This pull request introduces a file tree on the left side when reviewing
files of a repository.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-15 16:26:49 +08:00
ChristopherHX
65e2411394
Feature: Ephemeral action runners (#33570)
* This includes a runner mock test for hardend PickTask behavior like
described in my proposal
* Runner register ephemeral flag introduced in
https://gitea.com/gitea/act_runner/pulls/649

Closes #32461
2025-03-14 12:27:24 -07:00
Lunny Xiao
55cc649d3d
Add abstraction layer to delete repository from disk (#33879)
Extract from #28966 
Follow #33874
2025-03-14 18:38:55 +00:00
wxiaoguang
45c4139134
Fix maven panic when no package exists (#33888)
Fix #33886

Restore the old logic from #16510, which was incorrectly removed by
#33678
2025-03-14 10:35:40 -07:00
wxiaoguang
b094f9b75d
Improve repo commit view (#33877)
Fix #24623

Major changes:

1. Redirect `/owner/repo/blob/*` requests to `/owner/repo/src/commit/*`
(like GitHub)
2. Add a "view file diff" link (see screenshot below)
3. Refactor "AssertHTMLElement" to generic, now we can accurately assert
existence or number.
4. Add more tests

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
2025-03-14 07:45:11 +00:00
Lunny Xiao
1e7248047c
Pull request updates will also trigger code owners review requests (#33744)
Fix #33490 

It will only read the changed file on the pushed commits but not all the
files of this PR.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-13 19:36:14 -07:00
wxiaoguang
403775e74e
Improve issue & code search (#33860)
Each "indexer" should provide the "search modes" they support by
themselves. And we need to remove the "fuzzy" search for code.
2025-03-13 11:07:48 +08:00
wxiaoguang
3996518ed4
Refactor cache-control (#33861)
And fix #21391
2025-03-13 07:04:50 +08:00
ChristopherHX
651ef66966
Add workflow_job webhook (#33694)
Provide external Integration information about the Queue lossly based on
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=completed#workflow_job

Naming conflicts between GitHub & Gitea are here, Blocked => Waiting,
Waiting => Queued

Rationale Enhancement for ephemeral runners management #33570
2025-03-11 10:40:38 -07:00
ChristopherHX
a92d5f65ce
Fix auto concurrency cancellation skips commit status updates (#33764)
* add missing commit status
* conflicts with concurrency support

Closes #33763

Co-authored-by: Giteabot <teabot@gitea.io>
2025-03-10 15:58:48 -07:00
wxiaoguang
657239b480
Fix material icon & diff highlight (#33844) 2025-03-10 22:34:48 +08:00
Lunny Xiao
ae63568ce3
Move notifywatch to service layer (#33825)
No logic change.
2025-03-10 00:54:25 +00:00
wxiaoguang
7290bfaccb
Only keep popular licenses (#33832)
Fix #33467
2025-03-10 06:40:37 +08:00
Dustin Firebaugh
3f1f808b9e
Full-file syntax highlighting for diff pages (#33766)
Fix #33358, fix #21970

This adds a step in the `GitDiffForRender` that does syntax highlighting for the
entire file and then only references lines from that syntax highlighted
code. This allows things like multi-line comments to be syntax
highlighted correctly.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-09 12:51:58 +08:00
wxiaoguang
6f13331754
Improve theme display (#30671)
Document: https://gitea.com/gitea/docs/pulls/180

![image](https://github.com/go-gitea/gitea/assets/2114189/68e38573-b911-45d9-b7aa-40d96d836ecb)
2025-03-08 21:38:11 +00:00
wxiaoguang
6422f05a4e
Decouple diff stats query from actual diffing (#33810)
The diff stats are no longer part of the diff generation.
Use `GetDiffShortStat` instead to get the total number of changed files,
added lines, and deleted lines.
As such, `gitdiff.GetDiff` can be simplified:
It should not do more than expected.

And do not run "git diff --shortstat" for pull list. Fix #31492
2025-03-08 17:36:08 +08:00
Lunny Xiao
1b2dffff8e
Add global lock for migrations to make upgrade more safe with multiple replications (#33706) 2025-03-07 21:08:53 +00:00
Alexander McRae
582ad338d7
Use correct start and end commits for GetDiffTree (#33816)
Fixes
https://github.com/go-gitea/gitea/pull/33514#issuecomment-2702814099

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-03-07 02:40:39 +00:00
Lunny Xiao
0453177b61
Refactor: move part of updating protected branch logic to service layer (#33742) 2025-03-05 19:15:40 +00:00
TheFox0x7
ae3a18e01a
Remove context from git struct (#33793)
Argument is moved from struct init in command run, which lets us remove
context from struct.
2025-03-04 11:56:11 -08:00
wxiaoguang
216243eee2
Refactor error system (#33771)
It should not expose `util.SilentWrap` or construct it manually.
2025-03-03 05:36:10 +00:00
Lunny Xiao
aca21549f2
Add composor source field (#33502)
Fix #33066
2025-02-28 16:29:21 +00:00
Alexander McRae
aba96f65cd
Use git diff-tree for DiffFileTree on diff pages (#33514)
Modify Diff View FileTree to show all files

## Changes

* removes Show Status button on diff
* uses `git diff-tree` to generate the file tree for the diff
* doesn't reload the diff tree each time we load more files in the
preview
* selecting and unloaded file will keep loading until that file is
loaded
* removes `DiffFileList.vue` and "Show Stats" in diff options

## Open Questions

* selecting and unloaded file will keep loading until that file is
loaded. Is this behaviour okay? It matches what github does.

### Demo

In this demo I set `git.MAX_GIT_DIFF_FILES=1` in my `app.ini` to
demonstrate a worst case example. In most cases the behaviour isn't
nearly as jarring as we load a bunch of files at a time.


https://github.com/user-attachments/assets/72f29663-d6fc-472d-94fa-7fb5950c2836

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-28 00:58:25 +00:00
Guillaume
303af554c9
Improve "generate new access token" form (#33730)
Fix: https://github.com/go-gitea/gitea/issues/33519

As discussed in [PR
#33614](https://github.com/go-gitea/gitea/pull/33614), the
ScopedAccessTokenSelector Vue component is not particularly useful.

This PR removes the component and reverts to using HTML templates. It
also introduces some (hopefully) useful refactoring.

The Vue component was causing the UX bug reported in the linked issue.
Required form fields are now properly working, as expected (see
screenshot).

![Screenshot from 2025-02-25
22-00-28](https://github.com/user-attachments/assets/41167854-0718-48b0-a3ee-75ca3a7b8b20)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-27 19:40:12 +00:00
Royce Remer
b7aac5ef9a
allow filtering /repos/{owner}/{repo}/pulls by target base branch queryparam (#33684)
Co-authored-by: Royce Remer <rremer@salesforce.com>
Co-authored-by: delvh <dev.lh@web.de>
2025-02-27 17:50:44 +00:00
wxiaoguang
555d64d024
Always show the "rerun" button for action jobs (#33692)
And improve the mock code.
2025-02-24 08:40:46 +00:00
wxiaoguang
56a0a9c750
Fix git empty check and HEAD request (#33690) 2025-02-24 02:11:29 +00:00
wxiaoguang
8ae46d9684
Fix some user name usages (#33689)
1. GetUserOrgsList should "order by" lower_name
2. GetIssuePostersWithSearch should search in-case-sensitive-ly
3. LoginName should not be used as username

By the way, remove unnecessary "onGiteaRun"
2025-02-23 12:33:43 +00:00
Diana
a61014ea47
Fix for Maven Package Naming Convention Handling (#33678)
Make legacy package names could be listed and add tests

---------

Co-authored-by: diana.strebkova@t-systems.com <diana.strebkova@t-systems.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-22 01:38:49 +08:00
wxiaoguang
4adb7cad8b
Improve swagger generation (#33664)
Remove most "sed" tricks

---------

Co-authored-by: silverwind <me@silverwind.io>
2025-02-21 00:04:30 -08:00
TheFox0x7
cc1fdc84ca
Use test context in tests and new loop system in benchmarks (#33648)
Replace all contexts in tests with go1.24 t.Context()

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-20 09:57:40 +00:00
wxiaoguang
c2e23d3301
Fix PR web route permission check (#33636)
See the FIXME comment in code. Otherwise, if a repo's issue unit is
disabled, then the PRs can't be edited anymore.

By the way, make the permission log output look slightly better.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: metiftikci <metiftikci@hotmail.com>
2025-02-19 00:55:19 +00:00
Kerwin Bryant
ce65613690
Fix Untranslated Text on Actions Page (#33635)
Fix the problem of untranslated text on the actions page

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-18 11:29:08 +00:00
wxiaoguang
15e020eec8
Refactor error system (#33626) 2025-02-17 12:41:03 -08:00
Lunny Xiao
7df09e31fa
Move issue pin to an standalone table for querying performance (#33452)
Noticed a SQL in gitea.com has a bigger load. It seems both `is_pull`
and `pin_order` are not indexed columns in the database.

```SQL
SELECT `id`, `repo_id`, `index`, `poster_id`, `original_author`, `original_author_id`, `name`, `content`, `content_version`, `milestone_id`, `priority`, `is_closed`, `is_pull`, `num_comments`, `ref`, `pin_order`, `deadline_unix`, `created_unix`, `updated_unix`, `closed_unix`, `is_locked`, `time_estimate` FROM `issue` WHERE (repo_id =?) AND (is_pull = 0) AND (pin_order > 0) ORDER BY pin_order
```

I came across a comment
https://github.com/go-gitea/gitea/pull/24406#issuecomment-1527747296
from @delvh , which presents a more reasonable approach. Based on this,
this PR will migrate all issue and pull request pin data from the
`issue` table to the `issue_pin` table. This change benefits larger
Gitea instances by improving scalability and performance.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-02-17 11:28:37 -08:00
wxiaoguang
f35850f48e
Refactor error system (#33610) 2025-02-16 22:13:17 -08:00