]> source.dussan.org Git - gitea.git/log
gitea.git
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`.

18 months agoPrefill input values in oauth settings as intended (#23829)
yp05327 [Sun, 2 Apr 2023 13:08:34 +0000 (22:08 +0900)]
Prefill input values in oauth settings as intended (#23829)

18 months agoDisplay image size for multiarch container images (#23821)
KN4CK3R [Sun, 2 Apr 2023 09:53:37 +0000 (11:53 +0200)]
Display image size for multiarch container images (#23821)

Fixes #23771

Changes the display of different architectures for multiarch images to
show the image size:

![grafik](https://user-images.githubusercontent.com/1666336/228781477-cc76c4d1-4728-434f-8a27-fc008790d924.png)

18 months agoUse clippie module to copy to clipboard (#23801)
silverwind [Sun, 2 Apr 2023 09:25:36 +0000 (11:25 +0200)]
Use clippie module to copy to clipboard (#23801)

Externalize clipboard copying to the
[clippie](https://github.com/silverwind/clippie) module which I feel I
can maintain outside this repo for shared benefit with my other
projects.

The module is feature-equivalent to the previous code and has one
improvement where it sets `aria-hidden` on the fallback textarea,
preventing screen readers from picking it up. Also it support `Array` of
`content` as well to copy multiple items at once, in case it's ever
needed.

18 months agoRemove assertion debug code for show/hide refactoring (#23576)
wxiaoguang [Sun, 2 Apr 2023 04:03:00 +0000 (12:03 +0800)]
Remove assertion debug code for show/hide refactoring (#23576)

When doing the refactoring:

* #22950

I added some debug mode code (assertShown) to help to catch bugs, it did
catch some bugs like:

* #23074

If it has been proved that there is no more bugs, this assertion could
be removed easily and clearly.

Feel free to decide when to remove it (feel free to convert it from
Draft to Ready for Review).

cc: @silverwind

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 2 Apr 2023 00:06:59 +0000 (00:06 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoRemove jQuery ready usage (#23858)
silverwind [Sat, 1 Apr 2023 22:40:22 +0000 (00:40 +0200)]
Remove jQuery ready usage (#23858)

Replace it with equal function of our own and enable the eslint rule to
forbid future usage.

18 months agoFix JS error when changing PR's target branch (#23862)
wxiaoguang [Sat, 1 Apr 2023 14:14:38 +0000 (22:14 +0800)]
Fix JS error when changing PR's target branch (#23862)

Caught by @justusbunsi

An old bug from #6488

In `pullrequest_targetbranch_change`, the `data` might be empty, because
`UpdatePullRequestTarget` may respond `http.StatusNoContent`.

And the old code's `$branchTarget.text(data.base_branch);` doesn't make
sense, because in the end, the page will be always reloaded.

So, just remove the `$branchTarget.text(data.base_branch);`, everything
should be fine.

18 months agoImprove action log display with control chars (#23820)
wxiaoguang [Sat, 1 Apr 2023 12:57:05 +0000 (20:57 +0800)]
Improve action log display with control chars (#23820)

Close #23680

Some CLI programs use "\r" and control chars to print new content in
current line.

So, the strings in one line are actually from
`\rReading...1%\rReading...5%\rReading...100%`

This PR tries to make the output better.

18 months agoFix review conversation reply (#23846)
wxiaoguang [Sat, 1 Apr 2023 05:50:40 +0000 (13:50 +0800)]
Fix review conversation reply (#23846)

Regression of #23245

Close #23843

18 months agoImprove home page template, fix Sort dropdown menu flash (#23856)
wxiaoguang [Sat, 1 Apr 2023 05:47:54 +0000 (13:47 +0800)]
Improve home page template, fix Sort dropdown menu flash (#23856)

Follow #23854

Major changes:

1. The old `<div class="ui"><div class="six wide column ...">
</div></div>` doesn't have affect any more
    * So clean them, and remove other unnecessary elements/styles.
2. Add padding for narrow view.

Before

![image](https://user-images.githubusercontent.com/2114189/229262177-e8cf6c9b-b17b-482c-83fe-a84579e01e8e.png)

After:

![image](https://user-images.githubusercontent.com/2114189/229262166-d46134b0-2117-4d5c-a469-a2115cbd4b6c.png)

18 months agoMake first section on home page full width (#23854)
silverwind [Sat, 1 Apr 2023 00:58:36 +0000 (02:58 +0200)]
Make first section on home page full width (#23854)

Before:
<img width="1272" alt="Screenshot 2023-03-31 at 19 56 16"
src="https://user-images.githubusercontent.com/115237/229195611-4570453c-26bf-4663-865b-7e7eb9115060.png">

After:
<img width="1270" alt="Screenshot 2023-03-31 at 20 00 14"
src="https://user-images.githubusercontent.com/115237/229195639-23841b62-38d8-4e43-8ee5-3f70cba5de6e.png">

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 1 Apr 2023 00:06:55 +0000 (00:06 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoFix incorrect CORS failure detection logic (#23844)
wxiaoguang [Fri, 31 Mar 2023 15:35:48 +0000 (23:35 +0800)]
Fix incorrect CORS failure detection logic (#23844)

Regression of #23495

Fixes #23838
Fixes #23850

18 months agoFix 500 error if there is a name conflict when edit authentication source (#23832)
yp05327 [Fri, 31 Mar 2023 14:32:18 +0000 (23:32 +0900)]
Fix 500 error if there is a name conflict when edit authentication source (#23832)

18 months agoUse different SVG for pending and running actions (#23836)
Hester Gong [Fri, 31 Mar 2023 09:24:39 +0000 (17:24 +0800)]
Use different SVG for pending and running actions (#23836)

Before:
<img width="641" alt="截屏2023-03-31 11 12 17"
src="https://user-images.githubusercontent.com/17645053/229013472-237701db-2c30-4477-a7b5-d40640361b14.png">
<img width="576" alt="截屏2023-03-31 11 10 48"
src="https://user-images.githubusercontent.com/17645053/229013535-571aa8be-8e58-4d93-8641-9b8b5fd90108.png">

After:
<img width="709" alt="截屏2023-03-31 11 05 44"
src="https://user-images.githubusercontent.com/17645053/229012963-ccd1e9a7-8bea-4197-aa36-865eafbf8858.png">
<img width="528" alt="截屏2023-03-31 11 06 56"
src="https://user-images.githubusercontent.com/17645053/229012971-a7313eb6-ecd2-4da3-89a7-c20be33f4611.png">

18 months agoCSS color tweaks (#23828)
silverwind [Fri, 31 Mar 2023 08:24:47 +0000 (10:24 +0200)]
CSS color tweaks (#23828)

Change grey shades in arc-green to match the theme more:

<img width="661" alt="Screenshot 2023-03-30 at 21 42 34"
src="https://user-images.githubusercontent.com/115237/228957952-8e099e56-6923-4aa6-8ce9-3c1cd898b73e.png">

Adjusted grey shade in light theme:

<img width="652" alt="image"
src="https://user-images.githubusercontent.com/115237/228963876-3bde6181-8397-4dc2-be72-33982e6c7acb.png">

Increase contrast in arc-green, change background to slightly darker
shade, change forgeground to slightly brighter colors:

<img width="283" alt="Screenshot 2023-03-30 at 22 33 20"
src="https://user-images.githubusercontent.com/115237/228957957-272c24a5-dd0b-427a-b6b7-e62836bdd73c.png">

Increase contrast of grey text in light theme as well by making them
darker:

<img width="273" alt="Screenshot 2023-03-30 at 22 33 35"
src="https://user-images.githubusercontent.com/115237/228957959-283139c7-6fa7-4b68-9fdd-16c668ad1301.png">

Add color rule for border multiple select items:

<img width="183" alt="Screenshot 2023-03-30 at 22 29 31"
src="https://user-images.githubusercontent.com/115237/228957954-6b5a752d-bbb0-4519-ab35-d02c0804d955.png">
<img width="181" alt="Screenshot 2023-03-30 at 22 29 46"
src="https://user-images.githubusercontent.com/115237/228957956-fca9790a-d6c9-4f31-8d1b-d183ab3ac669.png">

Added color rule for red `*` on required form fields:

<img width="97" alt="image"
src="https://user-images.githubusercontent.com/115237/228958760-517ad9ef-565d-4349-b734-9b559ab42429.png">

18 months agoClarify Gitea/Crowdin locale behaviors, add tests for LocaleStore, fix some strings...
wxiaoguang [Fri, 31 Mar 2023 04:16:41 +0000 (12:16 +0800)]
Clarify Gitea/Crowdin locale behaviors, add tests for LocaleStore, fix some strings with semicolons (#23819)

Follow #23633 and #23240

Close #23814

Now we almost have a complete test set for Gitea's LocalStore.

This PR is still a quick fix for the legacy locale system (see the
TODOs), to resolve the problems fundamentally, it needs more work in the
future.

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 31 Mar 2023 00:07:06 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoFix dropdown direction behavior (#23806)
wxiaoguang [Thu, 30 Mar 2023 17:53:51 +0000 (01:53 +0800)]
Fix dropdown direction behavior (#23806)

Close #23803

More details in the comment.

![image](https://user-images.githubusercontent.com/2114189/228728786-7ec942b0-1f21-432d-93eb-575c77508b14.png)

![image](https://user-images.githubusercontent.com/2114189/228728825-62afb85e-7bfb-4702-a8bc-6c2160429978.png)

18 months agoFix incorrect/Improve error handle in edit user page (#23805)
yp05327 [Thu, 30 Mar 2023 17:27:00 +0000 (02:27 +0900)]
Fix incorrect/Improve error handle in edit user page (#23805)

Changes:
- `RenderWithErr` should render `tplUserEdit` not `tplUserNew` in edit
page
- If error occurred in `HandleUsernameChange` redirect to original edit
page instead of user list page

18 months agoFix "Updating branch by merge" bug in "update_branch_by_merge.tmpl" (#23790)
wxiaoguang [Thu, 30 Mar 2023 17:00:49 +0000 (01:00 +0800)]
Fix "Updating branch by merge" bug in "update_branch_by_merge.tmpl" (#23790)

Fix regression of #22683 , it didn't pass all variables into
sub-template.

Close #23787

After the fix, all links and the form are correct.

![image](https://user-images.githubusercontent.com/2114189/228511037-580b5f5d-43e7-494f-9b66-89f9f908e208.png)

![image](https://user-images.githubusercontent.com/2114189/228510958-f960284a-101d-4b0e-b887-80033127898d.png)

18 months agoFix incorrect visibility dropdown list in add/edit user page (#23804)
yp05327 [Thu, 30 Mar 2023 16:29:57 +0000 (01:29 +0900)]
Fix incorrect visibility dropdown list in add/edit user page (#23804)

Visibility dropdown list will not work in add/edit user page when error
occurred

18 months agoConvert issue list checkboxes to native (#23596)
silverwind [Thu, 30 Mar 2023 15:02:47 +0000 (17:02 +0200)]
Convert issue list checkboxes to native (#23596)

Use native instead of fomantic checkboxes in issue list. Benefits
include no more JS pop-in on load and perfect a11y.

Before, with JS pop-in:

<img width="92" alt="Screenshot 2023-03-20 at 17 02 02"
src="https://user-images.githubusercontent.com/115237/226398955-99029a1c-1150-449c-821b-e4165e7446a8.png">

After, Firefox on macOS:

<img width="126" alt="Screenshot 2023-03-20 at 17 01 26"
src="https://user-images.githubusercontent.com/115237/226399018-58df2c32-c2b2-4c78-b7df-7b76523abe21.png">

After, Chrome on macOS:

<img width="79" alt="Screenshot 2023-03-20 at 17 01 42"
src="https://user-images.githubusercontent.com/115237/226399074-947e6279-8dc3-42c2-90b5-b106c471b23d.png">

I opted to not do styling yet but I see that the inconsistency between
browsers may already be reason enough on doing it. I think if we style
them, there should be one global style, including markdown ones which
currently have custom styling.

18 months agoFix checks for `needs` in Actions (#23789)
Jason Song [Thu, 30 Mar 2023 14:33:17 +0000 (22:33 +0800)]
Fix checks for `needs` in Actions (#23789)

Fix:
- https://gitea.com/gitea/act_runner/issues/77
- https://gitea.com/gitea/act_runner/issues/81

Before:
<img width="1489" alt="image"
src="https://user-images.githubusercontent.com/9418365/228501567-f752cf87-a7ed-42c6-8f3d-ba741795c1fe.png">

Highlights:
- Upgrade act to make things doable, related to
  - https://gitea.com/gitea/act/pulls/32
  - https://gitea.com/gitea/act/pulls/33
  - https://gitea.com/gitea/act/pulls/35
- Make `needs` works
- Sort jobs in the original order in the workflow files

18 months agoDiff improvements (#23553)
silverwind [Thu, 30 Mar 2023 12:06:10 +0000 (14:06 +0200)]
Diff improvements (#23553)

- Avoid flash of wrong tree toggle icon on page load by setting icon
based on sync state
- Avoid "pop-in" of tree on page load by leaving space based on sync
state
- Use the same border/box-shadow combo used on comment `:target` also
for file `:target`.
- Refactor `DiffFileTree.vue` to use `toggleElem` instead of hardcoded
class name.
- Left-align inline comment boxes and make them fit the same amount of
markup content on a line as GitHub.
- Fix height of `diff-file-list`

Fixes: https://github.com/go-gitea/gitea/issues/23593
<img width="1250" alt="Screenshot 2023-03-18 at 00 52 04"
src="https://user-images.githubusercontent.com/115237/226071392-6789a644-aead-4756-a77e-aba3642150a0.png">
<img width="1246" alt="Screenshot 2023-03-18 at 00 59 43"
src="https://user-images.githubusercontent.com/115237/226071443-8bcba924-458b-48bd-b2f0-0de59cb180ac.png">
<img width="1250" alt="Screenshot 2023-03-18 at 01 27 14"
src="https://user-images.githubusercontent.com/115237/226073121-ccb99f9a-d3ac-40b7-9589-43580c4a01c9.png">
<img width="1231" alt="Screenshot 2023-03-19 at 21 44 16"
src="https://user-images.githubusercontent.com/115237/226207951-81bcae1b-6b41-4e39-83a7-0f37951df6be.png">

(Yes I'm aware the border-radius in bottom corners is suboptimal, but
this would be notorously hard to fix without relying on `overflow:
hidden`).

18 months ago[Patch] Fix closed PR also triggers Webhooks and actions (#23782)
sillyguodong [Thu, 30 Mar 2023 08:26:02 +0000 (16:26 +0800)]
[Patch] Fix closed PR also triggers Webhooks and actions (#23782)

Fix #23707
Cause by #23189
This PR is a quick fix that, when pushing commits to closed PR, webhook
and actions also be triggered.

18 months agoImprove backport-locales.go (#23807)
wxiaoguang [Thu, 30 Mar 2023 06:58:33 +0000 (14:58 +0800)]
Improve backport-locales.go (#23807)

ps: there are more broken translation strings in 1.20 (main), most of
them are still caused by incorrect quoting/unquoting. For example,
translators might write text ``` `my text ```, such incorrect encoding
might break crowdin & Gitea's locale package.

In the future, a Go `update-locales.go` should replace the legacy
`update-locales.sh`.

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 30 Mar 2023 00:06:54 +0000 (00:06 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoRefactor commit status for Actions jobs (#23786)
Jason Song [Wed, 29 Mar 2023 15:27:37 +0000 (23:27 +0800)]
Refactor commit status for Actions jobs (#23786)

Before:
<img width="353" alt="xnip_230329_163852"
src="https://user-images.githubusercontent.com/9418365/228479807-424452df-10fa-45cf-ae4b-09939c0ed54c.png">
After:
<img width="508" alt="xnip_230329_163358"
src="https://user-images.githubusercontent.com/9418365/228479923-537b54fe-9564-4105-a068-bcc75fa2a7ea.png">

Highlights:
- Treat `StatusSkipped` as `CommitStatusSuccess` instead of
`CommitStatusFailure`, so it fixed #23599.
- Use the bot user `gitea-actions` instead of the trigger as the creator
of commit status.
- New format `<run_name> / <job_name> / (<event>)` for the context of
commit status to avoid conflicts.
- Add descriptions for commit status.
- Add the missing calls to `CreateCommitStatus`.
- Refactor `CreateCommitStatus` to make it easier to use.

18 months agoAdd ONLY_SHOW_RELEVANT_REPOS back, fix explore page bug, make code more strict (...
wxiaoguang [Wed, 29 Mar 2023 13:41:45 +0000 (21:41 +0800)]
Add ONLY_SHOW_RELEVANT_REPOS back, fix explore page bug, make code more strict (#23766)

Follow #21962

After I eat my own dogfood, I would say that
ONLY_SHOW_RELEVANT_REPOS=false is necessary for many private/enterprise
instances, because many private repositories do not have
"description/topic", users just want to search by their names.

This PR also adds `PageIsExploreRepositories` check, to make code more
strict, because the `search` template is shared for different purpose.

And during the test, I found a bug that the "Search" button didn't
respect the "relevant" parameter, so this PR fixes the bug by the way
together.

I think this PR needs to be backported.

18 months agoDon't apply the group filter when listing LDAP group membership if it is empty (...
zeripath [Wed, 29 Mar 2023 09:54:36 +0000 (10:54 +0100)]
Don't apply the group filter when listing LDAP group membership if it is empty (#23745)

When running listLdapGroupMemberships check if the groupFilter is empty
before using it to list memberships.

Fix #23615

Signed-off-by: Andrew Thornton <art27@cantab.net>
18 months agoRefactor internal API for git commands, use meaningful messages instead of "Internal...
wxiaoguang [Wed, 29 Mar 2023 06:32:26 +0000 (14:32 +0800)]
Refactor internal API for git commands, use meaningful messages instead of "Internal Server Error" (#23687)

# Why this PR comes

At first, I'd like to help users like #23636 (there are a lot)

The unclear "Internal Server Error" is quite anonying, scare users,
frustrate contributors, nobody knows what happens.

So, it's always good to provide meaningful messages to end users (of
course, do not leak sensitive information).

When I started working on the "response message to end users", I found
that the related code has a lot of technical debt. A lot of copy&paste
code, unclear fields and usages.

So I think it's good to make everything clear.

# Tech Backgrounds

Gitea has many sub-commands, some are used by admins, some are used by
SSH servers or Git Hooks. Many sub-commands use "internal API" to
communicate with Gitea web server.

Before, Gitea server always use `StatusCode + Json "err" field` to
return messages.

* The CLI sub-commands: they expect to show all error related messages
to site admin
* The Serv/Hook sub-commands (for git clients): they could only show
safe messages to end users, the error log could only be recorded by
"SSHLog" to Gitea web server.

In the old design, it assumes that:

* If the StatusCode is 500 (in some functions), then the "err" field is
error log, shouldn't be exposed to git client.
* If the StatusCode is 40x, then the "err" field could be exposed. And
some functions always read the "err" no matter what the StatusCode is.

The old code is not strict, and it's difficult to distinguish the
messages clearly and then output them correctly.

# This PR

To help to remove duplicate code and make everything clear, this PR
introduces `ResponseExtra` and `requestJSONResp`.

* `ResponseExtra` is a struct which contains "extra" information of a
internal API response, including StatusCode, UserMsg, Error
* `requestJSONResp` is a generic function which can be used for all
cases to help to simplify the calls.
* Remove all `map["err"]`, always use `private.Response{Err}` to
construct error messages.
* User messages and error messages are separated clearly, the `fail` and
`handleCliResponseExtra` will output correct messages.
* Replace all `Internal Server Error` messages with meaningful (still
safe) messages.

This PR saves more than 300 lines, while makes the git client messages
more clear.

Many gitea-serv/git-hook related essential functions are covered by
tests.

---------

Co-authored-by: delvh <dev.lh@web.de>
18 months agoAdd CSS rules for basic colored labels (#23774)
silverwind [Wed, 29 Mar 2023 02:58:31 +0000 (04:58 +0200)]
Add CSS rules for basic colored labels (#23774)

Before:

<img width="164" alt="Screenshot 2023-03-28 at 23 35 46"
src="https://user-images.githubusercontent.com/115237/228372437-663111b9-7285-4fa2-9125-fb5e1cad21d7.png">

After:
<img width="166" alt="Screenshot 2023-03-28 at 23 35 54"
src="https://user-images.githubusercontent.com/115237/228372441-49430517-6b2d-4389-b11c-c30a724f6de7.png">

Also I removed the `!important` on the primary label as it's very likely
unnecessary with the amount of specificity the selector already has.

18 months agoAdd meilisearch support (#23136)
techknowlogick [Wed, 29 Mar 2023 02:23:23 +0000 (22:23 -0400)]
Add meilisearch support (#23136)

Add meilisearch support

Fixes #20665

18 months agoAdd missing translation for `actions.runners.reset_registration_token_success` (...
Jason Song [Wed, 29 Mar 2023 01:20:48 +0000 (09:20 +0800)]
Add missing translation for `actions.runners.reset_registration_token_success` (#23732)

Used at

https://github.com/go-gitea/gitea/blob/4011821c946e8db032be86266dd9364ccb204118/routers/web/shared/actions/runners.go#L157

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 29 Mar 2023 00:40:29 +0000 (00:40 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoImplement Issue Config (#20956)
JakobDev [Tue, 28 Mar 2023 18:22:07 +0000 (20:22 +0200)]
Implement Issue Config (#20956)

Closes #20955

This PR adds the possibility to disable blank Issues, when the Repo has
templates. This can be done by creating the file
`.gitea/issue_config.yaml` with the content `blank_issues_enabled` in
the Repo.

18 months agoSet repository link based on the url in package.json for npm packages (#20379)
Mai-Lapyst [Tue, 28 Mar 2023 17:55:03 +0000 (19:55 +0200)]
Set repository link based on the url in package.json for npm packages (#20379)

automatically set repository link for package based on the repository
url present inside package.json

closes #20146

18 months agoAdd API to manage issue dependencies (#17935)
qwerty287 [Tue, 28 Mar 2023 17:23:25 +0000 (19:23 +0200)]
Add API to manage issue dependencies (#17935)

Adds API endpoints to manage issue/PR dependencies
* `GET /repos/{owner}/{repo}/issues/{index}/blocks` List issues that are
blocked by this issue
* `POST /repos/{owner}/{repo}/issues/{index}/blocks` Block the issue
given in the body by the issue in path
* `DELETE /repos/{owner}/{repo}/issues/{index}/blocks` Unblock the issue
given in the body by the issue in path
* `GET /repos/{owner}/{repo}/issues/{index}/dependencies` List an
issue's dependencies
* `POST /repos/{owner}/{repo}/issues/{index}/dependencies` Create a new
issue dependencies
* `DELETE /repos/{owner}/{repo}/issues/{index}/dependencies` Remove an
issue dependency

Closes https://github.com/go-gitea/gitea/issues/15393
Closes #22115

Co-authored-by: Andrew Thornton <art27@cantab.net>
18 months agoAdd creation time in tag list page (#23693)
Balki [Tue, 28 Mar 2023 16:51:13 +0000 (16:51 +0000)]
Add creation time in tag list page (#23693)

Fixes #21699

18 months agoMake minio package support legacy MD5 checksum (#23768)
wxiaoguang [Tue, 28 Mar 2023 15:10:24 +0000 (23:10 +0800)]
Make minio package support legacy MD5 checksum (#23768)

A feedback from discord:
https://discord.com/channels/322538954119184384/561007778139734027/1090185427115319386

Some storages like:

 * https://developers.cloudflare.com/r2/api/s3/api/
 * https://www.backblaze.com/b2/docs/s3_compatible_api.html

They do not support "x-amz-checksum-algorithm" header

But minio recently uses that header with CRC32C by default. So we have
to tell minio to use legacy MD5 checksum.

I guess this needs to be backported because IIRC we 1.19 and 1.20 are
using similar minio package.

The minio package code for SendContentMD5 looks like this:

<details>

<img width="755" alt="image"
src="https://user-images.githubusercontent.com/2114189/228186768-4f2f6f67-62b9-4aee-9251-5af714ad9674.png">

</details>

18 months agoYarden Shoham has a new email address (#23767)
Yarden Shoham [Tue, 28 Mar 2023 10:24:08 +0000 (13:24 +0300)]
Yarden Shoham has a new email address (#23767)

Got a domain

18 months agofix br display for packages curls (#23737)
Hester Gong [Tue, 28 Mar 2023 05:18:01 +0000 (13:18 +0800)]
fix br display for packages curls (#23737)

Before:
<img width="1403" alt="截屏2023-03-27 15 48 23"
src="https://user-images.githubusercontent.com/17645053/227875392-399debf7-db75-4d9a-9436-409f75447c65.png">
This happens because the `<br>` matches this
[rule](https://github.com/go-gitea/gitea/blob/e6e602fd8d35471f1e2f4a42669a1f17e76e0176/web_src/css/markup/content.css#L428),
which is not necessary here (This is introduced by #22861, did a quick
check, and this is the only place used `<br>` inside `<code>` from the
PR):
```css
.markup code br,
.markup tt br {
  display: none;
}
```

After:
<img width="1398" alt="截屏2023-03-27 15 46 50"
src="https://user-images.githubusercontent.com/17645053/227875244-b7fba432-b32c-42f7-9517-4e05bb2e64ea.png">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
18 months agoFix issue due date edit toggle bug (#23723)
wxiaoguang [Tue, 28 Mar 2023 01:07:21 +0000 (09:07 +0800)]
Fix issue due date edit toggle bug (#23723)

Use `toggleElem` instead of jQuery's `fadeToggle`, which can't be caught
by eslint jquery plugin.

Hopefully this could be the last bug for the jQuery show/hide
refactoring.

18 months agoFix profile page email display, respect settings (#23747)
wxiaoguang [Mon, 27 Mar 2023 21:27:32 +0000 (05:27 +0800)]
Fix profile page email display, respect settings (#23747)

Always respect the `setting.UI.ShowUserEmail` and `KeepEmailPrivate`
setting.

* It doesn't make sense to show user's own E-mail to themself.
* Always hide the E-mail if KeepEmailPrivate=true, then the user could
know how their profile page looks like for others.
* Revert the `setting.UI.ShowUserEmail` change from #4981 . This setting
is used to control the E-mail display, not only for the user list page.

ps: the incorrect `<div .../>` tag on the profile page has been fixed by
#23748 together, so this PR becomes simpler.

18 months agoUpdate Gitea version in docs (#23755)
John Olheiser [Mon, 27 Mar 2023 21:00:44 +0000 (16:00 -0500)]
Update Gitea version in docs (#23755)

Updates the version to `1.19.0`

18 months agoFix SVG close tag, improve commit graph page UI alignment (#23751)
wxiaoguang [Mon, 27 Mar 2023 19:32:11 +0000 (03:32 +0800)]
Fix SVG close tag, improve commit graph page UI alignment (#23751)

Follow #23748

Thanks to @delvh

----

And, fix the UI alignment by the way (adding some `gt-mr-xx`)

Before:

![image](https://user-images.githubusercontent.com/2114189/228034794-7a6ac8d6-01fa-4dd2-97d4-0df0368f8ee0.png)

After:

![image](https://user-images.githubusercontent.com/2114189/228034938-64edeadf-7c99-4e74-b658-0ca62b72d596.png)

18 months agoRemove incorrect HTML self close tag (#23748)
wxiaoguang [Mon, 27 Mar 2023 16:05:51 +0000 (00:05 +0800)]
Remove incorrect HTML self close tag (#23748)

HTML is not XML.

18 months agoRefactor repo commit list (#23690)
wxiaoguang [Mon, 27 Mar 2023 14:44:51 +0000 (22:44 +0800)]
Refactor repo commit list (#23690)

### Before

* The check of `if PullRequest.BaseRepo.Name` doesn't make sense,
because the `$commitLink` is always constructed below
* Many `if` blocks make the HTML tags (likely) not match in IDE.
Although the rendered result matches, it's very unfriendly to editors or
code analyzer, and it's difficult to read.

### After

Move the `$commitLink` assignment ahead.

Simplify the code, resolve the above problems.

18 months agoFix tags view (#23243)
Wiktor Kwapisiewicz [Mon, 27 Mar 2023 13:41:33 +0000 (15:41 +0200)]
Fix tags view (#23243)

This PR fixes several issues reported in
https://github.com/go-gitea/gitea/issues/23221.

It does three things:
1. Fixes the `DefaultBranch` variable that has not been set.
2. Sets `Title` and `Message` for newly created tags from the Tag
message. This makes it easier to create releases from tags that have
messages and for those that don't it doesn't have any effect.
3. Makes UI changes so that tags look more like proper releases.

Before:

![2023-03-02-12-31-19](https://user-images.githubusercontent.com/1718963/222416890-941a74d4-9cd0-4c45-a59e-199d2580cd8c.png)

After:

![2023-03-02-12-31-31](https://user-images.githubusercontent.com/1718963/222416919-abce2009-8955-4cd0-9bed-1374582e04f7.png)

I purposefully didn't reformat the template so that the diff is cleaner
but can do so if that's welcome.

Thanks for your time!

---------

Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
18 months agoAdd commit info in action page (#23210)
yp05327 [Mon, 27 Mar 2023 10:34:09 +0000 (19:34 +0900)]
Add commit info in action page (#23210)

Add more commit info in action detail page.

![image](https://user-images.githubusercontent.com/18380374/222069905-a5ab28b1-1cea-4eec-b3b9-f1c74145cb82.png)

18 months agoUse GitHub Actions compatible globbing for `branches`, `tag`, `path` filter (#22804)
ChristopherHX [Mon, 27 Mar 2023 08:27:40 +0000 (10:27 +0200)]
Use GitHub Actions compatible globbing for `branches`, `tag`, `path` filter (#22804)

Replaces the current globbing library with a
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
compatible one.

This adds support for
- `paths-ignore`, `tags-ignore` and `branches-ignore` filters.
- negative patterns in `paths`, `tags` and `branches` filters
- using both `tags` and `paths` filter on the push event

Original PR https://gitea.com/gitea/act/pulls/13.
nektos/act PR https://github.com/nektos/act/pull/1618 for the
workflowpattern package (It can take some months for it to appear in
https://gitea.com/gitea/act)

Related to https://github.com/go-gitea/gitea/issues/13539

18 months agoFix project card preview select and template select (#23684)
Zettat123 [Mon, 27 Mar 2023 05:15:41 +0000 (13:15 +0800)]
Fix project card preview select and template select (#23684)

Now user cannot set Card Previews when creating a new project.

Before:

https://user-images.githubusercontent.com/15528715/227488883-29bbd636-8b98-45b3-b2f8-de5206b045dc.mp4

After:

https://user-images.githubusercontent.com/15528715/227488976-3447f252-805a-4f18-ae0e-1cddd921dcc3.mp4

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 27 Mar 2023 00:16:37 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoAdd git dashes separator to some "log" and "diff" commands (#23606)
wxiaoguang [Sun, 26 Mar 2023 18:31:21 +0000 (02:31 +0800)]
Add git dashes separator to some "log" and "diff" commands (#23606)

Reference:
https://github.com/go-gitea/gitea/issues/22578#issuecomment-1444180053

Credits to @tdesveaux , thank you very much for catching the problem. If
you'd like to open a PR, feel free to replace this one.

Git reports fatal errors for ambiguous arguments:

```
fatal: ambiguous argument 'refs/a...refs/b': unknown revision or path not in the working tree.
        Use '--' to separate paths from revisions, like this:
        'git <command> [<revision>...] -- [<file>...]'
```

So the `--` separator is necessary in some cases.

18 months agoAdd Simplified Chinese translate for oauth2-provider (#23713)
Akkariin Meiko [Sun, 26 Mar 2023 15:55:11 +0000 (23:55 +0800)]
Add Simplified Chinese translate for oauth2-provider (#23713)

18 months agoFix incorrect `toggle` buttons (#23676)
wxiaoguang [Sun, 26 Mar 2023 12:06:11 +0000 (20:06 +0800)]
Fix incorrect `toggle` buttons (#23676)

Some of those are still Copy&Paste problems.

This PR:

* Only cleans the legacy incorrect code, doesn't change or improve the
"action" logic.
* Remove the redundant `$('.toggle.button').on('click')`, now
`$('.show-panel.button').on('click')` handles that kinds of buttons

Actually, there is only one correct "toggle button" in code, the one on
the webhook page.

No need to backport.

18 months agoFine tune more downdrop settings, use SVG for labels, improve Repo Topic Edit form...
wxiaoguang [Sun, 26 Mar 2023 11:31:26 +0000 (19:31 +0800)]
Fine tune more downdrop settings, use SVG for labels, improve Repo Topic Edit form (#23626)

Although it seems that some different purposes are mixed in this PR,
however, they are all related, and can be tested together, so I put them
together to save everyone's time.

Diff: `+79 −84`, everything becomes much better.

### Improve the dropdown settings.

Move all fomantic-init related code into our `fomantic.js`

Fine-tune some dropdown global settings, see the comments.

Also help to fix the first problem in #23625 , cc: @yp05327

The "language" menu has been simplified, and it works with small-height
window better.

### Use SVG instead of `<i class="delete icon">`

It's also done by `$.fn.dropdown.settings.templates.label` , cc:
@silverwind

### Remove incorrect `tabable` CSS class

It doesn't have CSS styles, and it was only in Vue. So it's totally
unnecessary, remove it by the way.

### Improve the Repo Topic Edit form

* Simplify the code
* Add a "Cancel" button
* Align elements

Before:

<details>

![image](https://user-images.githubusercontent.com/2114189/223325782-f09532de-0c38-4742-ba86-ed35cc9a858d.png)

</details>

After:

![image](https://user-images.githubusercontent.com/2114189/226796347-207feb0a-b3cd-4820-8a3e-01930bab1069.png)

18 months agoAllow new file and edit file preview if it has editable extension (#23624)
Hester Gong [Sun, 26 Mar 2023 05:25:41 +0000 (13:25 +0800)]
Allow new file and edit file preview if it has editable extension (#23624)

Close #23579
Inspired by
[idea](https://github.com/go-gitea/gitea/issues/23579#issuecomment-1475429247)
from @brechtvl
In this PR, the behavior is when extension switches from writatble to
not, preview will hide, and vice versa.

demo:

https://user-images.githubusercontent.com/17645053/226786119-d20063da-8763-41ce-9b00-ae34929120e1.mov

---------

Co-authored-by: silverwind <me@silverwind.io>
18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 26 Mar 2023 00:16:31 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoClean some legacy files and move some build files (#23699)
wxiaoguang [Sat, 25 Mar 2023 20:22:51 +0000 (04:22 +0800)]
Clean some legacy files and move some build files (#23699)

* Clean the "tools" directory. The "tools" directory contains only two
files, move them.
* The "external_renderer.go" works like "cat" command to echo Stdin to
Stdout , to help testing.
* The `// gobuild: external_renderer` is incorrect, there should be no
space: `//gobuild: external_renderer`
* The `fmt.Print(os.Args[1])` is not a well-defined behavior, and it's
never used.
* The "watch.sh" is for "make watch", it's somewhat related to "build"
* After this PR, there is no "tools" directory, the project root
directory looks slightly simpler than before.
* Remove the legacy "contrib/autoboot.sh", there is no
"gogs_supervisord.sh"
* Remove the legacy "contrib/mysql.sql", it's never mentioned anywhere.
* Remove the legacy "contrib/pr/checkout.go", it has been broken for
long time, and it introduces unnecessary dependencies of the main code
base.

18 months agoRemove row clicking from notification table (#22695)
John Olheiser [Sat, 25 Mar 2023 19:37:34 +0000 (14:37 -0500)]
Remove row clicking from notification table (#22695)

Resolves #22692

I don't think there's a need for this entire row to be clickable (and
even different links depending on which segment you click)
The links still point to the same spot, so no information is lost here.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
18 months agoDescribe Gitea's purpose more accurately (#23698)
Lunny Xiao [Sat, 25 Mar 2023 16:19:34 +0000 (00:19 +0800)]
Describe Gitea's purpose more accurately (#23698)

As title.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 25 Mar 2023 00:16:30 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoensure go/bin path exists when copying hugo bin into it (#23692)
techknowlogick [Fri, 24 Mar 2023 20:32:17 +0000 (16:32 -0400)]
ensure go/bin path exists when copying hugo bin into it (#23692)

follow up of https://github.com/go-gitea/gitea/pull/23686

path does not exist during static pipeline, and fails out (example:
https://drone.gitea.io/go-gitea/gitea/70587/1/5 )

18 months agoCreate commit status when event is `pull_request_sync` (#23683)
sillyguodong [Fri, 24 Mar 2023 20:05:48 +0000 (04:05 +0800)]
Create commit status when event is `pull_request_sync` (#23683)

Fix: #23674
If the type of `hook_event` is `pull_request_sync`, also need to insert
a record of `commit_status` into DB.
Because `pull_request` event and `pull_request_sync` event have the same
payload, so the code is reusable.

Screenshot:

![image](https://user-images.githubusercontent.com/33891828/227465436-1b436807-d0b2-4a2b-8890-09d96c7f666d.png)

18 months agoAdd `deps-docs` command to makefile (#23686)
Yarden Shoham [Fri, 24 Mar 2023 18:42:31 +0000 (21:42 +0300)]
Add `deps-docs` command to makefile (#23686)

Refactored `deps-docs` out of `docs` because #23629 broke Gitpod's docs
setup (which grepped to get the hugo install command).

Now `make deps` really installs everything to develop (includes `docs`).

18 months agoFix incorrect package doc link (#23679)
yp05327 [Fri, 24 Mar 2023 15:45:06 +0000 (00:45 +0900)]
Fix incorrect package doc link (#23679)

package doc link is changed in
https://github.com/go-gitea/gitea/pull/23629

18 months agoImprove indices for `action` table (#23532)
Zettat123 [Fri, 24 Mar 2023 15:44:33 +0000 (23:44 +0800)]
Improve indices for `action` table (#23532)

Close #21611

Add the index mentioned in
https://github.com/go-gitea/gitea/issues/21611#issuecomment-1451113252 .
Since we already have an index for `("created_unix", "user_id",
"is_deleted")` columns on PostgreSQL, I removed the database type check
to apply this index to all types of databases.

18 months agoClarify that Gitea requires JavaScript (#23677)
wxiaoguang [Fri, 24 Mar 2023 10:35:52 +0000 (18:35 +0800)]
Clarify that Gitea requires JavaScript (#23677)

Close #20553

There were already a lot of functions powered by JavaScript in Gitea.

Without JavaScript, the Gitea Web UI almost doesn't work (only some
static links work ....)

18 months agoUse data-tooltip-content for tippy tooltip (#23649)
wxiaoguang [Fri, 24 Mar 2023 10:35:38 +0000 (18:35 +0800)]
Use data-tooltip-content for tippy tooltip (#23649)

Follow:
* #23574
* Remove all ".tooltip[data-content=...]"

Major changes:

* Remove "tooltip" class, use "[data-tooltip-content=...]" instead of
".tooltip[data-content=...]"
* Remove legacy `data-position`, it's dead code since last Fomantic
Tooltip -> Tippy Tooltip refactoring
* Rename reaction attribute from `data-content` to
`data-reaction-content`
* Add comments for some `data-content`: `{{/* used by the form */}}`
* Remove empty "ui" class
* Use "text color" for SVG icons (a few)

18 months agoAdd aria attributes to interactive time tooltips. (#23661)
Felipe Leopoldo Sologuren Gutiérrez [Fri, 24 Mar 2023 09:43:52 +0000 (06:43 -0300)]
Add aria attributes to interactive time tooltips. (#23661)

Fixes #23645
* Added `describedby` attribute to the reference element.
* Eliminated `aria-expanded` attribute to the reference element in order
to conform strictly with WCAG 2.1 rules.

18 months agoFix cancel button in the page of project edit not work (#23655)
sillyguodong [Fri, 24 Mar 2023 08:37:56 +0000 (16:37 +0800)]
Fix cancel button in the page of project edit not work (#23655)

Before, in project edit page, the cancel button is not work.

https://user-images.githubusercontent.com/33891828/227182731-6478e29f-0e52-48c4-beb0-6a7d1dda6a1d.mov

1. The wrong classname `cancel` was added to the `<a>` tag. That
classname caused the default click event of `<a>` tag to be cancelled.
Because we have the following settings in the global. So I remove the
classname `cancel`.

https://github.com/go-gitea/gitea/blob/9be90a58754061171bbd5025d85d2b891364efd3/web_src/js/features/common-global.js#L325-L327

2. Another change is that page will redirect to the previous page.

https://user-images.githubusercontent.com/33891828/227187326-c653c6d6-9715-440f-a732-ba0a6f012c81.mov

18 months agoFix long project name display in issue list and in related dropdown (#23653)
Hester Gong [Fri, 24 Mar 2023 07:11:23 +0000 (15:11 +0800)]
Fix long project name display in issue list and in related dropdown  (#23653)

This PR is to fix the second problem mentioned in #23625, along with the
long texts problem in `issue-item-bottom-row` of `issuelist.tmpl`

Main changes are:
1. Add `max-width` to the search dropdowns in issue list and make the
possible long texts inside to show ellipsis if texts are long
2. Adjust the conditions in
[issuelist.tmpl](https://github.com/go-gitea/gitea/blob/1d35fa0e784dffcadacb2322a3d7ac3ec2ff89b2/templates/shared/issuelist.tmpl#L146-L167)
to fix the problem as mentioned by the
[comment](https://github.com/go-gitea/gitea/issues/23625#issuecomment-1479281060)
3. Use `word-break: break-word;` in `issue-item-bottom-row` to break the
possible long texts.

After the PR
issuelist in repo (similar for pr list):
<img width="366" alt="截屏2023-03-23 17 42 40"
src="https://user-images.githubusercontent.com/17645053/227163953-93e9adbd-5785-4c16-b538-9db901787775.png">

dropdowns with long name (Here take reference from github to deal with
the long names cases: show ellipsis with no title, because all these
options are clickable, and it might not be necessary to add titles to
them ):

<img width="370" alt="截屏2023-03-23 17 43 50"
src="https://user-images.githubusercontent.com/17645053/227164215-df6fcaaa-9fee-4256-a57c-053fbcffafbb.png">

<img width="365" alt="截屏2023-03-23 17 43 56"
src="https://user-images.githubusercontent.com/17645053/227164227-9c99abcd-f410-4e07-b5b8-cbce764eedcd.png">

issue page (similar for pr page):
<img width="374" alt="截屏2023-03-23 17 45 37"
src="https://user-images.githubusercontent.com/17645053/227164668-654a8188-dac8-4bbf-a6e3-f3768a644a1b.png">

on PC:
<img width="1412" alt="截屏2023-03-23 17 47 20"
src="https://user-images.githubusercontent.com/17645053/227166694-e7bcc6e5-9667-4cef-9fbf-db85640a2c6c.png">

<img width="1433" alt="截屏2023-03-23 17 46 40"
src="https://user-images.githubusercontent.com/17645053/227165182-4e2a5d19-74bc-4c66-b73c-23cbca176ffe.png">

18 months agoEditor preview support for external renderers (#23333)
Brecht Van Lommel [Fri, 24 Mar 2023 06:12:23 +0000 (07:12 +0100)]
Editor preview support for external renderers (#23333)

Remove `[repository.editor] PREVIEWABLE_FILE_MODES` setting that seemed
like it was intended to support this but did not work. Instead, whenever
viewing a file shows a preview, also have a Preview tab in the file
editor.

Add new `/markup` web and API endpoints with `comment`, `gfm`,
`markdown` and new `file` mode that uses a file path to determine the
renderer.

Remove `/markdown` web endpoint but keep the API for backwards and
GitHub compatibility.

## ⚠️ BREAKING ⚠️

The `[repository.editor] PREVIEWABLE_FILE_MODES` setting was removed.
This setting served no practical purpose and was not working correctly.
Instead a preview tab is always shown in the file editor when supported.

---------

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
18 months agoFix incorrect `HookEventType` of pull request review comments (#23650)
Zettat123 [Fri, 24 Mar 2023 05:13:04 +0000 (13:13 +0800)]
Fix incorrect `HookEventType` of pull request review comments (#23650)

`HookEventType` of pull request review comments should be
`HookEventPullRequestReviewComment` but some event types are
`HookEventPullRequestComment` now.

18 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 24 Mar 2023 00:16:34 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

18 months agoFix codeblocks in the cheat sheet (#23664)
Sandro [Thu, 23 Mar 2023 20:42:22 +0000 (21:42 +0100)]
Fix codeblocks in the cheat sheet (#23664)

18 months agoDrop migration for ForeignReference (#23605)
Jason Song [Thu, 23 Mar 2023 19:01:55 +0000 (03:01 +0800)]
Drop migration for ForeignReference (#23605)

Fix
https://github.com/go-gitea/gitea/issues/21086#issuecomment-1476560381

Related to #21721

18 months agoFix new issue/pull request btn margin when it is next to sort (#23647)
Hester Gong [Thu, 23 Mar 2023 18:07:04 +0000 (02:07 +0800)]
Fix new issue/pull request btn margin when it is next to sort (#23647)

Close #23627

Added margin left to the button when it is next to the svg, which has a
margin-right of `-0.5rem`

And here it might be better if `white-space: nowrap;` is added because
otherwise it might look like below on pull requests page on smaller
screen

<img width="945" alt="截屏2023-03-23 09 57 41"
src="https://user-images.githubusercontent.com/17645053/227079613-71c696ab-55ec-4641-acb9-622a8baebb31.png">

After:
<img width="936" alt="截屏2023-03-23 10 08 27"
src="https://user-images.githubusercontent.com/17645053/227080971-6bf2588e-40dd-4770-b0d1-45d7c63e0f48.png">

Pull Request on smaller screen
<img width="922" alt="截屏2023-03-23 10 25 16"
src="https://user-images.githubusercontent.com/17645053/227084144-0c2ed3e6-5c11-4252-bba2-b5f971b70f4a.png">

18 months agoA tool to help to backport locales, changes source strings to fix other broken transl...
wxiaoguang [Thu, 23 Mar 2023 17:27:03 +0000 (01:27 +0800)]
A tool to help to backport locales, changes source strings to fix other broken translations (#23633)

It use old en-US locales as reference, fill the old other locales with
new locales.

----

## More broken translations

Many translations are still broken. The reason is: at the last time
restoring the ini to crowdin, many semicolon are treated as comments.

Two kinds of broken strings:

### Some translations can be re-translated

<details>

```
skipping options/locale/locale_si-LK.ini org teams.add_nonexistent_repo
skipping options/locale/locale_tr-TR.ini repo commits.search.tooltip
skipping options/locale/locale_es-ES.ini repo settings.trust_model.committer.desc
skipping options/locale/locale_es-ES.ini admin dashboard.new_version_hint
skipping options/locale/locale_pt-PT.ini org teams.add_nonexistent_repo
skipping options/locale/locale_hu-HU.ini install require_sign_in_view_popup
skipping options/locale/locale_hu-HU.ini repo migrate.invalid_local_path
skipping options/locale/locale_id-ID.ini repo migrate.invalid_local_path
skipping options/locale/locale_id-ID.ini org teams.add_nonexistent_repo
skipping options/locale/locale_de-DE.ini repo settings.protect_protected_file_patterns_desc
```

</details>

So this PR also does some small changes on them, to trigger the
re-translation.

### The `locale_el-GR.ini` contains many broken tranlsations

I guess we should reset them from crowdin side, then translators can
re-translate them.

----

Update: in latest main, the strings have been fixed.

## TODO

Update: the el-GR translators have done great job and fixes these broken
translations.

<details>

Merge this PR ASAP and upload `locale_el-GR.ini` to crowdin to remove
broken strings.

Out-dated, fixed in main.

![image](https://user-images.githubusercontent.com/2114189/226954531-36e14527-278a-41a1-8ddb-2b2b27bfc746.png)

</details>

---------

Co-authored-by: delvh <dev.lh@web.de>
18 months agoFix incorrect `show-modal` and `show-panel` class (#23660)
wxiaoguang [Thu, 23 Mar 2023 16:52:20 +0000 (00:52 +0800)]
Fix incorrect `show-modal` and `show-panel` class (#23660)

That's incorrect code caused by Copy&Paste.

`show-modal` / `show-panel` are used by JS to show something, but these
links have `href`, they should navigate to new page.

Close #23657

18 months agoRestructure documentation. Now the documentation has installation, administration...
Lunny Xiao [Thu, 23 Mar 2023 15:18:24 +0000 (23:18 +0800)]
Restructure documentation. Now the documentation has installation, administration, usage, development, contributing the 5 main parts (#23629)

- **Installation**: includes how to install Gitea and related other
tools, also includes upgrade Gitea
- **Administration**: includes how to configure Gitea, customize Gitea
and manage Gitea instance out of Gitea admin UI
- **Usage**: includes how to use Gitea's functionalities. A sub
documentation is about packages, in future we could also include CI/CD
and others.
- **Development**: includes how to integrate with Gitea's API, how to
develop new features within Gitea
- **Contributing**: includes how to contribute code to Gitea
repositories.

After this is merged, I think we can have a sub-documentation of `Usage`
part named `Actions` to describe how to use Gitea actions

---------

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
18 months agoCheck LFS/Packages settings in dump and doctor command (#23631)
Zettat123 [Thu, 23 Mar 2023 12:30:28 +0000 (20:30 +0800)]
Check LFS/Packages settings in dump and doctor command (#23631)

Close #23622

As described in the issue, disabling the LFS/Package settings will cause
errors when running `gitea dump` or `gitea doctor`. We need to check the
settings and the related operations should be skipped if the settings
are disabled.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
18 months agoUse a general approach to show tooltip, fix temporary tooltip bug (#23574)
wxiaoguang [Thu, 23 Mar 2023 09:56:15 +0000 (17:56 +0800)]
Use a general approach to show tooltip, fix temporary tooltip bug (#23574)

## TLDR

* Improve performance: lazy creating the tippy instances.
* Transparently support all "tooltip" elements, no need to call
`initTooltip` again and again.
* Fix a temporary tooltip re-entrance bug, which causes showing temp
content forever.
* Upgrade vue3-calendar-heatmap to 2.0.2 with lazy tippy init
(initHeatmap time decreases from 100ms to 50ms)

## Details

### The performance

Creating a lot of tippy tooltip instances is expensive. This PR doesn't
create all tippy tooltip instances, instead, it only adds "mouseover"
event listener to necessary elements, and then switches to the tippy
tooltip

### The general approach for all tooltips

Before, dynamically generated tooltips need to be called with
`initTooltip`.

After, use MutationObserver to:

* Attach the event listeners to newly created tooltip elements, work for
Vue (easier than before)
* Catch changed attributes and update the tooltip content (better than
before)

It does help a lot, eg:

https://github.com/go-gitea/gitea/blob/1a4efa0ee9a49d48549be7479a46be133b9bc260/web_src/js/components/PullRequestMergeForm.vue#L33-L36

### Temporary tooltip re-entrance bug

To reproduce, on try.gitea.io, click the "copy clone url" quickly, then
the tooltip will be "Copied!" forever.

After this PR, with the help of `attachTippyTooltip`, the tooltip
content could be reset to the default correctly.

### Other changes

* `data-tooltip-content` is preferred from now on, the old
`data-content` may cause conflicts with other modules.
* `data-placement` was only used for tooltip, so it's renamed to
`data-tooltip-placement`, and removed from `createTippy`.

18 months agoImprove workflow event triggers (#23613)
Zettat123 [Thu, 23 Mar 2023 04:04:15 +0000 (12:04 +0800)]
Improve workflow event triggers (#23613)

Follow #23037
Fix [#22598
comment](https://github.com/go-gitea/gitea/issues/22958#issuecomment-1475763042)

Workflows with `pull_request` trigger event can't be triggered by
`pull_request_sync` event. This PR adds the `canGithubEventMatch`
function to check if a Github event can match any Gitea event. If the
Github event matches a Gitea event, the related workflows should be
triggered.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>