]> source.dussan.org Git - gitea.git/log
gitea.git
22 months agoMake gitea work using cmd.exe again (#22073) (#22133)
zeripath [Wed, 14 Dec 2022 13:13:16 +0000 (13:13 +0000)]
Make gitea work using cmd.exe again (#22073) (#22133)

Backport #22073

Gitea will attempt to lookup its location using LookPath however, this
fails on cmd.exe if gitea is in the current working directory.

exec.LookPath will return an exec.ErrDot error which we can test for and
then simply using filepath.Abs(os.Args[0]) to absolute gitea against the
current working directory.

Fix #22063

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoFix sorting admin user list by last login (#22081) (#22107)
aceArt-GmbH [Tue, 13 Dec 2022 22:37:33 +0000 (23:37 +0100)]
Fix sorting admin user list by last login (#22081) (#22107)

22 months agoFix parallel creating commit status bug with tests (#21911) (#21989)
Lunny Xiao [Tue, 13 Dec 2022 10:59:18 +0000 (18:59 +0800)]
Fix parallel creating commit status bug with tests (#21911) (#21989)

backport #21911
backport #21998

Co-authored-by: silverwind <me@silverwind.io>
22 months agoFix permission check on issue/pull lock (#22113)
Lunny Xiao [Mon, 12 Dec 2022 19:59:50 +0000 (03:59 +0800)]
Fix permission check on issue/pull lock (#22113)

backport #22110

22 months agoWorkaround for container registry push/pull errors (#21862) (#22068)
KN4CK3R [Sat, 10 Dec 2022 00:11:46 +0000 (01:11 +0100)]
Workaround for container registry push/pull errors (#21862) (#22068)

Backport of #21862

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoFix issue/PR numbers (#22037) (#22044)
Jason Song [Wed, 7 Dec 2022 06:20:12 +0000 (14:20 +0800)]
Fix issue/PR numbers (#22037) (#22044)

Backport #22037.

When deleting a closed issue, we should update both `NumIssues`and
`NumClosedIssues`, or `NumOpenIssues`(`= NumIssues -NumClosedIssues`)
will be wrong. It's the same for pull requests.

Releated to #21557.

Alse fixed two harmless problems:

- The SQL to check issue/PR total numbers is wrong, that means it will
update the numbers even if they are correct.
- Replace legacy `num_issues = num_issues + 1` operations with
`UpdateRepoIssueNumbers`.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoHandle empty author names (#21902) (#22027)
zeripath [Tue, 6 Dec 2022 13:16:47 +0000 (13:16 +0000)]
Handle empty author names (#21902) (#22027)

Backport #21902

Although git does expect that author names should be of the form: `NAME
<EMAIL>` some users have been able to create commits with: `<EMAIL>`

Fix #21900

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoAdd dumb-init to rootless docker (#22046)
Michael Kriese [Tue, 6 Dec 2022 11:01:58 +0000 (12:01 +0100)]
Add dumb-init to rootless docker (#22046)

- backport #21775

22 months agoUse GhostUser if needed for TrackedTimes (#22021) (#22029)
zeripath [Mon, 5 Dec 2022 12:20:37 +0000 (12:20 +0000)]
Use GhostUser if needed for TrackedTimes (#22021) (#22029)

Backport #22021

When getting tracked times out of the db and loading their attributes
handle not exist errors in a nicer way. (Also prevent an NPE.)

Fix #22006

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoEnsure that Chinese punctuation is not ambiguous when locale is Chinese (#22019)...
zeripath [Mon, 5 Dec 2022 09:20:38 +0000 (09:20 +0000)]
Ensure that Chinese punctuation is not ambiguous when locale is Chinese (#22019) (#22030)

Backport #22019

Although there are per-locale fallbacks for ambiguity the locale names
for Chinese do not quite match our locales. This PR simply maps zh-CN on
to zh-hans and other zh variants on to zh-hant.

Ref #20999

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
22 months agoFix ListBranches to handle empty case (#21921) (#22024)
Lunny Xiao [Sun, 4 Dec 2022 22:13:11 +0000 (06:13 +0800)]
Fix ListBranches to handle empty case (#21921) (#22024)

Fix #21910
Backport #21921

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
22 months agoDo not emit ambiguous character warning on rendered pages (#22016) (#22018)
zeripath [Sun, 4 Dec 2022 11:10:54 +0000 (11:10 +0000)]
Do not emit ambiguous character warning on rendered pages (#22016) (#22018)

Backport #22016

The real sensitivity of ambiguous characters is in source code -
therefore warning about them in rendered pages causes too many warnings.
Therefore simply remove the warning on rendered pages.

The escape button will remain available and it is present on the view
source page.

Fix #20999

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoOn tag/branch-exist check, dont panic if repo is nil (#21787) (#21788)
6543 [Sun, 4 Dec 2022 10:29:19 +0000 (11:29 +0100)]
On tag/branch-exist check, dont panic if repo is nil (#21787) (#21788)

backport #21787

22 months agoUse path not filepath in template filenames (#21993) (#22022)
zeripath [Sun, 4 Dec 2022 05:58:58 +0000 (05:58 +0000)]
Use path not filepath in template filenames (#21993) (#22022)

Backport #21993

Paths in git are always separated by `/` not `\` - therefore we should
`path` and not `filepath`

Fix #21987

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
22 months agoMultiple improvements for comment edit diff (#21990) (#22007)
silverwind [Fri, 2 Dec 2022 20:42:41 +0000 (21:42 +0100)]
Multiple improvements for comment edit diff (#21990) (#22007)

Backport #21990

- Use explicit avatar size so when JS copies the HTML, the size gets
copied with it
- Replace icon font use with SVG
- Improve styling and diff rendering
- Sort lists in `svg.js`

Fixes: https://github.com/go-gitea/gitea/issues/21924
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
22 months agoCorrect the fallbacks for mailer configuration (#21945) (#21953)
zeripath [Sun, 27 Nov 2022 19:45:59 +0000 (19:45 +0000)]
Correct the fallbacks for mailer configuration (#21945) (#21953)

Backport #21945

Unfortunately the fallback configuration code for [mailer] that were
added in #18982 are incorrect. When you read a value from an ini section
that key is added. This leads to a failure of the fallback mechanism.
Further there is also a spelling mistake in the startTLS configuration.

This PR restructures the mailer code to first map the deprecated
settings on to the new ones - and then use ini.MapTo to map those on to
the struct with additional validation as necessary.

Ref #21744

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoFix markdown anchor re-clicking (#21931) (#21946)
silverwind [Sat, 26 Nov 2022 16:21:13 +0000 (17:21 +0100)]
Fix markdown anchor re-clicking (#21931) (#21946)

Backport #21931. The hashchange event did not fire on re-click of a
active anchor. Instead, use the click event which always fires.

Fixes: https://github.com/go-gitea/gitea/issues/21680
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
22 months agoPrevent NPE if trying to restore an already restored deleted branch (#21940) (#21944)
zeripath [Fri, 25 Nov 2022 23:28:03 +0000 (23:28 +0000)]
Prevent NPE if trying to restore an already restored deleted branch (#21940) (#21944)

Backport #21940

If a deleted-branch has already been restored, a request to restore it
again will cause a NPE. This PR adds detection for this case, but also
disables buttons when they're clicked in order to help prevent
accidental repeat requests.

Fix #21930

Signed-off-by: Andrew Thornton <art27@cantab.net>
22 months agoAdd support for HEAD requests in Maven registry (#21834) (#21929)
KN4CK3R [Fri, 25 Nov 2022 11:46:28 +0000 (12:46 +0100)]
Add support for HEAD requests in Maven registry (#21834) (#21929)

Backport of #21834

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoFix button in branch list, avoid unexpected page jump before restore branch actually...
Xinyu Zhou [Thu, 24 Nov 2022 16:02:33 +0000 (00:02 +0800)]
Fix button in branch list, avoid unexpected page jump before restore branch actually done (#21562) (#21928)

Backport #21562

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
22 months agoadd changelog for 1.18.0-rc1 (#21829) v1.18.0-rc1
techknowlogick [Thu, 24 Nov 2022 11:49:22 +0000 (06:49 -0500)]
add changelog for 1.18.0-rc1 (#21829)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
22 months agoFix flex layout for repo list icons (#21896) (#21920)
Xinyu Zhou [Thu, 24 Nov 2022 06:44:07 +0000 (14:44 +0800)]
Fix flex layout for repo list icons (#21896) (#21920)

Backport #21896

#20241 Added a tooltip, which does not satisfy the flex layout, and the
icons are not aligned

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
22 months agoFix vertical align of committer avatar rendered by email address (#21884) (#21918)
Xinyu Zhou [Thu, 24 Nov 2022 02:52:20 +0000 (10:52 +0800)]
Fix vertical align of committer avatar rendered by email address (#21884) (#21918)

Backport #21884

Committer avatar rendered by `func AvatarByEmail` are not vertical align
as `func Avatar` does.

- Replace literals `ui avatar` and `ui avatar vm` with the constant
`DefaultAvatarClass`

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
22 months agoFix setting HTTP headers after write (#21833) (#21877)
KN4CK3R [Tue, 22 Nov 2022 01:00:42 +0000 (02:00 +0100)]
Fix setting HTTP headers after write (#21833) (#21877)

Backport of #21833

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
22 months agoDo not allow Ghost access to limited visible user/org (#21849) (#21876)
KN4CK3R [Sun, 20 Nov 2022 19:37:20 +0000 (20:37 +0100)]
Do not allow Ghost access to limited visible user/org (#21849) (#21876)

Backport of #21849

22 months agoColor and Style enhancements (#21784, #21799) (#21868)
silverwind [Sun, 20 Nov 2022 10:47:02 +0000 (11:47 +0100)]
Color and Style enhancements (#21784, #21799) (#21868)

Backport #21784
Backport #21799

These PRs provide tweaks and simplification to the less/css selectors, simplifying text color selectors and tweak arc-green colors with a follow-up to adjust the timeline

See the original PRs for more details

22 months agoSupport comma-delimited string as labels in issue template (#21831) (#21873)
Jason Song [Sun, 20 Nov 2022 10:44:20 +0000 (18:44 +0800)]
Support comma-delimited string as labels in issue template (#21831) (#21873)

Backport #21831.

The [labels in issue YAML templates](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms#top-level-syntax)
can be a string array or a comma-delimited string, so a single string
should be valid labels.

The old codes committed in #20987 ignore this, that's why the warning is
displayed:

<img width="618" alt="image" src="https://user-images.githubusercontent.com/9418365/202112642-93dc72d0-71c3-40a2-9720-30fc2d48c97c.png">

Fixes #17877.

22 months agoPrevent dangling user redirects (#21856) (#21858)
Gusted [Fri, 18 Nov 2022 14:25:00 +0000 (15:25 +0100)]
Prevent dangling user redirects (#21856) (#21858)

- Backport #21856
- It's possible that the `user_redirect` table contains a user id that
no longer exists.
  - Delete a user redirect upon deleting the user.
- Add a check for these dangling user redirects to check-db-consistency.

23 months agoIgnore issue template with a special name (#21830) (#21835)
Jason Song [Wed, 16 Nov 2022 19:48:33 +0000 (03:48 +0800)]
Ignore issue template with a special name (#21830) (#21835)

Backport #21830.

A file in `ISSUE_TEMPLATE` with the name `config.yml` shouldn't be
treated as a YAML template, it's for [configuring the template
chooser](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser).

The old code tried to ignore the file, but it didn't work, caused by
#20987. That's why the warning is displayed:

<img width="415" alt="image"

src="https://user-images.githubusercontent.com/9418365/202094067-804c42fe-0e9e-4fc5-bf01-d95fa336f54f.png">

Note that this PR is not an implementation of `config.yml`, there will
be another one to do it.

23 months agoPrevent panic in doctor command when running default checks (#21791) (#21807)
zeripath [Mon, 14 Nov 2022 02:58:32 +0000 (02:58 +0000)]
Prevent panic in doctor command when running default checks (#21791) (#21807)

Backport #21791

There was a bug introduced in #21352 due to a change of behaviour caused
by #19280. This causes a panic on running the default doctor checks
because the panic introduced by #19280 assumes that the only way
opts.StdOut and opts.Stderr can be set in RunOpts is deliberately.
Unfortunately, when running a git.Command the provided RunOpts can be
set, therefore if you share a common set of RunOpts these two values can
be set by the previous commands.

This PR stops using common RunOpts for the commands in that doctor check
but secondly stops RunCommand variants from changing the provided
RunOpts.

Signed-off-by: Andrew Thornton <art27@cantab.net>
23 months agoLoad GitRepo in API before deleting issue (#21720) (#21796)
Jason Song [Sun, 13 Nov 2022 05:54:24 +0000 (13:54 +0800)]
Load GitRepo in API before deleting issue (#21720) (#21796)

Backport #21720.

Fix #20921.

The `ctx.Repo.GitRepo` has been used in deleting issues when the issue
is a PR.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
23 months ago Upgrade golang.org/x/crypto (#21792) (#21793)
Gusted [Sun, 13 Nov 2022 04:15:21 +0000 (05:15 +0100)]
 Upgrade golang.org/x/crypto (#21792) (#21793)

- Backport #21792
- Update the crypto dependency to include
https://github.com/golang/crypto/commit/6fad3dfc18918c2ac9c112e46b32473bd2e5e2f9
  - Resolves #17798

23 months agoIgnore line anchor links with leading zeroes (#21728) (#21776)
silverwind [Fri, 11 Nov 2022 13:14:16 +0000 (14:14 +0100)]
Ignore line anchor links with leading zeroes (#21728) (#21776)

Backport #21728
Fixes: https://github.com/go-gitea/gitea/issues/21722
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoSet last login when activating account (#21731) (#21755)
Jason Song [Fri, 11 Nov 2022 06:26:17 +0000 (14:26 +0800)]
Set last login when activating account (#21731) (#21755)

Backport #21731.

Fix #21698.

Set the last login time to the current time when activating the user
successfully.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago Revert unrelated changes for SMTP auth (#21767) (#21768)
wxiaoguang [Thu, 10 Nov 2022 21:11:56 +0000 (05:11 +0800)]
 Revert unrelated changes for SMTP auth (#21767) (#21768)

Backport #21767

The purpose of #18982 is to improve the SMTP mailer, but there were some
unrelated changes made to the SMTP auth in
https://github.com/go-gitea/gitea/pull/18982/commits/d60c43869420f5fc43ad19b454c9ae50dad65964

This PR reverts these unrelated changes, fix #21744

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago Init git module before database migration (#21764) (#21765)
wxiaoguang [Thu, 10 Nov 2022 14:22:41 +0000 (22:22 +0800)]
 Init git module before database migration (#21764) (#21765)

Backport #21764

Some database migrations depend on the git module.

23 months agoFix dashboard ignored system setting cache (#21621) (#21759)
Lunny Xiao [Thu, 10 Nov 2022 11:41:44 +0000 (19:41 +0800)]
Fix dashboard ignored system setting cache (#21621) (#21759)

backport #21621

This is a performance regression from #18058

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
23 months agoFix UI language switching bug (#21597) (#21749)
Xinyu Zhou [Thu, 10 Nov 2022 02:14:32 +0000 (10:14 +0800)]
Fix UI language switching bug (#21597) (#21749)

Backport #21597

Related:
* https://github.com/go-gitea/gitea/pull/21596#issuecomment-1291450224

There was a bug when switching language by AJAX: the irrelevant POST
requests were processed by the target page's handler.

Now, use GET instead of POST. The GET requests should be harmless.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agoRemove semver compatible flag and change pypi to an array of test cases (#21708)...
Wayne Starr [Wed, 9 Nov 2022 15:02:11 +0000 (09:02 -0600)]
Remove semver compatible flag and change pypi to an array of test cases (#21708) (#21730)

Backport (#21708)

This addresses #21707 and adds a second package test case for a
non-semver compatible version (this might be overkill though since you
could also edit the old package version to have an epoch in front and
see the error, this just seemed more flexible for the future).

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
23 months agoQuick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734) (#21738)
Xinyu Zhou [Wed, 9 Nov 2022 13:19:44 +0000 (21:19 +0800)]
Quick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734) (#21738)

Backport #21734

fixes: https://github.com/go-gitea/gitea/issues/21733

Uncaught Error: Language id "vs.editor.nullLanguage" is not configured
nor known

Note that this monaco-editor worked fine on 0.33.0 and broke on 0.34.0.
If upstream fixed, remove this code.

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoAllow local package identifiers for PyPI packages (#21690) (#21727)
Wayne Starr [Wed, 9 Nov 2022 01:10:06 +0000 (19:10 -0600)]
Allow local package identifiers for PyPI packages (#21690) (#21727)

Backport (#21690)

Fixes #21683

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
23 months agoFix token generation when using INTERNAL_TOKEN_URI (#21669) (#21670)
wxiaoguang [Thu, 3 Nov 2022 20:54:25 +0000 (04:54 +0800)]
Fix token generation when using INTERNAL_TOKEN_URI (#21669) (#21670)

Backport #21669

Fix https://github.com/go-gitea/gitea/issues/21666
Caused by https://github.com/go-gitea/gitea/pull/19663

Before: when install, the INTERNAL_TOKEN was always generated and saved.
But the internal token may be already there by INTERNAL_TOKEN_URI

After: INTERNAL_TOKEN_URI file must be non-empty. When install, skip
internal token generation if the token exists.

23 months agoFix repository adoption on Windows (#21646) (#21650)
zeripath [Tue, 1 Nov 2022 22:32:03 +0000 (22:32 +0000)]
Fix repository adoption on Windows (#21646) (#21650)

Backport #21646

A bug was introduced in #17865 where filepath.Join is used to join
putative unadopted repository owner and names together. This is
incorrect as these names are then used as repository names - which shoud
have the '/' separator. This means that adoption will not work on
Windows servers.

Fix #21632

Signed-off-by: Andrew Thornton <art27@cantab.net>
23 months agoFix opaque background on mermaid diagrams (#21642) (#21652)
silverwind [Tue, 1 Nov 2022 22:31:17 +0000 (23:31 +0100)]
Fix opaque background on mermaid diagrams (#21642) (#21652)

Backport #21642

Browsers introduce a opaque background on iframes if the iframe
element's color-scheme does not match the document's color scheme which
in case of a dark theme results in a mismatch and the browser adds a
white background. Avoid this by specifying the same color scheme outside
and inside the iframe.

See https://fvsch.com/transparent-iframes for more info.

My initial attempt was to make the iframe document the same color-scheme
as the parent page (light or dark) but with that, there was a ugly
background flash on load in Chrome because Chrome apparently always
loads iframe in light scheme initially. Firefox still shows a background
flash on load but this is not possible to get rid of and it's certainly
a browser bug.

Before:
<img width="1147" alt="Screen Shot 2022-10-31 at 13 30 55"
src="https://user-images.githubusercontent.com/115237/199017132-9828aace-bdd0-4ede-8118-359e72bcf2fe.png">

After:
<img width="1152" alt="Screen Shot 2022-10-31 at 13 30 36"
src="https://user-images.githubusercontent.com/115237/199017137-989a9e67-3fe0-445f-a191-df5bf290dabf.png">

23 months agoDeal with markdown template without metadata (#21639) (#21654)
Jason Song [Tue, 1 Nov 2022 15:41:31 +0000 (23:41 +0800)]
Deal with markdown template without metadata (#21639) (#21654)

Backport #21639 .

Fixed #21636.

Related to #20987.

A markdown template without metadata should not be treated as an invalid
template.

And this PR fixed another bug that non-template files(neither .md nor
.yaml) are treated as yaml files.

<img width="504" alt="image"

src="https://user-images.githubusercontent.com/9418365/198968668-40082fa1-4f25-4d3e-9b73-1dbf6d1a7521.png">

23 months agoSync git hooks when config file path changed (#21619) (#21626)
Jason Song [Sun, 30 Oct 2022 03:17:11 +0000 (11:17 +0800)]
Sync git hooks when config file path changed (#21619) (#21626)

Backport #21619 .

A patch to #17335.

Just like AppPath, Gitea writes its own CustomConf into git hook scripts
too. If Gitea's CustomConf changes, then the git push may fail.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
23 months agoUse CSS color-scheme instead of invert (#21616) (#21623)
silverwind [Sat, 29 Oct 2022 05:24:57 +0000 (07:24 +0200)]
Use CSS color-scheme instead of invert (#21616) (#21623)

Backport #21616 to 1.18

The
[`color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme)
property changes the base color of certain form elements like the
datepicker icon in Chrome. Set it and remove the previous invert hack.

Before with invert removed:
<img width="840" alt="Screen Shot 2022-10-27 at 11 42 54"
src="https://user-images.githubusercontent.com/115237/198251927-b742e14e-0c62-492c-b667-ee6c69de4ad8.png">
<img width="238" alt="Screen Shot 2022-10-27 at 12 23 28"
src="https://user-images.githubusercontent.com/115237/198260413-37c1ca85-c2de-4c09-8b37-6aa8a23ab575.png">

After:
<img width="841" alt="Screen Shot 2022-10-27 at 11 43 05"
src="https://user-images.githubusercontent.com/115237/198251934-568fa291-0d18-4cd4-adec-58ae1ad90ab2.png">
<img width="839" alt="Screen Shot 2022-10-27 at 11 44 36"
src="https://user-images.githubusercontent.com/115237/198251936-a435105e-572b-41f6-8262-a53820f1d364.png">
<img width="243" alt="Screen Shot 2022-10-27 at 12 23 42"
src="https://user-images.githubusercontent.com/115237/198260432-5eaffc82-ffb8-4559-b1c2-08a39e8f4427.png">

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoFix `Timestamp.IsZero` (#21593) (#21603)
KN4CK3R [Thu, 27 Oct 2022 08:47:06 +0000 (10:47 +0200)]
Fix `Timestamp.IsZero` (#21593) (#21603)

Backport of #21593

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago Revert: auto generate INTERNAL_TOKEN (#21608) (#21609)
wxiaoguang [Thu, 27 Oct 2022 03:17:47 +0000 (11:17 +0800)]
 Revert: auto generate INTERNAL_TOKEN (#21608) (#21609)

Backport #21608

Follow #19663

Some users do cluster deployment, they still depend on this
auto-generating behavior.

23 months agoFix 500 on PR files API (#21602) (#21607)
qwerty287 [Wed, 26 Oct 2022 16:21:08 +0000 (18:21 +0200)]
Fix 500 on PR files API (#21602) (#21607)

Fixes an 500 error/panic if using the changed PR files API with pages
that should return empty lists because there are no items anymore.
`start-end` is then < 0 which ends in panic.

Backport https://github.com/go-gitea/gitea/pull/21602

<!--

Please check the following:

1. Make sure you are targeting the `main` branch, pull requests on
release branches are only allowed for bug fixes.
2. Read contributing guidelines:
https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md
3. Describe what your pull request does and which issue you're targeting
(if any)

-->

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: delvh <dev.lh@web.de>
23 months agoRevert "Do not send notifications for draft releases (#21451)" (#21594) v1.18.0-rc0
techknowlogick [Tue, 25 Oct 2022 22:00:00 +0000 (18:00 -0400)]
Revert "Do not send notifications for draft releases (#21451)" (#21594)

This reverts commit a37e8b275d19c0daf160cc540d981ec4f3025a5a / #21451

Temporarily revert this PR to be able to continue discussion, and
potentially get it into 1.19.0

23 months agoChange `commits-table` column width (#21564)
KN4CK3R [Tue, 25 Oct 2022 17:00:37 +0000 (19:00 +0200)]
Change `commits-table` column width (#21564)

Fixes #21561

Before

![image](https://user-images.githubusercontent.com/20903656/197388658-0ea1d941-8bc7-4f10-b5db-4ece8602b13a.png)

After

![image](https://user-images.githubusercontent.com/20903656/197388665-78fb8421-105d-408d-84cf-a86b1cc61e2e.png)

23 months agoFix issues count bug (#21557)
Lunny Xiao [Tue, 25 Oct 2022 12:47:46 +0000 (20:47 +0800)]
Fix issues count bug (#21557)

fix #19349 , #19505

Co-authored-by: delvh <dev.lh@web.de>
23 months agoImprove code comment review on mobile (#21461)
Gusted [Tue, 25 Oct 2022 11:11:49 +0000 (11:11 +0000)]
Improve code comment review on mobile (#21461)

- Fix placement of avatar image, this was not placed in the
`comment-header-left` and add CSS to cover the limiting of width+height
of avatar for code-review comment on "Files changed" page. This fixes
the big noticeable avatar issue.
- Apply `margin-bottom` to the "next" button, so it's consistent with
the "previous" button.
- Make sure the "next"/"previous" start at `flex-start` on mobile and
not off-screen at `flex-end`. As well force them to have `flex: 1` so
they won't overflow on x-asis. This also requires the `width: 100%` for
the `.ui.buttons` div.
- Resolves #20074

### Before
<details><img width="512"
src="https://user-images.githubusercontent.com/25481501/195952930-09560cad-419f-43a3-a8a4-a4166c117994.jpg"></details>

### After
<details><img width="512"
src="https://user-images.githubusercontent.com/25481501/197340081-0365dfa8-4344-46b4-8702-a40c778c073f.jpg"></details>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
23 months agoConsolidate remaining colors into variables (#21582)
silverwind [Tue, 25 Oct 2022 04:08:54 +0000 (06:08 +0200)]
Consolidate remaining colors into variables (#21582)

Remove remaining non-color variables in arc-green, so the theme is now
100% defined from variables (excluding inverts). Adjusted red/green to
match previous overwritten colors.

`--color-gold-light` is removed, it was unused and is not part of
fomantic colors.

<img width="772" alt="Screen Shot 2022-10-24 at 20 22 25"
src="https://user-images.githubusercontent.com/115237/197599339-1d1bf6e3-aa90-4f38-9753-24effd4b178d.png">
<img width="275" alt="Screen Shot 2022-10-24 at 20 25 52"
src="https://user-images.githubusercontent.com/115237/197599344-79c1d3ac-c709-4e30-a60b-4738af672c12.png">
<img width="446" alt="Screen Shot 2022-10-24 at 20 26 46"
src="https://user-images.githubusercontent.com/115237/197599346-f2ef6449-7efd-4f81-bbb6-e7bee4528f50.png">

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago[skip ci] Updated translations via Crowdin
Yarden Shoham [Tue, 25 Oct 2022 00:20:58 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

23 months agoAdd sqlite vscode extension to Gitpod configuration (#21552)
Yarden Shoham [Mon, 24 Oct 2022 20:55:59 +0000 (23:55 +0300)]
Add sqlite vscode extension to Gitpod configuration (#21552)

It allows for quick database inspections in the IDE.

![image](https://user-images.githubusercontent.com/20454870/197355299-222f5027-aba8-4fe2-b1d4-fff93d5ccb3c.png)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
23 months agoReplace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551)
delvh [Mon, 24 Oct 2022 19:29:17 +0000 (21:29 +0200)]
Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551)

Found using
`find . -type f -name '*.go' -print -exec vim {} -c
':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;`

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agoFix package access for admins and inactive users (#21580)
KN4CK3R [Mon, 24 Oct 2022 19:23:25 +0000 (21:23 +0200)]
Fix package access for admins and inactive users (#21580)

I noticed an admin is not allowed to upload packages for other users
because `ctx.IsSigned` was not set.
I added a check for `user.IsActive` and `user.ProhibitLogin` too because
both was not checked. Tests enforce this now.

Co-authored-by: Lauris BH <lauris@nix.lv>
23 months agoAllow for resolution of NPM registry paths that match upstream (#21568)
Wayne Starr [Mon, 24 Oct 2022 13:50:22 +0000 (08:50 -0500)]
Allow for resolution of NPM registry paths that match upstream (#21568)

This PR fixes issue #21567 allowing for package tarball URLs to match
the upstream registry (and GitLab/JFrog Artifactory URLs). It uses a
regex to parse the filename (which contains the NPM version) and does a
fuzzy search to pull it out. The regex was built/expanded from
http://json.schemastore.org/package,
https://github.com/Masterminds/semver, and
https://docs.npmjs.com/cli/v6/using-npm/semver and is testable here:
https://regex101.com/r/OydBJq/5

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoAdded missing headers on user packages page (#21172)
Vladimir Yakovlev [Mon, 24 Oct 2022 12:01:05 +0000 (15:01 +0300)]
Added missing headers on user packages page (#21172)

User packages page had missing tabs.

![packages-2](https://user-images.githubusercontent.com/183965/190411160-c8138a8c-dbc4-4cf1-af2c-52497a10cee8.png)

![packages-1](https://user-images.githubusercontent.com/183965/190411155-af2cb398-c9a0-4fcc-adcd-1711aaa28345.png)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
23 months agoRecord OAuth client type at registration (#21316)
M Hickford [Mon, 24 Oct 2022 07:59:24 +0000 (09:59 +0200)]
Record OAuth client type at registration (#21316)

The OAuth spec [defines two types of
client](https://datatracker.ietf.org/doc/html/rfc6749#section-2.1),
confidential and public. Previously Gitea assumed all clients to be
confidential.

> OAuth defines two client types, based on their ability to authenticate
securely with the authorization server (i.e., ability to
>   maintain the confidentiality of their client credentials):
>
>   confidential
> Clients capable of maintaining the confidentiality of their
credentials (e.g., client implemented on a secure server with
> restricted access to the client credentials), or capable of secure
client authentication using other means.
>
>   **public
> Clients incapable of maintaining the confidentiality of their
credentials (e.g., clients executing on the device used by the resource
owner, such as an installed native application or a web browser-based
application), and incapable of secure client authentication via any
other means.**
>
> The client type designation is based on the authorization server's
definition of secure authentication and its acceptable exposure levels
of client credentials. The authorization server SHOULD NOT make
assumptions about the client type.

 https://datatracker.ietf.org/doc/html/rfc8252#section-8.4

> Authorization servers MUST record the client type in the client
registration details in order to identify and process requests
accordingly.

Require PKCE for public clients:
https://datatracker.ietf.org/doc/html/rfc8252#section-8.1

> Authorization servers SHOULD reject authorization requests from native
apps that don't use PKCE by returning an error message

Fixes #21299

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoadapt README_{Country}.md stype name in localizedExtensions (#21486)
a1012112796 [Mon, 24 Oct 2022 06:12:15 +0000 (14:12 +0800)]
adapt README_{Country}.md stype name in localizedExtensions (#21486)

This stype name is also used in many repos, example:
[``README_ZH.md``](https://github.com/go-gitea/gitea/blob/main/README_ZH.md)

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
23 months agodump: Add option to skip index dirs (#21501)
Johan Van de Wauw [Mon, 24 Oct 2022 03:19:21 +0000 (05:19 +0200)]
dump: Add option to skip index dirs (#21501)

closes #20683

Add an option to gitea dump to skip the bleve indexes, which can become
quite large (in my case the same size as the repo's) and can be
regenerated after restore.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
23 months agoUse recommended vscode configuration in gitpod environments (#21537)
Yarden Shoham [Mon, 24 Oct 2022 01:24:33 +0000 (04:24 +0300)]
Use recommended vscode configuration in gitpod environments (#21537)

To make go tests run in gitpod, the vscode settings.json must be in the
correct place in the filesystem

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
23 months agoExpand "Go to File" button again, fix 'Add File' margin (#21543)
silverwind [Mon, 24 Oct 2022 01:23:04 +0000 (03:23 +0200)]
Expand "Go to File" button again, fix 'Add File' margin (#21543)

With https://github.com/go-gitea/gitea/pull/21428 we gained some space
so we are again able to show the "Go to File" button as text instead of
icon-only (the old icon was not particularily fitting anyways).

Before:
<img width="328" alt="image"
src="https://user-images.githubusercontent.com/115237/197334423-07731d9d-bf26-4aeb-95fa-490d9d0bf2a2.png">

After:
<img width="339" alt="Screen Shot 2022-10-22 at 12 28 01"
src="https://user-images.githubusercontent.com/115237/197334383-467c4107-09c9-4881-b75f-7f403eab7f3a.png">
<img width="413" alt="Screen Shot 2022-10-22 at 12 28 16"
src="https://user-images.githubusercontent.com/115237/197334384-f7d1fdda-a011-4138-ad1e-b52fc987501f.png">

23 months agoAdd yardenshoham to maintainers (#21566)
Yarden Shoham [Sun, 23 Oct 2022 16:09:21 +0000 (19:09 +0300)]
Add yardenshoham to maintainers (#21566)

[List of merged
PRs](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3Ayardenshoham+is%3Amerged)
(with many more on the way!)

Co-authored-by: Lauris BH <lauris@nix.lv>
23 months agoRefactor git command arguments and make all arguments to be safe to be used (#21535)
wxiaoguang [Sun, 23 Oct 2022 14:44:45 +0000 (22:44 +0800)]
Refactor git command arguments and make all arguments to be safe to be used (#21535)

Follow #21464

Make all git command arguments strictly safe. Most changes are one-to-one replacing, keep all existing logic.

23 months agoUpdate binding to fix bugs (#21556)
Lunny Xiao [Sun, 23 Oct 2022 10:50:48 +0000 (18:50 +0800)]
Update binding to fix bugs (#21556)

Fix #19698

23 months agoLink mentioned user in markdown only if they are visible to viewer (#21554)
Yarden Shoham [Sun, 23 Oct 2022 09:13:52 +0000 (12:13 +0300)]
Link mentioned user in markdown only if they are visible to viewer (#21554)

We need to make sure a user can't confirm the existence of a user with
private visibility

* Follow up on #21533

### Before
#### User

![image](https://user-images.githubusercontent.com/20454870/197357580-340911d7-1659-4fc9-a9f6-7ed6bc3476b4.png)

#### Admin

![image](https://user-images.githubusercontent.com/20454870/197357676-a8f0ae63-8f80-4221-a9b5-b6311552910a.png)

### After
#### User

![image](https://user-images.githubusercontent.com/20454870/197357536-05616edb-7821-469d-8e51-6f8cb84c1362.png)

#### Admin

![image](https://user-images.githubusercontent.com/20454870/197357703-071fe984-de79-43aa-a77c-a85b046292a4.png)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoRequire authentication for OAuth token refresh (#21421)
M Hickford [Sun, 23 Oct 2022 05:28:46 +0000 (07:28 +0200)]
Require authentication for OAuth token refresh (#21421)

According to the OAuth spec
https://datatracker.ietf.org/doc/html/rfc6749#section-6 when "Refreshing
an Access Token"

> The authorization server MUST ... require client authentication for
confidential clients

Fixes #21418

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoCSS color enhancements (#21534)
silverwind [Sun, 23 Oct 2022 04:05:20 +0000 (06:05 +0200)]
CSS color enhancements (#21534)

- Add
[`accent-color`](https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color)
which will change the color of various native HTML elements from
OS-color to specified one. Affects unstyled checkbox, radio, range and
progress
- Change `--color-accent` to `--color-primary-light-1`
- Change progress bar color to `--color-accent`
- Add new `--color-primary-contrast` meant to contrast over primary
- Avoid layout shift on clicking `.viewed-file-form`
- Add styles for `input[type=file]` upload button

<img width="301" alt="Screen Shot 2022-10-21 at 18 05 35"
src="https://user-images.githubusercontent.com/115237/197246896-7b3b5591-2934-4436-bf37-6aebcdfecb13.png">
<img width="98" alt="Screen Shot 2022-10-21 at 19 41 27"
src="https://user-images.githubusercontent.com/115237/197256892-c8fc6a0a-5d2f-4757-a98b-a79f9b7fcbc5.png">
<img width="93" alt="image"
src="https://user-images.githubusercontent.com/115237/197257029-293c02e9-ebf9-448a-a58f-ca418cf36953.png">
<img width="204" alt="Screen Shot 2022-10-21 at 18 21 24"
src="https://user-images.githubusercontent.com/115237/197246957-a99f5178-bbd5-4204-bd32-7a6977026f76.png">
<img width="449" alt="Screen Shot 2022-10-21 at 18 56 59"
src="https://user-images.githubusercontent.com/115237/197249305-d481abb7-9f16-4b48-936a-c75ed29f5b04.png">
<img width="449" alt="Screen Shot 2022-10-21 at 18 57 09"
src="https://user-images.githubusercontent.com/115237/197249309-7ab70c3b-325e-41bc-a4ba-07402c6826b6.png">

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoAllow package version sorting (#21453)
KN4CK3R [Sun, 23 Oct 2022 01:18:15 +0000 (03:18 +0200)]
Allow package version sorting (#21453)

23 months agoAdd link to user profile in markdown mention only if user exists (#21533)
Yarden Shoham [Sat, 22 Oct 2022 17:15:52 +0000 (20:15 +0300)]
Add link to user profile in markdown mention only if user exists (#21533)

Previously mentioning a user would link to its profile, regardless of
whether the user existed. This change tests if the user exists and only
if it does - a link to its profile is added.

* Fixes #3444

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoUpdate milestone counters when issue is deleted (#21459)
Ashley Nelson [Sat, 22 Oct 2022 15:08:10 +0000 (10:08 -0500)]
Update milestone counters when issue is deleted (#21459)

When actions besides "delete" are performed on issues, the milestone
counter is updated. However, since deleting issues goes through a
different code path, the associated milestone's count wasn't being
updated, resulting in inaccurate counts until another issue in the same
milestone had a non-delete action performed on it.

I verified this change fixes the inaccurate counts using a local docker
build.

Fixes #21254

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoPrevent Authorization header for presigned LFS urls (#21531)
KN4CK3R [Sat, 22 Oct 2022 13:36:44 +0000 (15:36 +0200)]
Prevent Authorization header for presigned LFS urls (#21531)

Fixes #21525

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoRemove deleted repos from searchresult (#21512)
Raymond [Sat, 22 Oct 2022 09:23:20 +0000 (11:23 +0200)]
Remove deleted repos from searchresult (#21512)

This prevents a 500 response, because null pointer exceptions in
rendering the template.
This happends bc the repoId is not in the repoMap because it is delete

fix #19076

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agoRemove unnecessary debug log (#21536)
Yarden Shoham [Sat, 22 Oct 2022 07:25:34 +0000 (10:25 +0300)]
Remove unnecessary debug log (#21536)

It distractingly shows up on unit tests

* Looks like a leftover from #20571

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoAdded check for disabled Packages (#21540)
rock2dust [Sat, 22 Oct 2022 03:24:09 +0000 (11:24 +0800)]
Added check for disabled Packages (#21540)

At the moment, If admin disable Packages, still show the Packages on the
admin dashboard

This patch added a check to hide the Packages entry

Signed-off-by: baronbunny <its@baronbunny.cn>
Signed-off-by: baronbunny <its@baronbunny.cn>
23 months agoDecouple HookTask from Repository (#17940)
KN4CK3R [Fri, 21 Oct 2022 16:21:56 +0000 (18:21 +0200)]
Decouple HookTask from Repository (#17940)

At the moment a repository reference is needed for webhooks. With the
upcoming package PR we need to send webhooks without a repository
reference. For example a package is uploaded to an organization. In
theory this enables the usage of webhooks for future user actions.

This PR removes the repository id from `HookTask` and changes how the
hooks are processed (see `services/webhook/deliver.go`). In a follow up
PR I want to remove the usage of the `UniqueQueue´ and replace it with a
normal queue because there is no reason to be unique.

Co-authored-by: 6543 <6543@obermui.de>
23 months agoAdd color previews in markdown (#21474)
Yarden Shoham [Fri, 21 Oct 2022 12:00:53 +0000 (15:00 +0300)]
Add color previews in markdown (#21474)

* Resolves #3047

Every time a color code will be in \`backticks`, a cute little color
preview will pop up

[Inspiration](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#supported-color-models)

#### Before

![image](https://user-images.githubusercontent.com/20454870/196631524-298afbbf-d2c8-4018-92a5-0393a693d850.png)

#### After

![image](https://user-images.githubusercontent.com/20454870/196631397-36c561e4-08f5-465a-a36e-76084e30b08a.png)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoFix generating compare link (#21519)
Lunny Xiao [Fri, 21 Oct 2022 08:39:26 +0000 (16:39 +0800)]
Fix generating compare link (#21519)

Fix #6318

Co-authored-by: zeripath <art27@cantab.net>
23 months ago[skip ci] Updated translations via Crowdin
Vladimir Yakovlev [Fri, 21 Oct 2022 00:21:01 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

23 months agoCheck for valid user token in integration tests (#21520)
Vladimir Yakovlev [Thu, 20 Oct 2022 18:20:01 +0000 (21:20 +0300)]
Check for valid user token in integration tests (#21520)

Added checks for logged user token.

Some builds fail at unrelated tests, due to missing token.

Example:
https://drone.gitea.io/go-gitea/gitea/62011/2/14

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agoIgnore error when retrieving changed PR review files (#21487)
delvh [Thu, 20 Oct 2022 08:29:40 +0000 (10:29 +0200)]
Ignore error when retrieving changed PR review files (#21487)

When a PR reviewer reviewed a file on a commit that was later gc'ed,
they would always get a `500` response from then on when loading the PR.
This PR simply ignores that error and instead marks all files as
unchanged.
This approach was chosen as the only feasible option without diving into
**a lot** of error handling.

Fixes #21392

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agomove invite by mail to services package (#21513)
6543 [Thu, 20 Oct 2022 03:23:31 +0000 (05:23 +0200)]
move invite by mail to services package (#21513)

followup  #20307
close #21511

-> make it easy to also add API equivalent later ...

23 months agoEnable Monaco automaticLayout (#21515)
silverwind [Thu, 20 Oct 2022 01:54:18 +0000 (03:54 +0200)]
Enable Monaco automaticLayout (#21515)

Enable
[`automaticLayout`](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IDiffEditorOptions.html#automaticLayout)
for monaco so it can reflow itself.

Fixes: https://github.com/go-gitea/gitea/issues/21508
23 months agoUpdate macOS install command (#21507)
RainboWu [Thu, 20 Oct 2022 01:30:21 +0000 (09:30 +0800)]
Update macOS install command (#21507)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months ago[skip ci] Updated translations via Crowdin
KN4CK3R [Thu, 20 Oct 2022 00:20:58 +0000 (00:20 +0000)]
[skip ci] Updated translations via Crowdin

23 months agoSuppress `ExternalLoginUserNotExist` error (#21504)
KN4CK3R [Wed, 19 Oct 2022 19:07:21 +0000 (21:07 +0200)]
Suppress `ExternalLoginUserNotExist` error (#21504)

Fixes #21202
Closes #21276

An `ExternalLoginUser` is not mandatory if the current user account was
created with/by the external login source.

23 months agoRevert increased width on pull pages (#21470)
Gusted [Wed, 19 Oct 2022 14:48:29 +0000 (14:48 +0000)]
Revert increased width on pull pages (#21470)

- Revert a behavior from #21012, which liberally added `fluid padded` to
non-split style pull pages, this caused it to take up the whole
screen(such in split-style pull pages) on pull pages where the diff was
shown.
- Resolves #21460

### Before

![image](https://user-images.githubusercontent.com/25481501/196005545-bb8370c1-330d-4d47-be52-6d0c93e61583.png)

![image](https://user-images.githubusercontent.com/25481501/196005546-0022198e-6ef7-45d1-958c-77a042e5f80b.png)

### After

![image](https://user-images.githubusercontent.com/25481501/196005572-76a38309-9a41-412a-854f-24eae2b9ae4f.png)

![image](https://user-images.githubusercontent.com/25481501/196005551-2495b93d-ad08-4f59-abba-c327dadcc915.png)

23 months agoAdd team member invite by email (#20307)
KN4CK3R [Wed, 19 Oct 2022 12:40:28 +0000 (14:40 +0200)]
Add team member invite by email (#20307)

Allows to add (not registered) team members by email.

related #5353

Invite by mail:

![grafik](https://user-images.githubusercontent.com/1666336/178154779-adcc547f-c0b7-4a2a-a131-4e41a3d9d3ad.png)

Pending invitations:

![grafik](https://user-images.githubusercontent.com/1666336/178154882-9d739bb8-2b04-46c1-a025-c1f4be26af98.png)

Email:

![grafik](https://user-images.githubusercontent.com/1666336/178164716-f2f90893-7ba6-4a5e-a3db-42538a660258.png)

Join form:

![grafik](https://user-images.githubusercontent.com/1666336/178154840-aaab983a-d922-4414-b01a-9b1a19c5cef7.png)

Co-authored-by: Jack Hay <jjphay@gmail.com>
23 months agoDisable the 'Add File' button when not able to edit repo (#21503)
silverwind [Wed, 19 Oct 2022 08:08:33 +0000 (10:08 +0200)]
Disable the 'Add File' button when not able to edit repo (#21503)

Previously, the button would render a dropdown with zero items when
`.CanEnableEditor` was false (for example on a mirror repo). Now it
disables the button instead which is better UX.

<img width="310" alt="image"
src="https://user-images.githubusercontent.com/115237/196546655-7262070d-dd8f-4fbe-ad5c-ecb443a9caef.png">
<img width="292" alt="image"
src="https://user-images.githubusercontent.com/115237/196546694-51ef5792-16d4-463d-aae8-7ef22dba6bb4.png">

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
23 months agoRemove vitest globals (#21505)
silverwind [Wed, 19 Oct 2022 06:50:19 +0000 (08:50 +0200)]
Remove vitest globals (#21505)

Explicitly import them instead which is cleaner and enables better
editor integration.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
23 months agoFix branch dropdown shifting on page load (#21428)
silverwind [Wed, 19 Oct 2022 05:39:55 +0000 (07:39 +0200)]
Fix branch dropdown shifting on page load (#21428)

Removed the "tag/branch" prefix and did some misc tweaks like changing to `<button>` for a11y and adding a bit of margin besides repo path.

23 months ago[skip ci] Updated translations via Crowdin
wxiaoguang [Wed, 19 Oct 2022 00:21:12 +0000 (00:21 +0000)]
[skip ci] Updated translations via Crowdin

23 months agoRemove unnecessary misspell ignore pattern (#21475)
wxiaoguang [Tue, 18 Oct 2022 16:52:25 +0000 (00:52 +0800)]
Remove unnecessary misspell ignore pattern (#21475)

It doesn't make sense to ignore the pattern again and again.

23 months agoFix read system configuration bug when installing (#21489)
Lunny Xiao [Tue, 18 Oct 2022 15:16:58 +0000 (23:16 +0800)]
Fix read system configuration bug when installing (#21489)

Fix https://github.com/go-gitea/gitea/pull/18058#issuecomment-1280944311

Co-authored-by: 6543 <6543@obermui.de>
23 months agoFix viewing user subscriptions (#21482)
zenofile [Tue, 18 Oct 2022 08:01:02 +0000 (10:01 +0200)]
Fix viewing user subscriptions (#21482)

Fix enumeration of user subscriptions. `watch.mode` is not a boolean but
a smallint.

Fixes #21447
Regression of #17156

23 months agoMake every not exist error unwrappable to a fs.ErrNotExist (#20891)
zeripath [Tue, 18 Oct 2022 05:50:37 +0000 (06:50 +0100)]
Make every not exist error unwrappable to a fs.ErrNotExist (#20891)

A lot of our code is repeatedly testing if individual errors are
specific types of Not Exist errors. This is repetitative and unnecesary.
`Unwrap() error` provides a common way of labelling an error as a
NotExist error and we can/should use this.

This PR has chosen to use the common `io/fs` errors e.g.
`fs.ErrNotExist` for our errors. This is in some ways not completely
correct as these are not filesystem errors but it seems like a
reasonable thing to do and would allow us to simplify a lot of our code
to `errors.Is(err, fs.ErrNotExist)` instead of
`package.IsErr...NotExist(err)`

I am open to suggestions to use a different base error - perhaps
`models/db.ErrNotExist` if that would be felt to be better.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>