]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoSkip duplicated layers. (#19624)
KN4CK3R [Thu, 5 May 2022 22:02:09 +0000 (00:02 +0200)]
Skip duplicated layers. (#19624)

2 years agoAdd "Reference" section to Issue view sidebar (#19609)
neon [Thu, 5 May 2022 18:58:37 +0000 (18:58 +0000)]
Add "Reference" section to Issue view sidebar (#19609)

* Add "Reference" section to Issue view sidebar

* Removed unneeded tailored CSS, added Fomantic UI classes

* Removed tailored CSS in favour of HTML-only approach

Kindly provided by @Gusted

* Added i18 translation key for reference link string

* Corrected spelling of "References:" to "Reference:" for reference link text

* Removed `Issue.ReferenceLink` in favour of a local template variable

2 years agoGetFeeds must always discard actions with dangling repo_id (#19598)
singuliere [Thu, 5 May 2022 15:39:26 +0000 (16:39 +0100)]
GetFeeds must always discard actions with dangling repo_id (#19598)

* GetFeeds must always discard actions with dangling repo_id

See https://discourse.gitea.io/t/blank-page-after-login/5051/12
for a panic in 1.16.6.

* add comment to explain the dangling ID in the fixture

* loadRepoOwner must not attempt to use a nil action.Repo

* make fmt

Co-authored-by: Loïc Dachary <loic@dachary.org>
2 years agoCall MultipartForm.RemoveAll when request finishes (#19606)
wxiaoguang [Thu, 5 May 2022 14:13:23 +0000 (22:13 +0800)]
Call MultipartForm.RemoveAll when request finishes (#19606)

2 years agoRemove `RequireHighlightJS` field, update plantuml example. (#19615)
wxiaoguang [Thu, 5 May 2022 07:53:38 +0000 (15:53 +0800)]
Remove `RequireHighlightJS` field, update plantuml example. (#19615)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 5 May 2022 00:10:22 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoPullService lock via pullID (#19520)
6543 [Wed, 4 May 2022 16:06:23 +0000 (18:06 +0200)]
PullService lock via pullID (#19520)

* lock pull on git&db actions ...

* add TODO notes

* rename prQueue 2 prPatchCheckerQueue

* fmt

2 years agoAdd health check endpoint (#18465)
ttys3 [Wed, 4 May 2022 11:56:20 +0000 (19:56 +0800)]
Add health check endpoint (#18465)

* chore: add health check endpoint

docs: update document about health check

fix: fix up Sqlite3 ping. current ping will success even if the db file is missing

fix: do not expose privacy information in output field

* refactor: remove HealthChecker struct

* Added `/api/healthz` to install routes.

This was needed for using /api/healthz endpoint in Docker healthchecks,
otherwise, Docker would never become healthy if using healthz endpoint
and users would not be able to complete the installation of Gitea.

* Update modules/cache/cache.go

* fine tune

* Remove unnecessary test code. Now there are 2 routes for installation (and maybe more in future)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Marcos de Oliveira <marcossantos@furb.br>
2 years agoOnly check for non-finished migrating task (#19601)
Gusted [Wed, 4 May 2022 10:09:42 +0000 (10:09 +0000)]
Only check for non-finished migrating task (#19601)

* Only check for non-finished migrating task

- Only check if a non-finished migrating task exists for a mirror before
fetching the mirror details from the database.
- Resolves #19600
- Regression: #19588

* Clarify function

2 years agoMake .cs highlighting legible on dark themes. (#19604)
Eekle [Wed, 4 May 2022 08:58:38 +0000 (09:58 +0100)]
Make .cs highlighting legible on dark themes. (#19604)

2 years agoFix broken TR on cherrypick page (#19599)
Gusted [Wed, 4 May 2022 00:48:23 +0000 (00:48 +0000)]
Fix broken TR on cherrypick page (#19599)

- `repo.filter_branch` isn't a translation key so use
`repo.pulls.filter_branch` which has the correct translation.

2 years agoUse correct context in `routers/web` (#19597)
Gusted [Tue, 3 May 2022 21:38:34 +0000 (21:38 +0000)]
Use correct context in `routers/web` (#19597)

- Don't use the `APIContext` in the web routers.

2 years agoUse for a repo action one database transaction (#19576)
6543 [Tue, 3 May 2022 19:46:28 +0000 (21:46 +0200)]
Use for a repo action one database transaction (#19576)

... more context

(part of #9307)

2 years agoOnly set CanColorStdout / CanColorStderr to true if the stdout/stderr is a terminal...
wxiaoguang [Tue, 3 May 2022 16:03:34 +0000 (00:03 +0800)]
Only set CanColorStdout / CanColorStderr to true if the stdout/stderr is a terminal (#19581)

2 years agoDon't fetch Mirror when it's migrating (#19588)
Gusted [Tue, 3 May 2022 13:55:17 +0000 (13:55 +0000)]
Don't fetch Mirror when it's migrating (#19588)

- When a repository is still being migrated, don't try to fetch the
Mirror from the database. Instead skip it. This allows to visit
repositories that are still being migrated and were configured to be
mirrored.
- Resolves #19585
- Regression: #19295

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoMove user password verification after checking his groups on ldap auth (#19587)
Gwilherm Folliot [Tue, 3 May 2022 12:41:11 +0000 (14:41 +0200)]
Move user password verification after checking his groups on ldap auth (#19587)

In case the binded user can not access its own attributes.

Signed-off-by: Gwilherm Folliot <gwilherm55fo@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix some slice problems (incorrect slice length) (#19592)
Lunny Xiao [Tue, 3 May 2022 09:04:23 +0000 (17:04 +0800)]
Fix some slice problems (incorrect slice length) (#19592)

2 years agoFix sending empty notifications (#19589)
Gusted [Tue, 3 May 2022 02:27:42 +0000 (02:27 +0000)]
Fix sending empty notifications (#19589)

- Don't send empty notifications on read notifications API.

2 years agoHandle the error of a missing blob object fix #19530 (#19552)
99rgosse [Mon, 2 May 2022 16:46:50 +0000 (18:46 +0200)]
Handle the error of a missing blob object fix #19530 (#19552)

* Handle the error of a missing blob object

* Show error in logs

* as per @zeripath

* Add missing error check

* Add missing error check

* Update compare.go

* Use formal code

* Update compare.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoRemove legacy `+build:` constraint (#19582)
wxiaoguang [Mon, 2 May 2022 15:22:45 +0000 (23:22 +0800)]
Remove legacy `+build:` constraint (#19582)

Go 1.17 and later use modern `//go:build` constraints, the old `// +build:` constraints should be removed.

2 years agoFederation: return useful statistic information for nodeinfo (#19561)
6543 [Mon, 2 May 2022 13:35:45 +0000 (15:35 +0200)]
Federation: return useful statistic information for nodeinfo (#19561)

Add statistic information for total user count, active user count, issue count and comment count for `/nodeinfo`

2 years agoUpgrade required git version to 2.0 (#19577)
wxiaoguang [Mon, 2 May 2022 12:30:24 +0000 (20:30 +0800)]
Upgrade required git version to 2.0 (#19577)

* Upgrade required git version to 2.0

* update document

2 years agoadd smtp password to install page (#17564)
Vladimir Smagin [Mon, 2 May 2022 08:45:23 +0000 (15:45 +0700)]
add smtp password to install page (#17564)

* add smtp password to install page

* Update routers/install/install.go

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoignore DNS error when doing migration allow/block check (#19566)
wxiaoguang [Mon, 2 May 2022 04:02:17 +0000 (12:02 +0800)]
ignore DNS error when doing migration allow/block check (#19566)

Co-authored-by: 6543 <6543@obermui.de>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 2 May 2022 00:10:25 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoDont overwrite err with nil & rename PullCheckingFuncs to reflect there usage (#19572)
6543 [Sun, 1 May 2022 23:54:44 +0000 (01:54 +0200)]
Dont overwrite err with nil & rename PullCheckingFuncs to reflect there usage (#19572)

- dont overwrite err with nil unintentionaly
- rename CheckPRReadyToMerge to CheckPullBranchProtections
- rename prQueue to prPatchCheckerQueue

from #9307

Co-authored-by: delvh <dev.lh@web.de>
2 years agoImprove UI on mobile (#19546)
Gusted [Sun, 1 May 2022 16:11:21 +0000 (16:11 +0000)]
Improve UI on mobile (#19546)

Start making the mobile experience not painful and be actually usable. This contains a few smaller changes to enhance this experience.

- Submit buttons on the review forms aren't columns anymore and are now allowed to be displayed on one row.
- The label/milestone & New Issue buttons were given each own row even tough, there's enough place to do it one the same row. This commit fixes that.
- The issues+Pull tab on repo's has a third item besides the label/milestone & New Issue buttons, the search bar. On desktop there's enough place to do this on one row, for mobile it isn't, currently it was using for each item a new row. This commits fixes that by only giving the searchbar a new row and have the other two buttons on the same row.
- The notification table will now be show a scrollbar instead of overflow.
- The repo buttons(Watch, Star, Fork) on mobile were showing quite big and the SVG wasn't even displayed on the same line, if the count of those numbers were too high it would even overflow. This commit removes the SVG, as there isn't any place to show them on the same row and allows them to have a new row if the counts of those buttons are high.
- The admin page can show you a lot of interesting information, on mobile the System Status + Configuration weren't properly displayed as the margin's were too high. This commit fixes that by reducing the margin to a number that makes sense on mobile.
- Fixes to not overflow the tables but instead force them to be scrollable.
- When viewing a issue or pull request, the comments aren't full-width but instead 80% and aligned to right, on mobile this is a annoyance as there isn't much width to begin with. This commits fixes that by forcing full-width and removing the avatars on the left side and instead including them inline in the comment header.

2 years agoAdd API to check if team has repo access (#19540)
qwerty287 [Sun, 1 May 2022 15:39:04 +0000 (17:39 +0200)]
Add API to check if team has repo access (#19540)

* Add API to check if team has repo access

* Add test case

2 years agoAvoid MoreThanOne Error (#19557)
99rgosse [Sun, 1 May 2022 01:09:59 +0000 (03:09 +0200)]
Avoid MoreThanOne Error (#19557)

2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 1 May 2022 00:25:27 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoSimplify loops to copy (#19569)
Gusted [Sat, 30 Apr 2022 23:53:56 +0000 (23:53 +0000)]
Simplify loops to copy (#19569)

- Simplify two loops into `copy` statements.

2 years agoUse middleware to open gitRepo (#19559)
6543 [Sat, 30 Apr 2022 14:32:01 +0000 (16:32 +0200)]
Use middleware to open gitRepo (#19559)

2 years agoAdded X-Mailer header to outgoing emails (#19562)
Ivan Fedorov [Sat, 30 Apr 2022 13:40:55 +0000 (16:40 +0300)]
Added X-Mailer header to outgoing emails (#19562)

- It's a non-standard mentioned in https://www.ietf.org/rfc/rfc2076.html#section-3.4
- This header makes emails filtering easier

2 years agofix #19545 (#19563)
6543 [Sat, 30 Apr 2022 12:50:56 +0000 (14:50 +0200)]
fix #19545 (#19563)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 30 Apr 2022 00:10:15 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRespect DefaultUserIsRestricted system default when creating new user (#19310)
Jimmy Praet [Fri, 29 Apr 2022 19:38:11 +0000 (21:38 +0200)]
Respect DefaultUserIsRestricted system default when creating new user (#19310)

* Apply DefaultUserIsRestricted in CreateUser

* Enforce system defaults in CreateUser

Allow for overwrites with CreateUserOverwriteOptions

* Fix compilation errors

* Add "restricted" option to create user command

* Add "restricted" option to create user admin api

* Respect default setting.Service.RegisterEmailConfirm and setting.Service.RegisterManualConfirm where needed

* Revert "Respect default setting.Service.RegisterEmailConfirm and setting.Service.RegisterManualConfirm where needed"

This reverts commit ee95d3e8dc9e9fff4fa66a5111e4d3930280e033.

2 years agoMute link in diff header (#19556)
silverwind [Fri, 29 Apr 2022 14:39:27 +0000 (16:39 +0200)]
Mute link in diff header (#19556)

Followup to https://github.com/go-gitea/gitea/pull/19534. Make the link
render in color only on hover.

2 years agoAdd API to query collaborators permission for a repository (#18761)
Florin Hillebrand [Fri, 29 Apr 2022 12:24:38 +0000 (14:24 +0200)]
Add API to query collaborators permission for a repository (#18761)

Targeting #14936, #15332

Adds a collaborator permissions API endpoint according to GitHub API: https://docs.github.com/en/rest/collaborators/collaborators#get-repository-permissions-for-a-user to retrieve a collaborators permissions for a specific repository.

### Checks the repository permissions of a collaborator.

`GET` `/repos/{owner}/{repo}/collaborators/{collaborator}/permission`

Possible `permission` values are `admin`, `write`, `read`, `owner`, `none`.

```json
{
  "permission": "admin",
  "role_name": "admin",
  "user": {}
}
```

Where `permission` and `role_name` hold the same `permission` value and `user` is filled with the user API object. Only admins are allowed to use this API endpoint.

2 years agoPermalink files In PR diff (#19534)
KN4CK3R [Fri, 29 Apr 2022 10:26:52 +0000 (12:26 +0200)]
Permalink files In PR diff (#19534)

2 years agoFix Pull Request comment filename word breaks (#19535)
parnic [Fri, 29 Apr 2022 09:30:54 +0000 (04:30 -0500)]
Fix Pull Request comment filename word breaks (#19535)

* Fix word breaks in Chrome

This fixes word wrapping on the filename for a comment on a PR. A previous commit fixed this problem in Firefox, but not Chrome.

Fixes #16248

* Don't break Outdated badge

This prevents the Outdated badge on a PR from wrapping in the middle of the word for a comment on a long filename.

* Move word break to recommended element

* Add overflow-wrap per PR review

* Update web_src/less/helpers.less

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDon't error when branch's commit doesn't exist (#19547)
Gusted [Fri, 29 Apr 2022 08:44:40 +0000 (08:44 +0000)]
Don't error when branch's commit doesn't exist (#19547)

* Don't error when branch's commit doesn't exist

- If one of the branches no longer exists, don't throw an error, it's possible that the branch was destroyed during the process. Simply skip it and disregard it.
- Resolves #19541

* Don't send empty objects

* Use more minimal approach

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 29 Apr 2022 00:10:15 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoSupport `hostname:port` to pass host matcher's check #19543 (#19543)
wxiaoguang [Thu, 28 Apr 2022 17:39:50 +0000 (01:39 +0800)]
Support `hostname:port` to pass host matcher's check #19543  (#19543)

hostmatcher: split the hostname from the `hostname:port` string, use the correct hostname to do the match.

2 years agoAdd "Allow edits from maintainer" feature (#18002)
qwerty287 [Thu, 28 Apr 2022 15:45:33 +0000 (17:45 +0200)]
Add "Allow edits from maintainer" feature (#18002)

Adds a feature [like GitHub has](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) (step 7).
If you create a new PR from a forked repo, you can select (and change later, but only if you are the PR creator/poster) the "Allow edits from maintainers" option.
Then users with write access to the base branch get more permissions on this branch:
* use the update pull request button
* push directly from the command line (`git push`)
* edit/delete/upload files via web UI
* use related API endpoints

You can't merge PRs to this branch with this enabled, you'll need "full" code write permissions.

This feature has a pretty big impact on the permission system. I might forgot changing some things or didn't find security vulnerabilities. In this case, please leave a review or comment on this PR.

Closes #17728

Co-authored-by: 6543 <6543@obermui.de>
2 years agoBetter describe what `/repos/{owner}/{repo}/raw/{filepath}` returns on 200 (#19542)
Gusted [Thu, 28 Apr 2022 14:57:56 +0000 (14:57 +0000)]
Better describe what `/repos/{owner}/{repo}/raw/{filepath}` returns on 200 (#19542)

- Set on the description that it returns the raw file content.
- Resolves #19514

2 years agomore context for models (#19511)
6543 [Thu, 28 Apr 2022 11:48:48 +0000 (13:48 +0200)]
more context for models  (#19511)

make more usage of context, to have more db transaction in one session

(make diff of  #9307 smaller)

2 years agoPrevent intermittent race in attribute reader close (#19537)
zeripath [Thu, 28 Apr 2022 03:19:33 +0000 (04:19 +0100)]
Prevent intermittent race in attribute reader close (#19537)

There is a potential rare race possible whereby the c.running channel could
be closed twice. Looking at the code I do not see a need for this c.running
channel and therefore I think we can remove this. (I think the c.running
might have been some attempt to prevent a hang but the use of os.Pipes should
prevent that.)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoMake repository file list useable on mobile (#19515)
Gusted [Thu, 28 Apr 2022 01:59:49 +0000 (01:59 +0000)]
Make repository file list useable on mobile (#19515)

* Make repository file list useable on mobile

- When you're browsing a repository on mobile, you're met by a giant
block called the "repository file list". The current design is not
useable for mobile and is a big annoyance while browsing a repo on
mobile. This PR removes that annoyance by making it more suitable design
when on mobile.
- Adds HTML for the commit/file time to align it vertically(noticeable
on mobile, not on PC).
- Show all information horizontally and not vertically.
- Remove the last commit message of the file, there isn't enough space
on mobile to place this anywhere, so we're not trying to make a
best-effort here and instead just not display it.

* Remove unnecessary `!important`

* Fix broken HTML

* Simplify code

2 years agoUpdate image URL for Discord webhook (#19536)
John Olheiser [Thu, 28 Apr 2022 01:23:27 +0000 (20:23 -0500)]
Update image URL for Discord webhook (#19536)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 28 Apr 2022 00:10:43 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix 64-bit atomic operations on 32-bit machines (#19531)
Gusted [Wed, 27 Apr 2022 15:32:04 +0000 (15:32 +0000)]
Fix 64-bit atomic operations on 32-bit machines (#19531)

- Doing 64-bit atomic operations on 32-bit machines is a bit tricky by
golang, as they can only be done under certain set of
conditions(https://pkg.go.dev/sync/atomic#pkg-note-BUG).
- This PR fixes such case whereby the conditions weren't met, it moves
the int64 to the first field of the struct, which will 64-bit operations
happening on this property on 32-bit machines.
- Resolves #19518

2 years agoFix `upgrade.sh` script error with `su -c` (#19483)
YISH [Wed, 27 Apr 2022 03:30:29 +0000 (11:30 +0800)]
Fix `upgrade.sh` script error with `su -c` (#19483)

* Fix scirpt err with `su -c`, add env auto loading.

* Update upgrade.sh

* Update upgrade.sh

* Update contrib/upgrade.sh

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoWhen view _Siderbar or _Footer, just display once (#19501)
Lunny Xiao [Tue, 26 Apr 2022 23:24:20 +0000 (07:24 +0800)]
When view _Siderbar or _Footer, just display once (#19501)

Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix migrate release from github (#19510)
Lunny Xiao [Tue, 26 Apr 2022 23:24:06 +0000 (07:24 +0800)]
Fix migrate release from github (#19510)

* Fix migrate release from github

* Fix bug

2 years agoPrevent dangling archiver goroutine (#19516)
zeripath [Tue, 26 Apr 2022 23:22:26 +0000 (00:22 +0100)]
Prevent dangling archiver goroutine (#19516)

Within doArchive there is a service goroutine that performs the
archiving function.  This goroutine reports its error using a `chan
error` called `done`. Prior to this PR this channel had 0 capacity
meaning that the goroutine would block until the `done` channel was
cleared - however there are a couple of ways in which this channel might
not be read.

The simplest solution is to add a single space of capacity to the
goroutine which will mean that the goroutine will always complete and
even if the `done` channel is not read it will be simply garbage
collected away.

(The PR also contains two other places when setting up the indexers
which do not leak but where the blocking of the sending goroutine is
also unnecessary and so we should just add a small amount of capacity
and let the sending goroutine complete as soon as it can.)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoDon't let repo clone URL overflow (#19517)
Gusted [Tue, 26 Apr 2022 23:22:11 +0000 (23:22 +0000)]
Don't let repo clone URL overflow (#19517)

- Apparently `<input>` elements differ from other elements have a size
attribute that act as a `min-width` CSS property, this causes a overflow
on mobile. By setting this size to `1` it doesn't try to force a
min-width and nicely shrink down.

2 years agoAdd commit status popup to issuelist (#19375)
parnic [Tue, 26 Apr 2022 22:40:01 +0000 (17:40 -0500)]
Add commit status popup to issuelist (#19375)

This gets the necessary data to the issuelist for it to support a clickable commit status icon which pops up the full list of commit statuses related to the commit. It accomplishes this without any additional queries or fetching as the existing codepath was already doing the necessary work but only returning the "last" status. All methods were wrapped to call the least-filtered version of each function in order to maximize code reuse.

Note that I originally left `getLastCommitStatus()` in `pull.go` which called to the new function, but `make lint` complained that it was unused, so I removed it. I would have preferred to keep it, but alas.

The only thing I'd still like to do here is force these popups to happen to the right by default instead of the left. I see that the only other place this is popping up right is on view_list.tmpl, but I can't figure out how/why right now.

Fixes #18810

2 years agoDisable unnecessary GitHooks elements (#18485)
Paweł Bogusławski [Tue, 26 Apr 2022 21:10:11 +0000 (23:10 +0200)]
Disable unnecessary GitHooks elements (#18485)

* Disable unnecessary GitHooks elements

This mod fixes disabling unnecessary GitHooks elements.

Related: https://github.com/go-gitea/gitea/pull/13129
Author-Change-Id: IB#1115251

2 years agoDisable unnecessary GitHooks elements
Pawel Boguslawski [Mon, 31 Jan 2022 14:12:47 +0000 (15:12 +0100)]
Disable unnecessary GitHooks elements

This mod fixes disabling unnecessary GitHooks elements.

Related: https://github.com/go-gitea/gitea/pull/13129
Author-Change-Id: IB#1115251

2 years agoImprove dashboard's repo list performance (#18963)
Gusted [Tue, 26 Apr 2022 20:34:30 +0000 (20:34 +0000)]
Improve dashboard's repo list performance (#18963)

* Improve dashboard's repo list performance

- Avoid a lot of database lookups for all the repo's, by adding a
undocumented "minimal" mode for this specific task, which returns the
data that's only needed by this list which doesn't require any database
lookups.
- Makes fetching these list faster.
- Less CPU overhead when a user visits home page.

* Refactor javascript code + fix Fork icon

- Use async in the function so we can use `await`.
- Remove `archivedFilter` check for count, as it doesn't make sense to
  show the count of repos when you can't even see them(as they are
  filited away).

* Add `count_only`

* Remove uncessary code

* Improve comment

Co-authored-by: delvh <dev.lh@web.de>
* Update web_src/js/components/DashboardRepoList.js

Co-authored-by: delvh <dev.lh@web.de>
* Update web_src/js/components/DashboardRepoList.js

Co-authored-by: delvh <dev.lh@web.de>
* By default apply minimal mode

* Remove `minimal` paramater

* Refactor count header

* Simplify init

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoBy default force vertical tabs on mobile (#19486)
Gusted [Tue, 26 Apr 2022 20:31:58 +0000 (20:31 +0000)]
By default force vertical tabs on mobile (#19486)

* By default force vertical tabs on mobile

- While experimenting with using vertical tabs instead of horizontal
tabs on gitea for a better mobile experience, I made a recent
PR(https://github.com/go-gitea/gitea/pull/19468) in order to see if
there was any objections to this new behavior for the repo headers(one
of the most annoying horizontal tabs). This PR had no objections and
even a user commenting that this change is brilliant.
- This PR now improves upon the previous PR by making this the de-facto
behavior for all menu's on mobile. The only exemption is the navbar
which also uses the menu but caught some layout errors with the changes.

* Fix organisation

* Fix repo/wiki buttons

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoRefactor readme file renderer (#19502)
Lunny Xiao [Tue, 26 Apr 2022 20:31:15 +0000 (04:31 +0800)]
Refactor readme file renderer (#19502)

* Refactor readme file renderer

* improve

2 years agoAllow package dump skipping (#19506)
KN4CK3R [Tue, 26 Apr 2022 20:30:51 +0000 (22:30 +0200)]
Allow package dump skipping (#19506)

* Added addReader to support verbose.

* Allow skipping packages.

* Updated docs.

* Update cmd/dump.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUnset git author/committer variables when running integration tests (#19512)
zeripath [Tue, 26 Apr 2022 20:28:45 +0000 (21:28 +0100)]
Unset git author/committer variables when running integration tests (#19512)

TestAPIGitTag (and likely others) will fail if the running environment contains
GIT_AUTHOR_NAME and other env variables like it.

This PR simply unsets these when running the integration tests.

Fix #14247

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAllow commit status popup on /pulls page (#19507)
parnic [Tue, 26 Apr 2022 19:09:46 +0000 (14:09 -0500)]
Allow commit status popup on /pulls page (#19507)

* Allow commit status popup on /pulls page

The /pulls page doesn't contain a "repository" element, so the early-out here was preventing the commit status popup hook from working. However, the only thing the .repository element is being used for here is determining whether the popup should be on the right or on the left, so we don't actually need the element to exist for the hook to work.

Pull request #19375 allows the statuses on /pulls pages to appear clickable, but this commit is required to make the popup actually work there.

* Move commit statuses popup hook to dedicated func

* Add missing import

2 years agoUse router param for filepath in GetRawFile (#19499)
John Olheiser [Tue, 26 Apr 2022 17:15:45 +0000 (12:15 -0500)]
Use router param for filepath in GetRawFile (#19499)

* Use router param for filepath

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move TreePath back into RepoRefForAPI

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix two typos (#19504)
Lunny Xiao [Tue, 26 Apr 2022 16:01:42 +0000 (00:01 +0800)]
Fix two typos (#19504)

2 years agoAdd a new menu in file view to open blame view and fix blame view select range bug...
Lunny Xiao [Tue, 26 Apr 2022 10:54:40 +0000 (18:54 +0800)]
Add a new menu in file view to open blame view and fix blame view select range bug (#19500)

2 years agoFix two UI bugs: JS error in imagediff.js, 500 error in diff/compare.tmpl
wxiaoguang [Tue, 26 Apr 2022 03:14:01 +0000 (11:14 +0800)]
Fix two UI bugs: JS error in imagediff.js, 500 error in diff/compare.tmpl

Co-authored-by: 6543 <6543@obermui.de>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 26 Apr 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoImprove Stopwatch behavior (#18930)
Gusted [Mon, 25 Apr 2022 20:45:22 +0000 (20:45 +0000)]
Improve Stopwatch behavior (#18930)

- Don't send empty stopwatch over and over again, only send once.
- Stop interval to update stopwatch's timer when there is no more stopwatch.

2 years agoPass gitRepo down to GetRawDiff, since its used for main repo and wiki (#19461)
6543 [Mon, 25 Apr 2022 18:45:18 +0000 (20:45 +0200)]
Pass gitRepo down to GetRawDiff, since its used for main repo and wiki (#19461)

as per https://github.com/go-gitea/gitea/pull/19449#issuecomment-1105283931

pass gitRepo down to GetRawDiff, since its used for main repo and wiki

2 years agoUse queue instead of memory queue in webhook send service (#19390)
Lunny Xiao [Mon, 25 Apr 2022 18:03:01 +0000 (02:03 +0800)]
Use queue instead of memory queue in webhook send service (#19390)

2 years agoadd a directory prefix `gitea-src-VERSION` to release-tar-file (#19396)
jklippel [Mon, 25 Apr 2022 16:41:07 +0000 (18:41 +0200)]
add a directory prefix `gitea-src-VERSION` to release-tar-file (#19396)

Use a directory prefix instead on creating the tar file. Fixes: #19066

2 years agoUser specific repoID or xorm builder conditions for issue search (#19475)
6543 [Mon, 25 Apr 2022 14:06:24 +0000 (16:06 +0200)]
User specific repoID or xorm builder conditions for issue search (#19475)

* extend models.IssuesOptions to have more specific repo filter options

* use new options

* unrelated refactor

* rm RepoIDs

2 years agoAdd notags to fetch (#19487)
6543 [Mon, 25 Apr 2022 13:07:08 +0000 (15:07 +0200)]
Add notags to fetch (#19487)

2 years agoSimplify the code to get issue count (#19380)
Lunny Xiao [Mon, 25 Apr 2022 07:04:42 +0000 (15:04 +0800)]
Simplify the code to get issue count (#19380)

* Simple the code to get issue count

* Improve codes

2 years agouse IsLoopback (#19477)
6543 [Mon, 25 Apr 2022 05:55:12 +0000 (07:55 +0200)]
use IsLoopback (#19477)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 25 Apr 2022 00:10:29 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd RSS Feed buttons to Repo, User and Org pages (#19370)
ktprograms [Sun, 24 Apr 2022 20:03:39 +0000 (04:03 +0800)]
Add RSS Feed buttons to Repo, User and Org pages (#19370)

2 years ago[doctor] authorized-keys: fix displayed check name (#19464)
Pilou [Sun, 24 Apr 2022 18:06:33 +0000 (20:06 +0200)]
[doctor] authorized-keys: fix displayed check name (#19464)

The registered check name is authorized-keys, not authorized_keys.

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 24 Apr 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUse horizontal tabs for repo header on mobile (#19468)
Gusted [Sat, 23 Apr 2022 16:56:33 +0000 (16:56 +0000)]
Use horizontal tabs for repo header on mobile (#19468)

* Use horizontal tabs for repo header on mobile

- The current behavior of the repo header on mobile is to display them
vertically column-by-column. I've only experience annoyance due to this
while trying to visit gitea instanced on mobile. This commit changes
this behavior to use horizontal tabs, it uses less tabs and doesn't
bloat 60% of your mobile screen with the repo headers.
- A small fix added in this commit is to give some space around the repo
buttons, current behavior is that they are too "close" to the repo
title.

* Fix lint

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 23 Apr 2022 00:10:15 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoMark TemplateLoading error as "UnprocessableEntity" (#19445)
Gusted [Fri, 22 Apr 2022 17:19:55 +0000 (17:19 +0000)]
Mark TemplateLoading error as "UnprocessableEntity" (#19445)

- Don't return Internal Server error if the user provide incorrect label
template, instead return UnprocessableEntity.
- Resolves #19399

2 years agoPrevent dangling cat-file calls (goroutine alternative) (#19454)
zeripath [Fri, 22 Apr 2022 15:20:04 +0000 (16:20 +0100)]
Prevent dangling cat-file calls (goroutine alternative) (#19454)

If an `os/exec.Command` is passed non `*os.File` as an input/output, go
will create `os.Pipe`s and wait for their closure in `cmd.Wait()`.  If
the code following this is responsible for closing `io.Pipe`s or other
handlers then on process death from context cancellation the `Wait` can
hang.

There are two possible solutions:

1. use `os.Pipe` as the input/output as `cmd.Wait` does not wait for these.
2. create a goroutine waiting on the context cancellation that will close the inputs.

This PR provides the second option - which is a simpler change that can
be more easily backported.

Closes #19448

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 22 Apr 2022 00:10:36 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoSet correct PR status on 3way on conflict checking (#19457)
Gusted [Thu, 21 Apr 2022 21:55:45 +0000 (21:55 +0000)]
Set correct PR status on 3way on conflict checking (#19457)

* Set correct PR status on 3way on conflict checking

- When 3-way merge is enabled for conflict checking, it has a new
interesting behavior that it doesn't return any error when it found a
conflict, so we change the condition to not check for the error, but
instead check if conflictedfiles is populated, this fixes a issue
whereby PR status wasn't correctly on conflicted PR's.
- Refactor the mergeable property(which was incorrectly set and lead me this
bug) to be more maintainable.
- Add a dedicated test for conflicting checking, so it should prevent
future issues with this.

* Fix linter

2 years agoFix logging of Transfer API (#19456)
Gusted [Thu, 21 Apr 2022 16:05:53 +0000 (16:05 +0000)]
Fix logging of Transfer API (#19456)

- Use the correct fullname's in tracing calls.
- Return correct function name in error.

Co-authored-by: 6543 <6543@obermui.de>
2 years agoRepoAssignment ensure to close before overwrite (#19449)
6543 [Thu, 21 Apr 2022 15:17:57 +0000 (17:17 +0200)]
RepoAssignment ensure to close before overwrite (#19449)

* check if GitRepo already open and close if

* only run RepoAssignment once

* refactor context helper for api to open GitRepo

2 years agonode12 is EOL (#19451)
techknowlogick [Thu, 21 Apr 2022 01:17:39 +0000 (21:17 -0400)]
node12 is EOL (#19451)

* node12 is EOL

* fix lockfile

2 years agoAdd Changelog v1.16.6 (#19339) (#19450)
6543 [Thu, 21 Apr 2022 01:17:23 +0000 (03:17 +0200)]
Add Changelog v1.16.6 (#19339) (#19450)

* Add Changelog v1.16.6 (#19339)

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
* bump version

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix DELETE request for non-existent public key (#19443)
Gusted [Thu, 21 Apr 2022 01:08:30 +0000 (01:08 +0000)]
Fix DELETE request for non-existent public key (#19443)

- Add a return for the first "block" of errors, which fixes the double
error messages.
- Add a return for `externallyManaged`.
- Resolves #19398

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 21 Apr 2022 00:10:26 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoDon't panic on `ErrEmailInvalid` (#19441)
Gusted [Wed, 20 Apr 2022 21:39:30 +0000 (21:39 +0000)]
Don't panic on `ErrEmailInvalid` (#19441)

- Don't panic on `ErrEmailInvalid`, this was caused due that we were
trying to force `ErrEmailCharIsNotSupported` interface, which panics.
- Resolves #19397

2 years agoWhen dumping trim the standard suffices instead of a random suffix (#19440)
zeripath [Wed, 20 Apr 2022 18:53:34 +0000 (19:53 +0100)]
When dumping trim the standard suffices instead of a random suffix (#19440)

* When dumping trim the standard suffices instead of a random suffix

Instead of using the `path.Ext()` to trim the last "extension" suffix, just iterate
through the supported suffices and trim those.

Fix #19424

Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix enum with to have correct supported types only

Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd uploadpack.allowAnySHA1InWant to allow --filter=blob:none with older git clients...
zeripath [Wed, 20 Apr 2022 15:52:16 +0000 (16:52 +0100)]
Add uploadpack.allowAnySHA1InWant to allow --filter=blob:none with older git clients (#19430)

Older git clients need uploadpack.allowAnySHA1InWant if partial cloning is allowed.

Fix #19118

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoDon't allow merging PR's which are being conflict checked (#19357)
Gusted [Wed, 20 Apr 2022 14:43:15 +0000 (14:43 +0000)]
Don't allow merging PR's which are being conflict checked (#19357)

* Don't allow merging PR's which are being conflict checked

- When a PR is still being conflict checked, don't allow the PR to be
merged(the merge button could already be visible before e.g. a new
commit was pushed to the PR).
- Relevant(should prevent such issue from happening) #19352

Co-authored-by: delvh <dev.lh@web.de>
2 years agodoc: add brief intro on using traefik as reverse-proxy (#19432)
Campbell He [Wed, 20 Apr 2022 14:08:23 +0000 (22:08 +0800)]
doc: add brief intro on using traefik as reverse-proxy (#19432)

2 years agoFix panic in team repos API (#19431)
qwerty287 [Wed, 20 Apr 2022 10:43:26 +0000 (12:43 +0200)]
Fix panic in team repos API (#19431)

* Fix panic in team repos API

* Fix pagination

* fmt