]> source.dussan.org Git - gitea.git/log
gitea.git
18 months agoAdd tooltips for MD editor buttons and add `muted` class for buttons (#23896)
delvh [Tue, 11 Apr 2023 07:26:18 +0000 (09:26 +0200)]
Add tooltips for MD editor buttons and add `muted` class for buttons (#23896)

Followup of #23876 according to my unreleased review demanding tooltips.
Additionally
- add a `muted` equivalent for buttons
- convert `switch to legacy` to an actual button
- enroll `switch to legacy` in the builtin pseudo focus cycle
- remove spaces between the buttons

The effect of the `muted` class is what you would expect: The button
loses all of its normal styling, and is defined only by its content instead.
This will help reduce a11y infractions in the future, as that was one of
the major points why people didn't use `<button>` tags and decided on a
bad fix (i.e. through `<div>`s) instead.

## Appearance

![image](https://user-images.githubusercontent.com/51889757/229510842-337378e5-faa5-4886-a910-08614c0c233d.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
18 months agoPrefer native parser for SSH public key parsing (#23798)
Leon Busch-George [Tue, 11 Apr 2023 06:34:28 +0000 (08:34 +0200)]
Prefer native parser for SSH public key parsing (#23798)

Without this patch, the setting SSH.StartBuiltinServer decides whether
the native (Go) implementation is used rather than calling 'ssh-keygen'.
It's possible for 'using ssh-keygen' and 'using the built-in server' to
be independent.
In fact, the gitea rootless container doesn't ship ssh-keygen and can be
configured to use the host's SSH server - which will cause the public
key parsing mechanism to break.

This commit changes the decision to be based on SSH.KeygenPath instead.
Any existing configurations with a custom KeygenPath set will continue
to function. The new default value of '' selects the native version. The
downside of this approach is that anyone who has relying on plain
'ssh-keygen' to have special properties will now be using the native
version instead.
I assume the exec-variant is only there because /x/crypto/ssh didn't
support ssh-ed25519 until 2016. I don't see any other reason for using
it so it might be an acceptable risk.

Fixes #23363

EDIT: this message was garbled when I tried to get the commit
description back in.. Trying to reconstruct it:

## :warning: BREAKING :warning: Users who don't have SSH.KeygenPath
explicitly set and rely on the ssh-keygen binary need to set
SSH.KeygenPath to 'ssh-keygen' in order to be able to continue using it
for public key parsing.

There was something else but I can't remember at the moment.

EDIT2: It was about `make test` and `make lint`. Can't get them to run.
To reproduce the issue, I installed `golang` in `docker.io/node:16` and
got:
```
...
go: mvdan.cc/xurls/v2@v2.4.0: unknown revision mvdan.cc/xurls/v2.4.0
go: gotest.tools/v3@v3.4.0: unknown revision gotest.tools/v3.4.0
...
go: gotest.tools/v3@v3.0.3: unknown revision gotest.tools/v3.0.3
...
go: error loading module requirements
```

Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
18 months agoAvoid recursing into sub-sub-sub-docs folders when looking for READMEs. (#23695)
Nick [Tue, 11 Apr 2023 03:00:19 +0000 (23:00 -0400)]
Avoid recursing into sub-sub-sub-docs folders when looking for READMEs. (#23695)

Fixes a bug introduced in https://github.com/go-gitea/gitea/pull/22177
which allows finding READMEs like
docs/docs/docs/.gitea/.github/docs/README.md

Fixes https://github.com/go-gitea/gitea/issues/23694

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 11 Apr 2023 00:08:10 +0000 (00:08 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoUse auto-updating, natively hoverable, localized time elements (#23988)
Yarden Shoham [Mon, 10 Apr 2023 23:01:20 +0000 (02:01 +0300)]
Use auto-updating, natively hoverable, localized time elements (#23988)

- Added [GitHub's `relative-time` element](https://github.com/github/relative-time-element)
- Converted all formatted timestamps to use this element
- No more flashes of unstyled content around time elements
- These elements are localized using the `lang` property of the HTML file
- Relative (e.g. the activities in the dashboard) and duration (e.g.
server uptime in the admin page) time elements are auto-updated to keep
up with the current time without refreshing the page
- Code that is not needed anymore such as `formatting.js` and parts of `since.go` have been deleted

Replaces #21440
Follows #22861

## Screenshots

### Localized

![image](https://user-images.githubusercontent.com/20454870/230775041-f0af4fda-8f6b-46d3-b8e3-d340c791a50c.png)

![image](https://user-images.githubusercontent.com/20454870/230673393-931415a9-5729-4ac3-9a89-c0fb5fbeeeb7.png)

### Tooltips

#### Native for dates

![image](https://user-images.githubusercontent.com/20454870/230797525-1fa0a854-83e3-484c-9da5-9425ab6528a3.png)

#### Interactive for relative

![image](https://user-images.githubusercontent.com/115237/230796860-51e1d640-c820-4a34-ba2e-39087020626a.png)

### Auto-update

![rec](https://user-images.githubusercontent.com/20454870/230672159-37480d8f-435a-43e9-a2b0-44073351c805.gif)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
18 months agoReserve ".png" suffix for user/org names (#23992)
6543 [Mon, 10 Apr 2023 20:14:16 +0000 (22:14 +0200)]
Reserve ".png" suffix for user/org names (#23992)

Org/User names ending with ".png" where not functional, so reserve them

alternative / close  #23908

18 months agoAllow adding SSH keys even if SSH server is disabled (#24025)
Dmitry Sharshakov [Mon, 10 Apr 2023 17:22:51 +0000 (20:22 +0300)]
Allow adding SSH keys even if SSH server is disabled (#24025)

This is useful in case you want to use them for signature verification.

A notice is added to avoid confusion.

18 months agoAdd placeholder and aria attributes to release and wiki edit page (#24031)
silverwind [Mon, 10 Apr 2023 15:56:57 +0000 (17:56 +0200)]
Add placeholder and aria attributes to release and wiki edit page (#24031)

- Add placeholders and aria-label all input fields on these two pages
- Add margin before wiki change message
- Remove labels from release page, replacing them with aria-label

18 months agoAdd --quiet option to gitea dump (#22969)
Fredrik Eriksson [Mon, 10 Apr 2023 13:46:23 +0000 (15:46 +0200)]
Add --quiet option to gitea dump (#22969)

Fixes: #19687
The --quiet options to gitea dump silences informational and less
important messages, but will still log warnings and errors to console.
Very useful in combination with cron backups and '-f -'.

Since --verbose and --quiet are incompatible with each other I made it
an error to specify both. To get the error message to be printed to
stderr I had to make this test after the NewServices()-call, which is
why there are three new blocks of code instead of two.

18 months agoRemove "inverted" class on creating new label and cancel buttons (#24030)
Hester Gong [Mon, 10 Apr 2023 12:00:30 +0000 (20:00 +0800)]
Remove "inverted" class on creating new label and cancel buttons (#24030)

"inverted" class might not be needed because background of these two
buttons is light color.

inverted related rule from `semantic.css`:
```css
.ui.inverted.green.basic.buttons .button,
.ui.inverted.green.buttons .basic.button,
.ui.inverted.green.basic.button {
  background-color: transparent;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5) inset;
  color: #FFFFFF;
}
```

Before:
<img width="771" alt="截屏2023-04-10 17 21 22"
src="https://user-images.githubusercontent.com/17645053/230873878-cc64b3d6-ffa9-4cae-9280-07b06f7829b2.png">

After:
<img width="765" alt="截屏2023-04-10 17 22 14"
src="https://user-images.githubusercontent.com/17645053/230873956-9412054f-b739-4878-9ee9-57ff65eb7910.png">

18 months agoUse actions job link as commit status URL instead of run link (#24023)
Jason Song [Mon, 10 Apr 2023 10:40:30 +0000 (18:40 +0800)]
Use actions job link as commit status URL instead of run link (#24023)

A commit status is bound to a job, not a run.

---------

Co-authored-by: silverwind <me@silverwind.io>
18 months agoMake label templates have consistent behavior and priority (#23749)
wxiaoguang [Mon, 10 Apr 2023 08:44:02 +0000 (16:44 +0800)]
Make label templates have consistent behavior and priority (#23749)

Fix https://github.com/go-gitea/gitea/issues/23715

Other related PRs:

* #23717
* #23716
* #23719

This PR is different from others, it tries to resolve the problem fundamentally (and brings more benefits)

Although it looks like some more lines are added, actually many new lines are for tests.

----

Before, the code was just "guessing" the file type and try to parse them.

<details>

![image](https://user-images.githubusercontent.com/2114189/228002245-57d58e27-1078-4da9-bf42-5bc0b264c6ce.png)

</details>

This PR:

* Always remember the original option file names, and always use correct parser for them.

* Another benefit is that we can sort the Label Templates now (before there was a map, its key order is undefined)

![image](https://user-images.githubusercontent.com/2114189/228002432-931b9f18-3908-484b-a36b-04760c9ad132.png)

18 months agoAdd actions support to package auth verification (#23729)
yp05327 [Mon, 10 Apr 2023 07:21:03 +0000 (16:21 +0900)]
Add actions support to package auth verification (#23729)

Partly fixes https://github.com/go-gitea/gitea/issues/23642

Error info:

![image](https://user-images.githubusercontent.com/18380374/227827027-4280a368-ec9e-49e0-bb93-6b496ada7cd9.png)
ActionsUser (userID -2) is used to login in to docker in action jobs.

Due to we have no permission policy settings of ActionsUser now,
ActionsUser can only access public registry by this quick fix.

18 months agoFix protected branch for API (#24013)
Lunny Xiao [Mon, 10 Apr 2023 02:52:16 +0000 (10:52 +0800)]
Fix protected branch for API (#24013)

Fix #23998

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 10 Apr 2023 00:07:14 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoFix markdownlint (#24024)
silverwind [Sun, 9 Apr 2023 18:39:37 +0000 (20:39 +0200)]
Fix markdownlint (#24024)

Should fix the currently broken CI, and also validate via new
`complicance-docs` pipeline.

18 months agoIntroduce lint-md and compliance-docs pipeline (#24021)
silverwind [Sun, 9 Apr 2023 18:05:12 +0000 (20:05 +0200)]
Introduce lint-md and compliance-docs pipeline (#24021)

- Add new Make target `lint-md`
- Add new Drone pipeline `compliance-docs`
- Add `*.md` to docs exclusion/inclusion
- Consistently quote `path.include` and `path.exclude` statements in
YAML

18 months agoFix https setup doc zh-cn (#24015)
Lunny Xiao [Sun, 9 Apr 2023 17:53:08 +0000 (01:53 +0800)]
Fix https setup doc zh-cn (#24015)

18 months agoReplace tribute with text-expander-element for textarea (#23985)
silverwind [Sun, 9 Apr 2023 16:18:45 +0000 (18:18 +0200)]
Replace tribute with text-expander-element for textarea (#23985)

The completion popup now behaves now much more as expected than before
for the raw textarea:
- You can press <kbd>Tab</kbd> or <kbd>Enter</kbd> once the completion
popup is open to accept the selected item
- The menu does not close automatically when moving the cursor
- When you delete text, previously correct suggestions are shown again
- If you delete all text until the opening char (`@` or `:`) after
applying a suggestion, the popup reappears again
- Menu UI has been improved

<img width="278" alt="Screenshot 2023-04-07 at 19 43 42"
src="https://user-images.githubusercontent.com/115237/230653601-d6517b9f-0988-445e-aa57-5ebfaf5039f3.png">

18 months agoImprove GetBoards and getDefaultBoard (#22981)
yp05327 [Sun, 9 Apr 2023 14:07:23 +0000 (23:07 +0900)]
Improve GetBoards and getDefaultBoard (#22981)

Change
`GetBoards(ctx context.Context, projectID int64)`
to
`(p *Project) GetBoards(ctx context.Context) (BoardList, error)`

`getDefaultBoard` is same.

18 months agoExpand/Collapse all changed files (#23639)
sillyguodong [Sun, 9 Apr 2023 13:11:02 +0000 (21:11 +0800)]
Expand/Collapse all changed files (#23639)

close #23628

Now in `...` dropdown, you can expand or collapse all diff files that
have loaded.

https://user-images.githubusercontent.com/33891828/227749688-2d406916-3347-49f6-93a5-4092a00e8809.mov

Co-authored-by: silverwind <me@silverwind.io>
18 months agoShow errors for KaTeX and mermaid on the preview tab (#24009)
silverwind [Sun, 9 Apr 2023 12:07:43 +0000 (14:07 +0200)]
Show errors for KaTeX and mermaid on the preview tab (#24009)

There is a conflicting fomantic rule that hid the error messages inside
the markdown preview tab for things like mermaid or katex.
Overruled it to always show these errors.

<img width="774" alt="image"
src="https://user-images.githubusercontent.com/115237/230738528-322814c1-8994-495e-b901-bbb79b924ccb.png">

18 months agoShow protected branch rule names again (#23907)
Hester Gong [Sun, 9 Apr 2023 10:15:43 +0000 (18:15 +0800)]
Show protected branch rule names again (#23907)

`!important`s for one of the primary label selectors are removed by
#23774, so the repository branch protection settings ui will not have
the demanding css. This PR modifies `.ui.primary.label` to fix it.

Before:
<img width="1408" alt="飞书20230404-115410"
src="https://user-images.githubusercontent.com/17645053/229683221-ef9c7d5c-68a8-42b0-ba19-ef2d5dfce5f9.png">

After:
<img width="1419" alt="截屏2023-04-04 11 56 32"
src="https://user-images.githubusercontent.com/17645053/229683469-70cfc92d-d7ef-4323-a7f5-2247810fabce.png">

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
18 months agoReference the `zh-CN` version of `reverse-proxies` in `https-support` (#24016)
Yarden Shoham [Sun, 9 Apr 2023 09:31:31 +0000 (12:31 +0300)]
Reference the `zh-CN` version of `reverse-proxies` in `https-support` (#24016)

18 months agoFix lint problem in `https-support.zh-cn.md` (#24014)
Yarden Shoham [Sun, 9 Apr 2023 09:06:31 +0000 (12:06 +0300)]
Fix lint problem in `https-support.zh-cn.md` (#24014)

https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md051

18 months agodocs: HTTPS configuration for zh-cn (#23039)
阿卡林刘 [Sun, 9 Apr 2023 08:30:26 +0000 (16:30 +0800)]
docs: HTTPS configuration for zh-cn (#23039)

added the Use HTTPS Configuration section Translation Chinese

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
18 months agoRe-add initial wiki page text when editing the page (#23984)
wxiaoguang [Sun, 9 Apr 2023 07:51:32 +0000 (15:51 +0800)]
Re-add initial wiki page text when editing the page (#23984)

The `$content` was prepared above, but forgot to put it into the editor

Fix #23979

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 9 Apr 2023 00:07:20 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

18 months agofix: do not escape space between PyPI repository url and package name… (#23981)
Daniel Gunzinger [Sat, 8 Apr 2023 18:57:00 +0000 (20:57 +0200)]
fix: do not escape space between PyPI repository url and package name… (#23981)

…; add trailing slash to PyPI repository URL (in accordance to PEP-503)

This should solve Issue #23980, by moving the space in front of the
package name and the package name out of the `gitea-origin-url` block.
It also adds a trailing slash to the PyPI repository URL in accordance
to [Python PEP-503](https://peps.python.org/pep-0503/).

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
18 months agoMake bindata static build parse builtin templates correctly (#24003)
wxiaoguang [Sat, 8 Apr 2023 13:56:50 +0000 (21:56 +0800)]
Make bindata static build parse builtin templates correctly (#24003)

Close #24002

Two problems before:

1. The `log.Fatal` is missing after these `wrapFatal` calls, so the
error is not shown to users.
2. `GetTemplateAssetNames` has different behaviors for local files and
builtin assets, for builtin assets, it also returns directories, so we
need to check the extension again.

I have tested with `TAGS="bindata sqlite sqlite_unlock_notify" make
build && ./gitea` , it works well now. Before, the server responds
internal server error (because it doesn't complete the template parsing)

18 months agoGroup template helper functions, remove `Printf`, improve template error messages...
wxiaoguang [Sat, 8 Apr 2023 13:15:22 +0000 (21:15 +0800)]
Group template helper functions, remove `Printf`, improve template error messages (#23982)

Follow #23328

Major changes:

* Group the function in `templates/help.go` by their purposes. It could
make future work easier.
* Remove the `Printf` helper function, there is already a builtin
`printf`.
* Remove `DiffStatsWidth`, replace with `Eval` in template
* Rename the `NewTextFuncMap` to `mailSubjectTextFuncMap`, it's for
subject text template only, no need to make it support HTML functions.

----

And fine tune template error messages, to make it more friendly to
developers and users.

![image](https://user-images.githubusercontent.com/2114189/230714245-4fd202d1-2b25-41b2-8be5-03c5fee45091.png)

![image](https://user-images.githubusercontent.com/2114189/230714277-66783577-2a03-49d5-8e8c-ceba5e07a2d4.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
18 months agoAdjust sticky pr header to cover background (#23956)
silverwind [Sat, 8 Apr 2023 12:43:15 +0000 (14:43 +0200)]
Adjust sticky pr header to cover background (#23956)

Very minor CSS tweak: Adjust sticky PR header to cover the box-shadow of
selected files.

Before:
<img width="1250" alt="Screenshot 2023-04-06 at 22 54 59"
src="https://user-images.githubusercontent.com/115237/230492218-4d71da48-a362-4c52-a7f7-01daf4ffa458.png">

After:
<img width="1255" alt="Screenshot 2023-04-06 at 22 54 46"
src="https://user-images.githubusercontent.com/115237/230492227-c7142210-e535-4da8-b610-37d33dcbb549.png">

18 months agoUpdate github.com/google/go-github to v51 (#23946)
harryzcy [Sat, 8 Apr 2023 11:27:30 +0000 (07:27 -0400)]
Update github.com/google/go-github to v51 (#23946)

`github.com/google/go-github` has new major version releases frequently.
It is required to update all import path, in additional to `go.mod`

18 months agoShow visibility status of email in own profile (#23900)
n0toose [Sat, 8 Apr 2023 10:05:21 +0000 (10:05 +0000)]
Show visibility status of email in own profile (#23900)

I've heard many reports of users getting scared when they see their own
email address for their own profile, as they believe that the email
field is also visible to other users. Currently, using Incognito mode
or going over the Settings is the only "reasonable" way to verify this
from the perspective of the user.

A locked padlock should be enough to indicate that the email is not
visible to anyone apart from the user and the admins. An unlocked
padlock is used if the email address is only shown to authenticated
users.

Some additional string-related changes in the Settings were introduced
as well to ensure consistency, and the comments in the relevant tests
were improved so as to allow for easier modifications in the future.

---

#### Screenshot (EDIT: Scroll down for more up-to-date screenshots)

***Please remove this section before merging.***

![image](https://user-images.githubusercontent.com/30193966/229572425-909894aa-a7d5-4bf3-92d3-23b1921dcc90.png)

This lock should only appear if the email address is explicitly hidden
using the `Hide Email Address` setting. The change was originally tested
on top of and designed for the Forgejo fork, but I don't expect any
problems to arise from this and I don't think that a
documentation-related change is strictly necessary.

---------

Co-authored-by: silverwind <me@silverwind.io>
18 months agoAdd eslint-plugin-custom-elements (#23991)
silverwind [Sat, 8 Apr 2023 09:24:42 +0000 (11:24 +0200)]
Add eslint-plugin-custom-elements (#23991)

Add
[eslint-plugin-custom-elements](https://github.com/github/eslint-plugin-custom-elements)
and enable all rules that I've found sensible.

18 months agoFix redirect bug when creating issue from a project (#23971)
Lunny Xiao [Sat, 8 Apr 2023 08:17:50 +0000 (16:17 +0800)]
Fix redirect bug when creating issue from a project (#23971)

Fix #23966

18 months agoDrop "unrolled/render" package (#23965)
wxiaoguang [Sat, 8 Apr 2023 06:21:50 +0000 (14:21 +0800)]
Drop "unrolled/render" package (#23965)

None of the features of `unrolled/render` package is used.

The Golang builtin "html/template" just works well. Then we can improve
our HTML render to resolve the "$.root.locale.Tr" problem as much as
possible.

Next step: we can have a template render pool (by Clone), then we can
inject global functions with dynamic context to every `Execute` calls.
Then we can use `{{Locale.Tr ....}}` directly in all templates , no need
to pass the `$.root.locale` again and again.

18 months agoBump vm2 from 3.9.14 to 3.9.15 (#23990)
dependabot[bot] [Fri, 7 Apr 2023 23:29:07 +0000 (19:29 -0400)]
Bump vm2 from 3.9.14 to 3.9.15 (#23990)

Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.14 to 3.9.15.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/patriksimek/vm2/releases">vm2's
releases</a>.</em></p>
<blockquote>
<h2>3.9.15</h2>
<p><strong>Fixes</strong></p>
<p><a
href="https://github.com/patriksimek/vm2/commit/d534e5785f38307b70d3aac1945260a261a94d50">https://github.com/patriksimek/vm2/commit/d534e5785f38307b70d3aac1945260a261a94d50</a>:
Ensure no host objects are passed through to
<code>Error.prepareStackTrace</code>. (Thanky to Seongil Wi from KAIST
<a href="https://wsp-lab.github.io/">WSP Lab</a>)</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md">vm2's
changelog</a>.</em></p>
<blockquote>
<h2>v3.9.15 (2023-04-06)</h2>
<p>[fix] Security fix (see <a
href="https://redirect.github.com/patriksimek/vm2/issues/515">patriksimek/vm2#515</a>).</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/patriksimek/vm2/commit/115d1644b7308a5570cba58ec461ae61b96a583c"><code>115d164</code></a>
Release 3.9.15</li>
<li><a
href="https://github.com/patriksimek/vm2/commit/d534e5785f38307b70d3aac1945260a261a94d50"><code>d534e57</code></a>
Wrap host objects passes through prepareStackTrace</li>
<li>See full diff in <a
href="https://github.com/patriksimek/vm2/compare/3.9.14...3.9.15">compare
view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=vm2&package-manager=npm_and_yarn&previous-version=3.9.14&new-version=3.9.15)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/go-gitea/gitea/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
18 months agoAdd job.duration in web ui (#23963)
yp05327 [Fri, 7 Apr 2023 22:20:50 +0000 (07:20 +0900)]
Add job.duration in web ui (#23963)

![image](https://user-images.githubusercontent.com/18380374/230532947-271ac389-8134-4c5e-8f2f-ced4a4fd0ebe.png)

![image](https://user-images.githubusercontent.com/18380374/230532963-e76532c5-7ca1-4b01-ae77-cc1223350fe7.png)

Maybe we can change the location of it.

18 months agoFix markup background, improve wiki rendering (#23750)
silverwind [Fri, 7 Apr 2023 21:30:04 +0000 (23:30 +0200)]
Fix markup background, improve wiki rendering (#23750)

Fix regression from https://github.com/go-gitea/gitea/pull/23578. Only
visible on arc-green.

Before:
<img width="997" alt="Screenshot 2023-03-27 at 19 14 21"
src="https://user-images.githubusercontent.com/115237/228016589-e7cabfb9-bfd0-45fd-9407-6b76c665ed1a.png">

After:
<img width="1000" alt="Screenshot 2023-03-27 at 19 14 05"
src="https://user-images.githubusercontent.com/115237/228016600-db2e6002-4e2c-4d18-8393-9d7e1f525acb.png">

Fixes: https://github.com/go-gitea/gitea/issues/20625
Fixes: https://github.com/go-gitea/gitea/issues/23718
18 months agoSet `ref` to fully-formed of the tag when trigger event is `release` (#23944)
sillyguodong [Fri, 7 Apr 2023 20:40:40 +0000 (04:40 +0800)]
Set `ref` to fully-formed of the tag when trigger event is `release` (#23944)

Fix #23943
When trigger event is `release`, ref should be like
`refs/tags/<tag_name>` instead of `CommitID`

18 months agoRemove docs from automatically building in Gitpod (#23978)
Yarden Shoham [Fri, 7 Apr 2023 19:55:25 +0000 (22:55 +0300)]
Remove docs from automatically building in Gitpod (#23978)

I couldn't find a way to build the docs without `trans-copy` and
spinning up a dev environment that generates files untracked by git on
startup is not a good development experience

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
18 months agoDiscolor pull request tab labels (#23950)
silverwind [Fri, 7 Apr 2023 19:12:45 +0000 (21:12 +0200)]
Discolor pull request tab labels (#23950)

https://github.com/go-gitea/gitea/pull/22687 has discolored the repo tab
labels. This does the same for PR tabs for consistency. Value `0` is
still rendered like before.

Before:
<img width="502" alt="Screenshot 2023-04-06 at 19 35 24"
src="https://user-images.githubusercontent.com/115237/230454329-db6244ff-7d7e-4a2f-9240-f618a1c57f8c.png">

After:
<img width="497" alt="Screenshot 2023-04-06 at 19 35 07"
src="https://user-images.githubusercontent.com/115237/230454321-a0be6551-8c31-45e4-a1fb-ffc0d85d87bf.png">
<img width="497" alt="Screenshot 2023-04-06 at 19 38 37"
src="https://user-images.githubusercontent.com/115237/230454570-2fe2aa67-dfa7-4b2e-8c04-8dd40e6e99fc.png">

18 months agoHighlight selected file in the PR file tree (#23947)
yusifeng [Fri, 7 Apr 2023 18:27:10 +0000 (02:27 +0800)]
Highlight selected file in the PR file tree (#23947)

before

![before](https://user-images.githubusercontent.com/36984894/230327904-6e712ca2-f777-4cad-99f3-53bc20008180.gif)

after

![after](https://user-images.githubusercontent.com/36984894/230327966-6e5dd971-f0df-427a-a80b-6a9b6db6065d.gif)

18 months agoImprove markdown editor: width, height, preferred (#23895)
wxiaoguang [Fri, 7 Apr 2023 17:03:29 +0000 (01:03 +0800)]
Improve markdown editor: width, height, preferred (#23895)

Follow #23876

1. Fine tune the heights of the editors (like before)
    * Auto expand the editor (increase/decrease the height) when editing
2. Remember user's last used editor (textarea/easymde) in LocalStorage,
then next time the editor will be switched automatically
* No need to introduce extra config option, it satisfies all users,
including who prefer EasyMDE
3. Also fix the width problem of Review Panel

Screenshot:

<details>

![image](https://user-images.githubusercontent.com/2114189/229518585-2e05827e-8355-48f3-a20c-2c8b9e60ce74.png)

![image](https://user-images.githubusercontent.com/2114189/229518173-4caa6da7-6ad9-40e9-bf1a-ceddfcd4b37f.png)

![image](https://user-images.githubusercontent.com/2114189/229507886-148e9b84-9b58-46d1-ba3f-727e1396f476.png)

![image](https://user-images.githubusercontent.com/2114189/229518258-9f522294-1e64-4b06-91ab-ab43b0353aaa.png)

![image](https://user-images.githubusercontent.com/2114189/229507752-6d540ac7-7748-4bb6-bc09-28acab32d31b.png)

![image](https://user-images.githubusercontent.com/2114189/229510899-de322af5-57e8-4dc5-9a61-771a3b1bee79.png)

</details>

---------

Co-authored-by: silverwind <me@silverwind.io>
18 months agoUse Get/Set instead of Rename when Regenerate session id (#23975)
wxiaoguang [Fri, 7 Apr 2023 16:11:24 +0000 (00:11 +0800)]
Use Get/Set instead of Rename when Regenerate session id (#23975)

Do not use Rename here, because the old sid and new sid may be in
different redis cluster slot.

Fix #23869

18 months agoAllow repo admins too to delete the repo (#23940)
yp05327 [Fri, 7 Apr 2023 15:21:02 +0000 (00:21 +0900)]
Allow repo admins too to delete the repo (#23940)

Fixes https://github.com/go-gitea/gitea/issues/23934

We need to check `AccessModeAdmin` in `CanUserDelete` instead of
`AccessModeOwner`

18 months agoMerge template functions "dict/Dict/mergeinto" (#23932)
wxiaoguang [Fri, 7 Apr 2023 14:39:08 +0000 (22:39 +0800)]
Merge template functions "dict/Dict/mergeinto" (#23932)

One of the steps in #23328

Before there were 3 different but similar functions: dict/Dict/mergeinto

The code was just copied & pasted, no test.

This PR defines a new stable `dict` function, it covers all the 3 old
functions behaviors, only +160 -171

Future developers do not need to think about or guess the different dict
functions, just use one: `dict`

Why use `dict` but not `Dict`? Because there are far more `dict` than
`Dict` in code already ......

18 months agoUse a general Eval function for expressions in templates. (#23927)
wxiaoguang [Fri, 7 Apr 2023 13:25:49 +0000 (21:25 +0800)]
Use a general Eval function for expressions in templates. (#23927)

One of the proposals in #23328

This PR introduces a simple expression calculator
(templates/eval/eval.go), it can do basic expression calculations.

Many untested template helper functions like `Mul` `Add` can be replaced
by this new approach.

Then these `Add` / `Mul` / `percentage` / `Subtract` / `DiffStatsWidth`
could all use this `Eval`.

And it provides enhancements for Golang templates, and improves
readability.

Some examples:

----

* Before: `{{Add (Mul $glyph.Row 12) 12}}`
* After: `{{Eval $glyph.Row "*" 12 "+" 12}}`

----

* Before: `{{if lt (Add $i 1) (len $.Topics)}}`
* After: `{{if Eval $i "+" 1 "<" (len $.Topics)}}`

## FAQ

### Why not use an existing expression package?

We need a highly customized expression engine:

* do the calculation on the fly, without pre-compiling
* deal with int/int64/float64 types, to make the result could be used in
Golang template.
* make the syntax could be used in the Golang template directly
* do not introduce too much complex or strange syntax, we just need a
simple calculator.
* it needs to strictly follow Golang template's behavior, for example,
Golang template treats all non-zero values as truth, but many 3rd
packages don't do so.

### What's the benefit?

* Developers don't need to add more `Add`/`Mul`/`Sub`-like functions,
they were getting more and more.
Now, only one `Eval` is enough for all cases.
* The new code reads better than old `{{Add (Mul $glyph.Row 12) 12}}`,
the old one isn't familiar to most procedural programming developers
(eg, the Golang expression syntax).
* The `Eval` is fully covered by tests, many old `Add`/`Mul`-like
functions were never tested.

### The performance?

It doesn't use `reflect`, it doesn't need to parse or compile when used
in Golang template, the performance is as fast as native Go template.

### Is it too complex? Could it be unstable?

The expression calculator program is a common homework for computer
science students, and it's widely used as a teaching and practicing
purpose for developers. The algorithm is pretty well-known.

The behavior can be clearly defined, it is stable.

18 months agoDo not crash when parsing an invalid workflow file (#23972)
Jason Song [Fri, 7 Apr 2023 12:12:10 +0000 (20:12 +0800)]
Do not crash when parsing an invalid workflow file  (#23972)

Fix #23658.

Related to https://gitea.com/gitea/act/pulls/39

18 months agoSupport "." char as user name for User/Orgs in RSS/ATOM/GPG/KEYS path ... (#23874)
6543 [Fri, 7 Apr 2023 10:08:36 +0000 (12:08 +0200)]
Support "." char as user name for User/Orgs in RSS/ATOM/GPG/KEYS path ... (#23874)

- close #22301

workaround for https://github.com/go-chi/chi/issues/781

18 months agoEnsure RSS icon is present on all repo tabs (#23904)
silverwind [Fri, 7 Apr 2023 08:48:23 +0000 (10:48 +0200)]
Ensure RSS icon is present on all repo tabs (#23904)

Previously, not all repo tabs had shown the RSS icon in the repo header
because the context data was not being set. Added this context data in a
new function.

Before:

<img width="806" alt="image"
src="https://user-images.githubusercontent.com/115237/229639615-9cc00e75-3a26-4ff4-a6f2-316c1fccc596.png">

After:

<img width="815" alt="Screenshot 2023-04-04 at 00 16 17"
src="https://user-images.githubusercontent.com/115237/229639201-2e1c015b-1f13-46d4-aa14-e7a82fab3982.png">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
18 months agoClean template/helper.go (#23922)
wxiaoguang [Fri, 7 Apr 2023 07:31:41 +0000 (15:31 +0800)]
Clean template/helper.go (#23922)

The first step of #23328

This PR cleans:

1. Dead function like `SubStr`
2. Unnecessary function like `UseHTTPS`, it should be provided by
`window.origin`
3. Duplicate function like `IsShowFullName`, there was already a
`DeafultShowFullName`

I have searched these removed functions globally, no use in code.

18 months agoRemove `Repository.getFilesChanged` to fix Actions `paths` and `paths-ignore` filter...
ChristopherHX [Fri, 7 Apr 2023 06:42:43 +0000 (08:42 +0200)]
Remove `Repository.getFilesChanged` to fix Actions `paths` and `paths-ignore` filter (#23920)

Remove the misbehaving function and call
Repository.GetFilesChangedBetween instead.

Fixes #23919

---

~~_TODO_ test this~~ `Repository.getFilesChanged` seems to be only used
by Gitea Actions, but a similar function already exists

**Update** I tested this change and the issue is gone.

18 months agoHardcode path to docker images (#23955)
techknowlogick [Fri, 7 Apr 2023 06:41:49 +0000 (02:41 -0400)]
Hardcode path to docker images (#23955)

Fix #23954

This allows for building on platforms that don't have docker hub as the
default container registry.

18 months agoTitle can be empty when creating tag only (#23917)
Zettat123 [Fri, 7 Apr 2023 01:44:52 +0000 (09:44 +0800)]
Title can be empty when creating tag only (#23917)

Fixes #23809

Make the title not required. If the title is empty when creating release
(not tag), an error message will be displayed.

![image](https://user-images.githubusercontent.com/15528715/229761056-c52e338b-5f25-4d7d-bb44-2cb0304abcee.png)

18 months agoActions: Use default branch as ref when a branch/tag delete occurs (#23910)
Brad Nabholz [Fri, 7 Apr 2023 00:37:08 +0000 (20:37 -0400)]
Actions: Use default branch as ref when a branch/tag delete occurs (#23910)

Currently using the tip of main
(2c585d62a4ebbb52175b8fd8697458ae1c3b2937) and when deleting a branch
(and presumably tag, but not tested), no workflows with `on: [delete]`
are being triggered. The runner isn't being notified about them. I see
this in the gitea log:

`2023/04/04 04:29:36 ...s/notifier_helper.go:102:Notify() [E] an error
occurred while executing the NotifyDeleteRef actions method:
gitRepo.GetCommit: object does not exist [id: test, rel_path: ]`

Understandably the ref has already been deleted and so `GetCommit`
fails. Currently at
https://github.com/go-gitea/gitea/blob/main/services/actions/notifier_helper.go#L130,
if the ref is an empty string it falls back to the default branch name.
This PR also checks if it is a `HookEventDelete` and does the same.
Currently `${{ github.ref }}` would be equivalent to the deleted branch
(if `notify()` succeded), but this PR allows `notify()` to proceed and
also aligns it with the GitHub Actions behavior at
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#delete:

`$GITHUB_REF` / `${{ github.ref }}` => Default branch (main/master)
`$GITHUB_SHA` / `${{ github.sha }}` => Last commit on default branch

If the user needs the name of the deleted branch (or tag), it is
available as `${{ github.event.ref }}`.

There appears to be no way for the user to get the tip commit SHA of the
deleted branch (GitHub does not do this either).

N.B. there may be other conditions other than `HookEventDelete` where
the default branch ref needs swapped in, but this was sufficient for my
use case.

18 months agoRefactor authors dropdown (send get request from frontend to avoid long wait time...
Hester Gong [Fri, 7 Apr 2023 00:11:02 +0000 (08:11 +0800)]
Refactor authors dropdown (send get request from frontend to avoid long wait time) (#23890)

Right now the authors search dropdown might take a long time to load if
amount of authors is huge.
Example: (In the video below, there are about 10000 authors, and it
takes about 10 seconds to open the author dropdown)

https://user-images.githubusercontent.com/17645053/229422229-98aa9656-3439-4f8c-9f4e-83bd8e2a2557.mov

Possible improvements can be made, which will take 2 steps (Thanks to
@wolfogre for advice):

Step 1:
Backend: Add a new api, which returns a limit of 30 posters with matched
prefix.
Frontend: Change the search behavior from frontend search(fomantic
search) to backend search(when input is changed, send a request to get
authors matching the current search prefix)

Step 2:
Backend: Optimize the api in step 1 using indexer to support fuzzy
search.

This PR is implements the first step. The main changes:
1. Added api: `GET /{type:issues|pulls}/posters` , which return a limit
of 30 users with matched prefix (prefix sent as query). If
`DEFAULT_SHOW_FULL_NAME` in `custom/conf/app.ini` is set to true, will
also include fullnames fuzzy search.
2. Added a tooltip saying "Shows a maximum of 30 users" to the author
search dropdown
3. Change the search behavior from frontend search to backend search

After:

https://user-images.githubusercontent.com/17645053/229430960-f88fafd8-fd5d-4f84-9df2-2677539d5d08.mov

Fixes: https://github.com/go-gitea/gitea/issues/22586
---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 7 Apr 2023 00:07:10 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoMerge `push to create`, `open PR from push`, and `push options` docs articles into...
Lunny Xiao [Thu, 6 Apr 2023 23:36:19 +0000 (07:36 +0800)]
Merge `push to create`, `open PR from push`, and `push options` docs articles into one (#23744)

Add documentation for this feature.

<img width="734" alt="gitea-push-hint"
src="https://user-images.githubusercontent.com/81045/227921177-af08ab76-7556-4a69-8da9-bb59cec1388b.png">

---------

Co-authored-by: delvh <dev.lh@web.de>
18 months agoDelete deleted release attachments immediately from storage (#23913)
Lunny Xiao [Thu, 6 Apr 2023 22:01:36 +0000 (06:01 +0800)]
Delete deleted release attachments immediately from storage (#23913)

Previously, deleted release attachments were kept forever on the
external storage.
Note: It may be very slow now if there are many attachments to be
deleted on this release.

Fix #23728

18 months agoMore specific and unique feed name for NuGet install command template. (#23889)
Bob Vandevliet [Thu, 6 Apr 2023 21:35:32 +0000 (23:35 +0200)]
More specific and unique feed name for NuGet install command template. (#23889)

The default command to setup a NuGet registry from the command line is:
```
dotnet nuget add source --name Gitea --username your_username --password your_token <gitea-origin-url/>
```
The feed name `Gitea` is hard-coded into the command template, so each
registry will by default have the same feed name. I know templates can
be overridden using the `custom` folder. But in my opinion, it's a good
practice to make a slight change in the default template to make the
feed name more context specific:
```
dotnet nuget add source --name {{.PackageDescriptor.Owner.Name}} --username your_username --password your_token <gitea-origin-url/>
```

18 months agoTreat PRs with agit flow as fork PRs when triggering actions. (#23884)
Jason Song [Thu, 6 Apr 2023 20:57:30 +0000 (04:57 +0800)]
Treat PRs with agit flow as fork PRs when triggering actions. (#23884)

There is no fork concept in agit flow, anyone with read permission can
push `refs/for/<target-branch>/<topic-branch>` to the repo. So we should
treat it as a fork pull request because it may be from an untrusted
user.

18 months agoUse graceful editorconfig loader to reduce errors when loading malformed editorconfig...
Yoan Blanc [Thu, 6 Apr 2023 20:01:20 +0000 (22:01 +0200)]
Use graceful editorconfig loader to reduce errors when loading malformed editorconfigs (#21257)

The _graceful_ should fail less when the `.editorconfig` file isn't
properly written, e.g. boolean values from YAML or unparseable numbers
(when a number is expected). As is... information is lost as the
_warning_ (a go-multierror.Error) is ignored. If anybody knows how to
send them to the UI as warning; any help is appreciated.

Closes #20694

Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
18 months agoRemove -v from vulncheck (#23953)
John Olheiser [Thu, 6 Apr 2023 18:58:05 +0000 (13:58 -0500)]
Remove -v from vulncheck (#23953)

We should think about locking this dep, but for now this should get
builds going again.

18 months agoImprove permission check of packages (#23879)
yp05327 [Thu, 6 Apr 2023 14:18:29 +0000 (23:18 +0900)]
Improve permission check of packages (#23879)

At first, we have one unified team unit permission which is called
`Team.Authorize` in DB.
But since https://github.com/go-gitea/gitea/pull/17811, we allowed
different units to have different permission.

The old code is only designed for the old version. So after #17811, if
org users have write permission of other units, but have no permission
of packages, they can also get write permission of packages.

Co-authored-by: delvh <dev.lh@web.de>
18 months agoAdjust some documentations titles (#23941)
Lunny Xiao [Thu, 6 Apr 2023 09:06:32 +0000 (17:06 +0800)]
Adjust some documentations titles (#23941)

As title.

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 6 Apr 2023 00:07:08 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoUpdate eslints for Vue 3 (#23935)
Jonathan Tran [Wed, 5 Apr 2023 20:59:40 +0000 (16:59 -0400)]
Update eslints for Vue 3 (#23935)

I found that some lint warnings in my editor are conflicting, and I
believe the root cause is using lints designed for Vue 2 instead of Vue
3. We moved to Vue 3 in #20044.

I verified that the explicitly disabled rules in the changed file are
still part of the `vue/vue3-recommended` set.

See [Available rules -
eslint-plugin-vue](https://eslint.vuejs.org/rules/) for a full list of
lints.

18 months agoFix image border-radius (#23886)
wxiaoguang [Wed, 5 Apr 2023 00:44:52 +0000 (08:44 +0800)]
Fix image border-radius (#23886)

1. Instead of polluting the `border-radius` style globally, each "img"
usage should declare their own styles.
2. There were some bugs in code, I believe the `.img` selector was done
by mistake.

After:

![image](https://user-images.githubusercontent.com/2114189/229415742-161b018f-14c3-471d-bcf7-34f83e5c2d89.png)

![image](https://user-images.githubusercontent.com/2114189/229415789-829d364a-76da-47a5-8c61-398cc990873c.png)

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 5 Apr 2023 00:07:08 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoScroll collapsed file into view (#23702)
Jimmy Praet [Tue, 4 Apr 2023 23:51:42 +0000 (01:51 +0200)]
Scroll collapsed file into view (#23702)

18 months agodocs: make the required backticks in email password more explicit (#23923)
alex [Tue, 4 Apr 2023 17:19:01 +0000 (12:19 -0500)]
docs: make the required backticks in email password more explicit (#23923)

updated the example config to make the needed backticks around the
password more obvious

18 months agodocs: fix typo (#23924)
alex [Tue, 4 Apr 2023 15:22:45 +0000 (10:22 -0500)]
docs: fix typo (#23924)

fixes a minor typo in the email templates page

18 months agoUpdate docs markdown file weight to make it clear (#23909)
Lunny Xiao [Tue, 4 Apr 2023 13:47:31 +0000 (21:47 +0800)]
Update docs markdown file weight to make it clear (#23909)

For Docusaurus, it needs a meta data named `sidebar_position`, so we
copy all `weight` under `menu/sidebar` as top meta key.

18 months agoAdd activity feeds API (#23494)
Zettat123 [Tue, 4 Apr 2023 13:35:31 +0000 (21:35 +0800)]
Add activity feeds API (#23494)

Close #5666

Add APIs for getting activity feeds.

18 months agoFix code view (diff) broken layout (#23096)
wxiaoguang [Tue, 4 Apr 2023 11:05:07 +0000 (19:05 +0800)]
Fix code view (diff) broken layout (#23096)

Close #22911

I think it's ready for review now, feel free to test it, welcome to help
to improve.

### Before

![image](https://user-images.githubusercontent.com/2114189/220958734-06871615-b498-4143-8449-3d443f08ffaa.png)

### After

![image](https://user-images.githubusercontent.com/2114189/220958621-0dce2728-57b8-4a1f-ac5d-48c7c2d42f5c.png)

18 months agoUse ghost user if package creator does not exist (#23822)
KN4CK3R [Tue, 4 Apr 2023 08:14:46 +0000 (10:14 +0200)]
Use ghost user if package creator does not exist (#23822)

Fixes #23818

18 months agoOrg pages style fixes (#23901)
silverwind [Tue, 4 Apr 2023 04:49:09 +0000 (06:49 +0200)]
Org pages style fixes (#23901)

Few fixes/enhancements around org pages:

Use flexbox for member and repo lists and tweak rendering of tabs and
list:

<img width="765" alt="Screenshot 2023-04-03 at 22 54 24"
src="https://user-images.githubusercontent.com/115237/229625716-92a834c3-9121-4729-8b9b-3a3973cf9a91.png">
<img width="771" alt="Screenshot 2023-04-03 at 22 55 15"
src="https://user-images.githubusercontent.com/115237/229625719-acc08ce8-4489-44a6-a9b9-e36755c55b1d.png">

Vertically center remove/leave buttons, add link to avatar:

<img width="1223" alt="Screenshot 2023-04-03 at 21 51 20"
src="https://user-images.githubusercontent.com/115237/229612616-b662b795-e754-41a1-a77a-381c267e6104.png">

18 months agoUser/Org Feed render description as per web (#23887)
6543 [Tue, 4 Apr 2023 03:39:47 +0000 (05:39 +0200)]
User/Org Feed render description as per web (#23887)

User descriptions should be rendered so that links and other markup
appear correct in RSS feeds.

18 months agoUse User.ID instead of User.Name in ActivityPub API for Person IRI (#23823)
wxiaoguang [Tue, 4 Apr 2023 02:08:23 +0000 (10:08 +0800)]
Use User.ID instead of User.Name in ActivityPub API for Person IRI (#23823)

Thanks to @trwnh

Close #23802

The ActivityPub id is an HTTPS URI that should remain constant, even if
the user changes their name.

18 months agoRemove fomantic ".link" selector and styles (#23888)
wxiaoguang [Tue, 4 Apr 2023 00:47:23 +0000 (08:47 +0800)]
Remove fomantic ".link" selector and styles (#23888)

It's difficult to play with Fomantic's ".link" selector&styles, and it
doesn't bring any real benefit.

Instead, it sometimes introduces regressions (because of the `:not`
selector, really difficult to fine-tune).

Regression:

<details>

![image](https://user-images.githubusercontent.com/2114189/229421849-b48fbcf6-2ae2-4264-b06b-2a06c12e1a4b.png)

</details>

After this PR, there is no ".link" in code anymore. We do not need to
play the overwriting and `:not()` game anymore.

![image](https://user-images.githubusercontent.com/2114189/229422058-476aa5e2-53db-402d-b507-a6063824f835.png)

![image](https://user-images.githubusercontent.com/2114189/229422435-34fde1bc-b2ec-48ec-8c4a-6d8c2610b249.png)

![image](https://user-images.githubusercontent.com/2114189/229422014-cb38c8c7-828f-4a49-a761-95ea824d46a7.png)

![image](https://user-images.githubusercontent.com/2114189/229422031-10f6b4a5-af76-40ee-8fa1-692112a9274f.png)

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 4 Apr 2023 00:07:23 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoFix `cases.Title` crash for concurrency (#23885)
wxiaoguang [Mon, 3 Apr 2023 22:03:45 +0000 (06:03 +0800)]
Fix `cases.Title` crash for concurrency (#23885)

Regression of #19676 and #21814

Fix #23872

`cases.Title` is not thread-safe, it has internal state, so it can't be
used as a global shared variable.

18 months agoDisable editing tags (#23883)
Zettat123 [Mon, 3 Apr 2023 21:08:29 +0000 (05:08 +0800)]
Disable editing tags (#23883)

Fixes #23865

In GitHub, users cannot edit a tag.

<img
src="https://user-images.githubusercontent.com/15528715/229409445-4233941b-3a37-4846-bc0c-efa94b90d9e0.png"
width="600px" />

So in this PR the edit button will not be shown if the release's `IsTag`
is `true`

18 months agoFix user profile description rendering (#23882)
wxiaoguang [Mon, 3 Apr 2023 20:11:16 +0000 (04:11 +0800)]
Fix user profile description rendering (#23882)

The `ul li` styles were polluted.

Before:

![image](https://user-images.githubusercontent.com/2114189/229409756-22438268-ee36-4e4a-a20b-04ee8ee4a79d.png)

After:

![image](https://user-images.githubusercontent.com/2114189/229409809-25cea715-b6f1-4346-9bb4-3fbb58fcca65.png)

18 months agoIntroduce GiteaLocaleNumber custom element to handle number localization on pages...
wxiaoguang [Mon, 3 Apr 2023 16:58:09 +0000 (00:58 +0800)]
Introduce GiteaLocaleNumber custom element to handle number localization on pages. (#23861)

Follow #21429 & #22861

Use `<gitea-locale-number>` instead of backend `PrettyNumber`. All old
`PrettyNumber` related functions are removed. A lot of code could be
simplified.

And some functions haven't been used for long time (dead code), so they
are also removed by the way (eg: `SplitStringAtRuneN`, `Dedent`)

This PR only tries to improve the `PrettyNumber` rendering problem, it
doesn't touch the "plural" problem.

Screenshot:

![image](https://user-images.githubusercontent.com/2114189/229290804-1f63db65-1e34-4a54-84ba-e00b44331b17.png)

![image](https://user-images.githubusercontent.com/2114189/229290911-c88dea00-b11d-48dd-accb-9f52edd73ce4.png)

18 months agoConvert .Source.SkipVerify to $cfg.SkipVerify (#23839)
yp05327 [Mon, 3 Apr 2023 16:06:16 +0000 (01:06 +0900)]
Convert .Source.SkipVerify to $cfg.SkipVerify (#23839)

`Source` doesn't have `SkipVerify`, it is defined in `cfg`

18 months agoFix review box viewport overflow issue (#23800)
silverwind [Mon, 3 Apr 2023 15:11:34 +0000 (17:11 +0200)]
Fix review box viewport overflow issue (#23800)

Fix regression that came likely from
https://github.com/go-gitea/gitea/pull/23271:

Long lines of text currently cause the review box's CodeMirror element
to resize which apparently is not recognized by [popper's resize
detection](https://popper.js.org/docs/v2/modifiers/event-listeners/) and
which causes the element to go partially out of viewport until a reflow
happens:

![wrap](https://user-images.githubusercontent.com/115237/228673260-f8ffe89e-5724-4fb9-b93f-30b146c4c436.gif)

Fix this by setting the element to a static width derived from viewport
width and remove the previously clumsy media queries.

18 months agoFix owner team access mode value in team_unit table (#23675)
yp05327 [Mon, 3 Apr 2023 14:36:35 +0000 (23:36 +0900)]
Fix owner team access mode value in team_unit table (#23675)

All `access_mode` value of Owner Teams are 0(AccessModeNone) in
`team_unit` table, which should be 4(AccessModeOwner)
In `team` table:

![image](https://user-images.githubusercontent.com/18380374/227409457-1b9660ae-8cf7-49c8-a013-1850b46baebc.png)
In `team_unit` table:

![image](https://user-images.githubusercontent.com/18380374/227409429-a793dd90-4ae1-4191-b95b-e288c591f9fd.png)

ps: In https://github.com/go-gitea/gitea/pull/23630, `access_mode` in
`team_unit` is used to check the team unit permission, but I found that
user can not see issues in owned org repos.

18 months agoFix submit button won't refresh in New Repository Fork page (#22994)
yp05327 [Mon, 3 Apr 2023 14:11:05 +0000 (23:11 +0900)]
Fix submit button won't refresh in New Repository Fork page (#22994)

Fork a repo, and input an invalid repo name, you will get an error.
Then rename the repo name to a valid one, the submit button is still
disabled.

In other pages, for example, in create repo page, the submit button will
not be disabled.
So I removed the codes to disable the submit button.

18 months agoIntroduce GitHub markdown editor, keep EasyMDE as fallback (#23876)
wxiaoguang [Mon, 3 Apr 2023 10:06:57 +0000 (18:06 +0800)]
Introduce GitHub markdown editor, keep EasyMDE as fallback (#23876)

The first step of the plan

* #23290

Thanks to @silverwind for the first try in #15394 . Close #10729 and a
lot of related issues.

The EasyMDE is not removed, now it works as a fallback, users can switch
between these two editors.

Editor list:

* Issue / PR comment
* Issue / PR comment edit
* Issue / PR comment quote reply
* PR diff view, inline comment
* PR diff view, inline comment edit
* PR diff view, inline comment quote reply
* Release editor
* Wiki editor

Some editors have attached dropzone

Screenshots:

<details>

![image](https://user-images.githubusercontent.com/2114189/229363558-7e44dcd4-fb6d-48a0-92f8-bd12f57bb0a0.png)

![image](https://user-images.githubusercontent.com/2114189/229363566-781489c8-5306-4347-9714-d71af5d5b0b1.png)

![image](https://user-images.githubusercontent.com/2114189/229363771-1717bf5c-0f2a-4fc2-ba84-4f5b2a343a11.png)

![image](https://user-images.githubusercontent.com/2114189/229363793-ad362d0f-a045-47bd-8f9d-05a9a842bb39.png)

</details>

---------

Co-authored-by: silverwind <me@silverwind.io>
18 months agoImprove LoadUnitConfig to handle invalid or duplicate units (#23736)
Jason Song [Mon, 3 Apr 2023 08:42:38 +0000 (16:42 +0800)]
Improve LoadUnitConfig to handle invalid or duplicate units (#23736)

The old code just parses an invalid key to `TypeInvalid` and uses it as
normal, and duplicate keys will be kept.

So this PR will ignore invalid key and log warning and also deduplicate
valid units.

18 months agoAppend `(comment)` when a link points at a comment rather than the whole issue (...
Hester Gong [Mon, 3 Apr 2023 08:02:57 +0000 (16:02 +0800)]
Append `(comment)` when a link points at a comment rather than the whole issue (#23734)

Close #23671

For the feature mentioned above, this PR append ' (comment)' to the
rendered html if it is a hashcomment.
After the PR, type in the following

```
pull request from other repo:
http://localhost:3000/testOrg/testOrgRepo/pulls/2

pull request from this repo:
http://localhost:3000/aaa/testA/pulls/2

issue comment from this repo:
http://localhost:3000/aaa/testA/issues/1#issuecomment-18

http://localhost:3000/aaa/testA/pulls/2#issue-9

issue comment from other repo:
http://localhost:3000/testOrg/testOrgRepo/pulls/2#issuecomment-24

http://localhost:3000/testOrg/testOrgRepo/pulls/2#issue
```
Gives:
<img width="687" alt="截屏2023-03-27 13 53 06"
src="https://user-images.githubusercontent.com/17645053/227852387-2b218e0d-3468-4d90-ad81-d702ddd17fd2.png">

Other than the above feature, this PR also includes two other changes:

1 Right now, the render of links from file changed tab in pull request
might not be very proper, for example, if type in the following. (not
sure if this is an issue or design, if not an issue, I will revert the
changes). example on
[try.gitea.io](https://try.gitea.io/HesterG/testrepo/pulls/1)
```
https://try.gitea.io/HesterG/testrepo/pulls/1/files#issuecomment-162725
https://try.gitea.io/HesterG/testrepo/pulls/1/files
```
it will render the following
<img width="899" alt="截屏2023-03-24 15 41 37"
src="https://user-images.githubusercontent.com/17645053/227456117-5eccedb7-9118-4540-929d-aee9a76de852.png">

In this PR, skip processing the link into a ref issue if it is a link
from files changed tab in pull request

After:
type in following
```
hash comment on files changed tab:
http://localhost:3000/testOrg/testOrgRepo/pulls/2/files#issuecomment-24

files changed link:
http://localhost:3000/testOrg/testOrgRepo/pulls/2/files
```
Gives

<img width="708" alt="截屏2023-03-27 22 09 02"
src="https://user-images.githubusercontent.com/17645053/227964273-5dc06c50-3713-489c-b05d-d95367d0ab0f.png">

2 Right now, after editing the comment area, there will not be tippys
attached to `ref-issue`; and no tippy attached on preview as well.
example:

https://user-images.githubusercontent.com/17645053/227850540-5ae34e2d-b1d7-4d0d-9726-7701bf825d1f.mov

In this PR, in frontend, make sure tippy is added after editing the
comment, and to the comment on preview tab
After:

https://user-images.githubusercontent.com/17645053/227853777-06f56b4c-1148-467c-b6f7-f79418e67504.mov

18 months agoRename actions unit to `repo.actions` and add docs for it (#23733)
Jason Song [Mon, 3 Apr 2023 04:05:37 +0000 (12:05 +0800)]
Rename actions unit to `repo.actions` and add docs for it (#23733)

I neglected that the `NameKey` of `Unit` is not only for translation,
but also configuration. So it should be `repo.actions` to maintain
consistency.

## :warning: BREAKING :warning:

If users already use `actions.actions` in `DISABLED_REPO_UNITS` or
`DEFAULT_REPO_UNITS`, it will be treated as an invalid unit key.

18 months agoTry to catch more broken translations (#23867)
wxiaoguang [Mon, 3 Apr 2023 03:12:47 +0000 (11:12 +0800)]
Try to catch more broken translations (#23867)

Result: #23866

Gitea should drop the ``` ` ``` as string quoter, it is not recognized
by Crowdin and it causes problem for translators.

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 3 Apr 2023 00:06:56 +0000 (00:06 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoUpdate JS deps (#23853)
silverwind [Sun, 2 Apr 2023 23:47:14 +0000 (01:47 +0200)]
Update JS deps (#23853)

- Update all JS dependencies
- Regenerate svgs
- Tested heatmap, swagger, citation

18 months agoAdded close/open button to details page of milestone (#23877)
Bartlomiej Komendarczuk [Sun, 2 Apr 2023 22:40:43 +0000 (00:40 +0200)]
Added close/open button to details page of milestone (#23877)

Depending on the current state, a close or open button appears.

Close https://github.com/go-gitea/gitea/issues/19083

---
![image](https://user-images.githubusercontent.com/11333925/229367898-844ff790-c725-440a-9cf7-242c7745d643.png)
![image](https://user-images.githubusercontent.com/11333925/229367873-6a77fceb-1627-41d4-9d76-1f10ba2b278b.png)

18 months agoCheck `IsActionsToken` for LFS authentication (#23841)
Zettat123 [Sun, 2 Apr 2023 14:43:11 +0000 (22:43 +0800)]
Check `IsActionsToken` for LFS authentication (#23841)

Close #23824

Actions cannot fetch LFS objects from private repos because we don't
check if the user is the `ActionUser`.