]> source.dussan.org Git - gitea.git/log
gitea.git
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>
18 months agoImprove `<SvgIcon>` to make it output `svg` node and optimize performance (#23570)
wxiaoguang [Thu, 23 Mar 2023 03:24:16 +0000 (11:24 +0800)]
Improve `<SvgIcon>` to make it output `svg` node and optimize performance (#23570)

Before, the Vue `<SvgIcon>` always outputs DOM nodes like:

```html
<span class="outer-class">
    <svg class="class-name-defined" ...></svg>
</span>
```

The `span` is redundant and I guess such layout and the inconsistent
`class/class-name` attributes would cause bugs sooner or later.

This PR makes the `<SvgIcon>` clear, and it's faster than before,
because it doesn't need to parse the whole SVG string.

Before:

<details>

![image](https://user-images.githubusercontent.com/2114189/226156474-ce2c57cd-b869-486a-b75b-1eebdac8cdf7.png)

</details>

After:

![image](https://user-images.githubusercontent.com/2114189/226155774-108f49ed-7512-40c3-94a2-a6e8da18063d.png)

---------

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

18 months agoAdd extra features to product comparison (#23638)
Tim [Wed, 22 Mar 2023 16:43:08 +0000 (16:43 +0000)]
Add extra features to product comparison (#23638)

Add some review features that are notably missing from Gitlab CE but not
Gitea.

Also add Merge Queues which is not supported by Gitea but is quite an
important feature.

18 months agoUse a general approch to improve a11y for all checkboxes and dropdowns. (#23542)
wxiaoguang [Wed, 22 Mar 2023 02:52:01 +0000 (10:52 +0800)]
Use a general approch to improve a11y for all checkboxes and dropdowns. (#23542)

This PR follows #22599 and #23450

The major improvements:

1. The `aria-*.js` are totally transparent now, no need to call
`attachDropdownAria` explicitly anymore.
* It hooks the `$.fn.checkbox` and `$.fn.dropdown`, then our patch
works.
* It makes all dynamically generated checkbox/dropdown work with a11y
without any change
* eg: the `conversation.find('.dropdown').dropdown();` in `repo-diff.js`
2. Since it's totally transparent now, it could be easier to modify or
remove in the future.
3. It handles all selection labels as well (by onLabelCreate), so it
supports "multiple selection dropdown" now.
* It partially completes one of my TODOs: `TODO: multiple selection is
not supported yet.`
4. The code structure is clearer, code blocks are splitted into
different functions.
* The old `attachOneDropdownAria` was splitted into separate functions.
* It makes it easier to add more fine tunes in the future, and co-work
with contributors.
6. The code logic is similar as before, only two new parts:
    1. the `ariaCheckboxFn` and `ariaDropdownFn` functions
    2. the `onLabelCreate` and `updateSelectionLabel` functions

In `aria-dropdown.js` I had to mix jQuery and Vanilla JS somewhat, I
think the code is still understandable, otherwise the code would be much
more complex to read.

Thanks to fsologureng for the idea about "improving the 'delete icon'
with aria attributes".

If there is anything unclear or incorrect, feel free to ask and discuss,
or propose new PRs for it.

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

18 months agoUpdate PR documentation (#23620)
John Olheiser [Tue, 21 Mar 2023 22:05:52 +0000 (17:05 -0500)]
Update PR documentation (#23620)

This updates the PR docs and explains how to work with PRs, for those
who may not know.

It was mentioned that this page could explain PRs a bit better, in case
some users are not familiar with GitHub or similar forges.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
18 months agoSet opaque background on markup and images (#23578)
silverwind [Tue, 21 Mar 2023 21:38:04 +0000 (22:38 +0100)]
Set opaque background on markup and images (#23578)

- Set opaque background on markup images so they can visually break
`<hr>`
- Change padding of comment box so `padding` is provided by the
`.markup` element instead of its parent, matching the file rendering
view which does the same.

Before:
<img width="243" alt="Screenshot 2023-03-19 at 19 22 03"
src="https://user-images.githubusercontent.com/115237/226198663-8ff4d940-6a15-452d-ac58-14485b37fbc7.png">

After:
<img width="261" alt="Screenshot 2023-03-19 at 19 23 26"
src="https://user-images.githubusercontent.com/115237/226198689-1bf56561-4726-46dc-b583-423d65e1e13a.png">
<img width="263" alt="image"
src="https://user-images.githubusercontent.com/115237/226199002-e93c817d-6d9c-4b98-bad8-0aa0bd45b62f.png">

Example documents:

https://try.gitea.io/silverwind/symlink-test/src/branch/master/test-page.md
https://github.com/silverwind/symlink-test/blob/master/test-page.md

18 months agoDecouple the issue-template code from comment_tab.tmpl (#23556)
wxiaoguang [Tue, 21 Mar 2023 21:04:17 +0000 (05:04 +0800)]
Decouple the issue-template code from comment_tab.tmpl  (#23556)

It would help  #23290

The issue-template code is only useful for "new issue" or "new PR", so
it could only be put in the `new_form.tmpl`

18 months agoRemove `id="comment-form"` dead code, fix tag (#23555)
wxiaoguang [Tue, 21 Mar 2023 20:35:02 +0000 (04:35 +0800)]
Remove `id="comment-form"` dead code, fix tag (#23555)

The code has been dead code since #5073 . `#5073` duplicated the code in
a new `if` block.

The dead code blocks
* #23290

18 months agoIntroduce path Clean/Join helper functions (#23495)
wxiaoguang [Tue, 21 Mar 2023 20:02:49 +0000 (04:02 +0800)]
Introduce path Clean/Join helper functions (#23495)

Since #23493 has conflicts with latest commits, this PR is my proposal
for fixing #23371

Details are in the comments

And refactor the `modules/options` module, to make it always use
"filepath" to access local files.

Benefits:

* No need to do `util.CleanPath(strings.ReplaceAll(p, "\\", "/"))),
"/")` any more (not only one before)
* The function behaviors are clearly defined

18 months agoRemove conflicting CSS rules on notifications, improve notifications table (#23565)
silverwind [Tue, 21 Mar 2023 19:11:25 +0000 (20:11 +0100)]
Remove conflicting CSS rules on notifications, improve notifications table (#23565)

Dropdowns on `/notifications/subscriptions` before and after:

<img width="157" alt="Screenshot 2023-03-18 at 20 37 12"
src="https://user-images.githubusercontent.com/115237/226133906-e4ad6a0a-de24-4324-8e1d-94081d23fe85.png">
<img width="152" alt="Screenshot 2023-03-18 at 20 41 29"
src="https://user-images.githubusercontent.com/115237/226134038-c3946c32-a424-4b92-ad15-890e1036cafe.png">

These selectors are meant to target the notification list which I
improved:

<img width="1145" alt="Screenshot 2023-03-19 at 01 52 11"
src="https://user-images.githubusercontent.com/115237/226147907-1c35736a-4bc9-4698-9813-21a20a1d2106.png">
<img width="1148" alt="Screenshot 2023-03-19 at 01 54 17"
src="https://user-images.githubusercontent.com/115237/226147920-626dbd84-11d3-48db-a177-6d808e3212c0.png">

18 months agoRemove @metalmatze as maintainer (#23612)
Matthias Loibl [Tue, 21 Mar 2023 10:17:58 +0000 (10:17 +0000)]
Remove @metalmatze as maintainer (#23612)

It's time. I haven't been active in years.

18 months agoKeep (add if not existing) xmlns attribute for generated SVG images (#23410)
wxiaoguang [Tue, 21 Mar 2023 05:39:27 +0000 (13:39 +0800)]
Keep (add if not existing) xmlns attribute for generated SVG images (#23410)

Fix #23409

Developers could browse & preview the local SVG images files directly.

It still has clear output.

![image](https://user-images.githubusercontent.com/2114189/224317107-f4b26c76-e36a-4e80-9eee-d8dc2e16421f.png)

![image](https://user-images.githubusercontent.com/2114189/224317527-2d4ca131-978c-4933-b071-4bae483f06e1.png)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <leon@kske.dev>
18 months agoReplace a few fontawesome icons with svg (#23602)
silverwind [Tue, 21 Mar 2023 01:42:02 +0000 (02:42 +0100)]
Replace a few fontawesome icons with svg (#23602)

Replaced a few icons with SVG. The only ones left are some in actions
(idk why new code introduces legacy icons) and a few dropdown icons.

18 months agoFix pagination on `/notifications/watching` (#23564)
silverwind [Tue, 21 Mar 2023 01:07:14 +0000 (02:07 +0100)]
Fix pagination on `/notifications/watching` (#23564)

The `q` parameter was not rendered in pagination links because
`context.Pagination:AddParam` checks for existance of the parameter in
`ctx.Data` where it was absent. Added the parameter there to fix it.

18 months agoFix `.locale.Tr` function not found in delete modal (#23468)
delvh [Tue, 21 Mar 2023 00:41:57 +0000 (01:41 +0100)]
Fix `.locale.Tr` function not found in delete modal (#23468)

Caught by @wxiaoguang in
https://github.com/go-gitea/gitea/pull/23337#issuecomment-1467317742.

Additionally, there were three instances that have the same content as `templates/base/deletion_modal_actions.tmpl` but that are not intended to delete something.
Instead of renaming the template above, these instances were simply re-hard-coded again.
Renaming/improving the template above is left for future PRs.

18 months agofix submodule is nil panic (#23588)
来自村里的小螃蟹 [Mon, 20 Mar 2023 22:26:01 +0000 (06:26 +0800)]
fix submodule is nil panic (#23588)

#23587
submodule path is nil
It is panic a nil error

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
18 months ago`Publish Review` buttons should indicate why they are disabled (#23598)
Punit Inani [Mon, 20 Mar 2023 21:54:23 +0000 (03:24 +0530)]
`Publish Review` buttons should indicate why they are disabled (#23598)

Adding tooltip on "Approve" and "Review Changes" buttons. is try to do
by them self on their PR.
Resolves https://github.com/go-gitea/gitea/issues/23547
`Approve` tootip text :- "Pull request authors can’t approve their own
pull request"
`Request Changes` tooltip text:- "Pull request authors can’t request
changes on their own pull request"

Before

https://user-images.githubusercontent.com/115237/225984020-306c048f-cb9b-4dee-8929-1c74c331518b.png

After
<img width="841" alt="image"
src="https://user-images.githubusercontent.com/80308335/226445845-b5f6f6c9-f0dc-4934-a282-3b8be06417a8.png">

18 months agoImprove template error reporting (#23396)
zeripath [Mon, 20 Mar 2023 20:56:48 +0000 (20:56 +0000)]
Improve template error reporting (#23396)

There are multiple duplicate reports of errors during template rendering
due to broken custom templates.

Unfortunately the error returned here is somewhat difficult for users to
understand and it doesn't return the context of the error.

This PR attempts to parse the error returned by the template renderer to
add in some further context including the filename of the template AND
the preceding lines within that template file.

Ref #23274

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
18 months agoPolyfill the window.customElements (#23592)
wxiaoguang [Mon, 20 Mar 2023 15:17:56 +0000 (23:17 +0800)]
Polyfill the window.customElements (#23592)

Related: #23590

Reference:
https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs

It seems that there are some users using old browsers, so the
`window.customElements` need polyfill.

The Custom Elements would help a lot for Gitea's UI problems, including:

* `<span class="js-pretty-number">`
* `<time data-format>`

So it's worth get polyfill.

---------

Co-authored-by: delvh <dev.lh@web.de>
18 months agoAdd CHANGELOG for 1.19.0 (#23583)
delvh [Mon, 20 Mar 2023 07:42:23 +0000 (08:42 +0100)]
Add CHANGELOG for 1.19.0 (#23583)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
18 months agoDisplay the version of runner in the runner list (#23490)
sillyguodong [Mon, 20 Mar 2023 02:19:40 +0000 (10:19 +0800)]
Display the version of runner in the runner list (#23490)

Close: #23489

### Change
1. Add version column to action_runner table.
2. Read the runner version from the request header, and update it in DB.
3. Display version in runner list

### Screenshot

![image](https://user-images.githubusercontent.com/33891828/225220990-98bc0158-4403-4e6c-9805-31bbbc65a802.png)

18 months agoAdd `.patch` to `attachment.ALLOWED_TYPES` (#23580)
silverwind [Sun, 19 Mar 2023 19:58:43 +0000 (20:58 +0100)]
Add `.patch` to `attachment.ALLOWED_TYPES` (#23580)

18 months agoSort Python package descriptors by version to mimic PyPI format (#23550)
Samuel FORESTIER [Sun, 19 Mar 2023 14:19:37 +0000 (14:19 +0000)]
Sort Python package descriptors by version to mimic PyPI format (#23550)

---

Hi, very naive and **untested** first time ever Go code, feel free to
reject/edit this as needed.
(PyPI actually performs "naive" string comparison too)

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
18 months agoUse `project.IconName` instead of repeated unreadable `if-else` chains (#23538)
yp05327 [Sun, 19 Mar 2023 12:44:48 +0000 (21:44 +0900)]
Use `project.IconName` instead of repeated unreadable `if-else` chains (#23538)

The project type will be changed in
https://github.com/go-gitea/gitea/pull/23353, so the old fix
https://github.com/go-gitea/gitea/pull/23325 will not work as well.

And I also found that there were some problems in the old fix....

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
18 months agoMatch api migration behavior to web behavior (#23552)
Andrew Tomaka [Sun, 19 Mar 2023 06:29:14 +0000 (02:29 -0400)]
Match api migration behavior to web behavior (#23552)

When attempting to migrate a repository via the API endpoint comments
are always included. This can create a problem if your source repository
has issues or pull requests but you do not want to import them into
Gitea that displays as something like:

> Error 500: We were unable to perform the request due to server-side
problems. 'comment references non existent IssueIndex 4

There are only two ways to resolve this:
1. Migrate using the web interface
2. Migrate using the API including at issues or pull requests.

This PR matches the behavior of the API migration router to the web
migration router.

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix dropdown icon misalignment when using fomantic icon (#23558)
wxiaoguang [Sun, 19 Mar 2023 02:24:26 +0000 (10:24 +0800)]
Fix dropdown icon misalignment when using fomantic icon (#23558)

There are still many dropdowns using fomantic icon. For example: new
issue with issue template.

Avoid polluting the fomantic styles.

Before:

![image](https://user-images.githubusercontent.com/2114189/226101609-fa64178d-fed0-4541-bea2-72a250cb74db.png)

After:

![image](https://user-images.githubusercontent.com/2114189/226101603-9507b275-fc5b-4a55-870d-db8c4486d80a.png)

19 months agoEnable color for consistency checks diffs (#23563)
silverwind [Sun, 19 Mar 2023 01:47:47 +0000 (02:47 +0100)]
Enable color for consistency checks diffs (#23563)

Drone can display terminal colors, so force-enable it to make diffs more
readable on it.

Co-authored-by: delvh <leon@kske.dev>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 19 Mar 2023 00:16:17 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoFix sticky header in diff view (#23554)
silverwind [Sat, 18 Mar 2023 22:51:00 +0000 (23:51 +0100)]
Fix sticky header in diff view (#23554)

Ressurection of #23549.

Fix regression https://github.com/go-gitea/gitea/pull/23513#issuecomment-1474356817 from #23271.
The previous sticky CSS did assume the content is always 2 rows, but since that PR, it's single-row above 993px width.
Adjust the sticky offset to match and add a small tweak that hides content behind the `border-radius`.

Single row:
<img width="1264" alt="Screenshot 2023-03-17 at 21 33 05"
src="https://user-images.githubusercontent.com/115237/226034050-a04b131d-fd3f-45c0-bc72-413738a59825.png">

Double row:
<img width="1243" alt="Screenshot 2023-03-17 at 21 32 53"
src="https://user-images.githubusercontent.com/115237/226034163-2f1c6aa9-fc72-432f-bc46-9a7119da8677.png">

19 months agoFix some broken css (#23560)
wxiaoguang [Sat, 18 Mar 2023 21:53:12 +0000 (05:53 +0800)]
Fix some broken css (#23560)

1. The "close" inside "modal" are likely broken for long time
    * There is no var called `--body-color`
    * There is no `fullscreen modal`
* The `.ui.modal > .close.inside` doesn't seem to match most icons. It
only matches a few like "fork-repo-modal" or "adopt repo". Other places
are just buggy code copied again and again.
2. Convert the legacy `&:hover` LESS syntax to CSS syntax

19 months agoFix JS error on compare page (#23551)
silverwind [Sat, 18 Mar 2023 21:08:38 +0000 (22:08 +0100)]
Fix JS error on compare page (#23551)

Fix regression from #23271.
This code apparently runs on the compare page where there is no review button so check for existance of both button and content.

<img width="1226" alt="Screenshot 2023-03-17 at 21 42 47"
src="https://user-images.githubusercontent.com/115237/226040001-ec097edd-d926-4c80-9962-526f9b7eff19.png">

Fixes #23562

19 months agoUpgrade to npm lockfile v3 and explicitely set it (#23561)
silverwind [Sat, 18 Mar 2023 18:38:10 +0000 (19:38 +0100)]
Upgrade to npm lockfile v3 and explicitely set it (#23561)

`npm@8` which comes with node 16 will by default write lockfile v2
`npm@9` which comes with recent versions of node 18 and above will write
lockfile v3

To avoid incorrect lockfile v2 generation on npm v8, force npm to write
lockfile v3, so no matter which npm version the user has installed, the
same lockfile format will be generated.

References:
-
https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json#lockfileversion
- https://nodejs.org/en/download/releases

Co-authored-by: delvh <leon@kske.dev>
19 months agoFix long name ui issues and label ui issue (#23541)
Hester Gong [Sat, 18 Mar 2023 16:07:59 +0000 (00:07 +0800)]
Fix long name ui issues and label ui issue  (#23541)

This PR fixes some ui problems as mentioned in the two issues below.
1. Long file path has no word break

## Before
<img width="1357" alt="截屏2023-03-17 17 49 43"
src="https://user-images.githubusercontent.com/17645053/225873491-27c7bf9a-d5d5-4065-9e4a-ff228e935abf.png">

## After
<img width="1248" alt="截屏2023-03-17 17 51 22"
src="https://user-images.githubusercontent.com/17645053/225873562-93b87af7-9c83-43f8-aa0d-36a9174d25ac.png">
on mobile
<img width="408" alt="截屏2023-03-17 17 51 15"
src="https://user-images.githubusercontent.com/17645053/225873554-1b8c8999-1dfc-4251-a7fc-20ecd3444cb0.png">

2. Texts in labels
## Before
<img width="1219" alt="截屏2023-03-17 17 49 24"
src="https://user-images.githubusercontent.com/17645053/225873369-812b1b52-c104-4e32-988f-c3e55ad2f844.png">

## After
<img width="1259" alt="截屏2023-03-17 17 51 31"
src="https://user-images.githubusercontent.com/17645053/225873317-9717fd2c-e9e1-4a00-a27d-6bdc5933c3ca.png">
with two labels
<img width="1258" alt="截屏2023-03-17 17 51 53"
src="https://user-images.githubusercontent.com/17645053/225873323-13198192-71de-472d-8e78-6fd86ddba3d9.png">
In explore and star pages
<img width="896" alt="截屏2023-03-17 18 25 00"
src="https://user-images.githubusercontent.com/17645053/225878962-9e26e3aa-cff0-451c-9133-19f4ad1507a4.png">

<img width="913" alt="截屏2023-03-17 18 25 09"
src="https://user-images.githubusercontent.com/17645053/225878967-6adaa414-136e-43c2-87d0-7e46a0da112e.png">

3. Long name repository on creating new fork page
## Before
<img width="919" alt="截屏2023-03-17 17 50 01"
src="https://user-images.githubusercontent.com/17645053/225873723-5c4ea137-3b51-4074-a458-ef442e330ddf.png">

## After
<img width="907" alt="截屏2023-03-17 17 50 37"
src="https://user-images.githubusercontent.com/17645053/225873772-fc4a52c3-49c6-4ca6-903d-a13707f2a98b.png">

<img width="383" alt="截屏2023-03-17 17 50 48"
src="https://user-images.githubusercontent.com/17645053/225873779-6de1dfde-5c05-4ae9-89e1-85c25b3a1682.png">

Closes #23535
Closes #23534

19 months agoRemove worker-loader (#23548)
silverwind [Sat, 18 Mar 2023 04:36:32 +0000 (05:36 +0100)]
Remove worker-loader (#23548)

[`worker-loader`](https://github.com/webpack-contrib/worker-loader) is
deprecated since webpack 5 which can load workers without it now, so
remove it. I think it was already dysfunctional because the regex does
not match our current worker scripts:

```
web_src/js/features/eventsource.sharedworker.js
web_src/js/features/serviceworker.js
web_src/js/serviceworker.js
```

I did confirm that eventsource worker still loads via simple
`console.log` inside the script.

Co-authored-by: delvh <leon@kske.dev>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 18 Mar 2023 00:16:14 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoReturn `repository` in npm package metadata endpoint (#23539)
Zettat123 [Fri, 17 Mar 2023 18:39:19 +0000 (02:39 +0800)]
Return `repository` in npm package metadata endpoint (#23539)

Close #23444

Add `Repository` to npm package `Metadata` struct so the `repository` in
`package.json` can be stored and be returned in the endpoint.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
19 months agoFix diff detail buttons wrapping, use tippy for review box (#23271)
silverwind [Fri, 17 Mar 2023 17:24:00 +0000 (18:24 +0100)]
Fix diff detail buttons wrapping, use tippy for review box (#23271)

Fix visual regression introduced by
https://github.com/go-gitea/gitea/pull/22986.

Before:
<img width="1277" alt="image"
src="https://user-images.githubusercontent.com/115237/222792814-d70c2173-0c7c-4db2-8839-95be63cdc8ee.png">
<img width="649" alt="image"
src="https://user-images.githubusercontent.com/115237/222792989-9b1f5e12-becd-40cc-b02c-e9f59a8e72a4.png">

After:
<img width="1274" alt="image"
src="https://user-images.githubusercontent.com/115237/222792769-e7a9702f-4b6a-46c4-9385-da103ed4dff0.png">
<img width="565" alt="image"
src="https://user-images.githubusercontent.com/115237/222793084-6de6482b-11dc-4d38-b514-15884d20e140.png">

19 months agoDo not store user projects as organization projects (#23353)
yp05327 [Fri, 17 Mar 2023 13:07:23 +0000 (22:07 +0900)]
Do not store user projects as organization projects (#23353)

A part of https://github.com/go-gitea/gitea/pull/22865

At first, I think we do not need 3 ProjectTypes, as we can check user
type, but it seems that it is not database friendly.

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
19 months agoImrove scroll behavior to hash issuecomment(scroll position, auto expand if file...
Hester Gong [Fri, 17 Mar 2023 10:24:18 +0000 (18:24 +0800)]
Imrove scroll behavior to hash issuecomment(scroll position, auto expand if file is folded, and on refreshing) (#23513)

Close #23466

Right now on pull request "files Changed" tab, if a file is viewed, when
the comments' links are visited, the comment will not be shown as the
file is folded after viewed. This PR is to improve the behavior, to make
the comment seen even the related file is folded, like on github.

And right now scroll position will be remembered and hence it won’t
scroll to hashed comment after refreshing, this PR also adjust the
scroll position remembering behavior: When there is hash comment in url,
do not remember the scroll position.

Before:

https://user-images.githubusercontent.com/17645053/225512079-6cf79581-9346-44cf-95d6-06919642e6a8.mov

After:

https://user-images.githubusercontent.com/17645053/225523753-3f6728f2-977b-4ed0-a65c-63dcef2ace80.mov

Update - long comment's behavior after using `scrollTop ` (Comment div
scroll to the position which is 30px below the diff header, or 30px
below top on conversation tab):

https://user-images.githubusercontent.com/17645053/225614460-0602c1a6-229c-41f4-84d2-334e78251486.mov

19 months agoIncrease horizontal page padding (#23507)
silverwind [Fri, 17 Mar 2023 06:23:23 +0000 (07:23 +0100)]
Increase horizontal page padding (#23507)

Add a bit more empty space on left and right side of page content for a
more pleasant viewing experience. Also tweaked the mobile navbar to
match.

Before:
<img width="1276" alt="Screenshot 2023-03-16 at 00 58 23"
src="https://user-images.githubusercontent.com/115237/225473942-f544106f-1b61-456a-99fb-3ba136cabc8d.png">

After:
<img width="1270" alt="Screenshot 2023-03-16 at 00 58 37"
src="https://user-images.githubusercontent.com/115237/225473959-8b555359-a08d-48e1-9476-2710aabb1166.png">

Mobile Navbar:
<img width="673" alt="Screenshot 2023-03-16 at 01 05 12"
src="https://user-images.githubusercontent.com/115237/225473966-adccef2b-4d34-44ed-8c75-d4ca46d96cf3.png">

19 months agoUpdate JS dependencies, Require Node.js 16 (#23528)
silverwind [Fri, 17 Mar 2023 05:45:45 +0000 (06:45 +0100)]
Update JS dependencies, Require Node.js 16 (#23528)

- Update all JS dependencies
- Require Node.js 16 as dictated by `esbuild-loader`
- Regenerate SVG
- Adapt to `esbuild-loader` breaking changes
- Minor refactor in `webpack.config.js`
- Tested build, monaco and swagger-ui

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoUse octicon-verified for gpg signatures (#23529)
silverwind [Fri, 17 Mar 2023 05:12:40 +0000 (06:12 +0100)]
Use octicon-verified for gpg signatures (#23529)

Before:
<img width="292" alt="Screenshot 2023-03-16 at 23 40 47"
src="https://user-images.githubusercontent.com/115237/225768871-43e11ced-e340-4c88-b756-25f9f7076fd2.png">
<img width="288" alt="Screenshot 2023-03-16 at 23 51 05"
src="https://user-images.githubusercontent.com/115237/225770071-b51f3ed6-ef14-421b-a5bc-6a26e808d404.png">

After:
<img width="291" alt="Screenshot 2023-03-16 at 23 40 37"
src="https://user-images.githubusercontent.com/115237/225768864-ea4956c7-8c57-4148-9d89-c818991a7538.png">
<img width="281" alt="image"
src="https://user-images.githubusercontent.com/115237/225769978-0b9c6c52-9a13-4c23-b13e-8a8a692abf43.png">

19 months agoRemove stars in dashboard repo list (#23530)
yp05327 [Fri, 17 Mar 2023 04:43:58 +0000 (13:43 +0900)]
Remove stars in dashboard repo list (#23530)

Discussion is here: https://github.com/go-gitea/gitea/pull/22816

19 months agoUse `<nav>` instead of `<div>` in the global navbar (#23125)
delvh [Fri, 17 Mar 2023 03:52:44 +0000 (04:52 +0100)]
Use `<nav>` instead of `<div>` in the global navbar (#23125)

Furthermore improved/deleted some comments in the template.
The appearance did not change.

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
19 months agoFix aria.js bugs: incorrect role element problem, mobile focus problem, tippy problem...
wxiaoguang [Fri, 17 Mar 2023 03:08:05 +0000 (11:08 +0800)]
Fix aria.js bugs: incorrect role element problem, mobile focus problem, tippy problem (#23450)

This PR is extracted from #23346 to address some unclear (I don't
understand) code-belonging concerns.

This PR needs to be backported, otherwise the `aria.js` is too buggy in
some cases. Since there would be two minor conflicts, I will do the
backport manually.

Before: the `aria.js` is still buggy in some cases.

After: tested with AppleVoice, Android TalkBack

* Fix incorrect dropdown init code
* Fix incorrect role element (the menu role should be on the `$menu`
element, but not on the `$focusable`)
* Fix the focus-show-click-hide problem on mobile. Now the language menu
works as expected
* Fix incorrect dropdown template function setting
* Clarify the logic in aria.js
* Hide item's tippy after menu gets hidden
* Fix incorrect tippy `setProps` after `destroy`
* Fix UI lag problem when page gets redirected during menu hiding
animation with screen reader
* Improve comments
* Implement the layout proposed by #19861

<details>

https://github.com/go-gitea/gitea/blob/d74a7efb60f94a4b8e6e5f65332f94f1be31b761/web_src/js/features/aria.md?plain=1#L38-L47

</details>

19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 17 Mar 2023 00:16:11 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoMake time tooltips interactive (#23526)
silverwind [Thu, 16 Mar 2023 20:40:56 +0000 (21:40 +0100)]
Make time tooltips interactive (#23526)

Fixes https://codeberg.org/forgejo/forgejo/issues/511

<img width="379" alt="Screenshot 2023-03-16 at 20 23 10"
src="https://user-images.githubusercontent.com/115237/225731294-4c6e4f44-bdcc-4c8c-86e2-49f7c03b377d.png">

19 months agoUpdate mini-css-extract-plugin, remove postcss (#23520)
silverwind [Thu, 16 Mar 2023 19:06:53 +0000 (20:06 +0100)]
Update mini-css-extract-plugin, remove postcss (#23520)

Follow-up and proper fix for
https://github.com/go-gitea/gitea/pull/23504

Update to
[mini-css-extract-plugin@2.7.4](https://github.com/webpack-contrib/mini-css-extract-plugin/releases/tag/v2.7.4)
which fixes our specific issue described in
https://github.com/webpack-contrib/css-loader/issues/1503 and which
allows us to again drop the postcss dependency.

Backport of this is not necessary as I have included it in
https://github.com/go-gitea/gitea/pull/23508.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
19 months agoFix review comment context menu clipped bug (#23523)
wxiaoguang [Thu, 16 Mar 2023 18:25:04 +0000 (02:25 +0800)]
Fix review comment context menu clipped bug (#23523)

This is another regression of #22959 (the first regression has been
fixed by the Image Diff fix)

Close #23517

This is a quick fix. Luckily, there is no "dropdown menu" for image/csv
view, so we could only add the "overflow-x: scroll" to the image/csv
view.

After fix:

![image](https://user-images.githubusercontent.com/2114189/225643575-9e964b4f-5543-4a69-86c2-2ffc8e40d9a6.png)

![image](https://user-images.githubusercontent.com/2114189/225643670-f0e575d0-f4af-41f4-b023-2d9ddb6462e9.png)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
19 months agoAdd absent repounits to create/edit repo API (#23500)
James Cleverley-Prance [Thu, 16 Mar 2023 17:30:42 +0000 (17:30 +0000)]
Add absent repounits to create/edit repo API (#23500)

Adds the ability to enable/disable Actions, Packages and Releases from
the API, via the Edit and Get Repository API endpoints.

19 months agoFix tags sort by creation time (descending) on branch/tag dropdowns (#23491)
Hester Gong [Thu, 16 Mar 2023 17:01:10 +0000 (01:01 +0800)]
Fix tags sort by creation time (descending) on branch/tag dropdowns  (#23491)

This PR fixes the tags sort issue mentioned in #23432
The tags on dropdown shoud be sorted in descending order of time but are
not. Because when getting tags, it execeutes `git tag sort
--sort=-taggerdate`. Git supports two types of tags: lightweight and
annotated, and `git tag sort --sort=-taggerdate` dosen't work with
lightweight tags, which will not give correct result. This PR add
`GetTagNamesByRepoID ` to get tags from the database so the tags are
sorted.

Also adapt this change to the droplist when comparing branches.

Dropdown places:

<img width="369" alt="截屏2023-03-15 14 25 39"
src="https://user-images.githubusercontent.com/17645053/225224506-65a72e50-4c11-41d7-8187-a7e9c7dab2cb.png">

<img width="675" alt="截屏2023-03-15 14 25 27"
src="https://user-images.githubusercontent.com/17645053/225224526-65ce8008-340c-43f6-aa65-b6bd9e1a1bf1.png">

19 months agoAllow both fullname and username search when `DEFAULT_SHOW_FULL_NAME` is true (#23463)
Hester Gong [Thu, 16 Mar 2023 16:32:25 +0000 (00:32 +0800)]
Allow both fullname and username search when `DEFAULT_SHOW_FULL_NAME` is true (#23463)

This PR adds the ability to search both fullname and username for
assignees, reviewers and author search boxes when the config
[`DEFAULT_SHOW_FULL_NAME`](https://github.com/go-gitea/gitea/blob/6ff5400af91aefb02cbc7dd59f6be23cc2bf7865/custom/conf/app.example.ini#L1238)
in `app.ini` is set to `true`. Which is originally raised
[here](https://projects.blender.org/infrastructure/blender-projects-platform/issues/14)
And if `DEFAULT_SHOW_FULL_NAME` is set to `false`(default value), these
search boxes will only show username.

Example:
When `DEFAULT_SHOW_FULL_NAME = true`

<img width="1220" alt="截屏2023-03-14 14 28 06"
src="https://user-images.githubusercontent.com/17645053/224914546-80ef2837-ab72-4d66-9f00-6eb77ed4baaa.png">

When `DEFAULT_SHOW_FULL_NAME = false` (default value)

<img width="1243" alt="截屏2023-03-14 14 29 37"
src="https://user-images.githubusercontent.com/17645053/224914798-f69ec8a2-0929-4330-827c-3e30188f9b47.png">

The specific search boxes that adapts these changes include:
1. Author, Assignee search boxes in pull requests tab and issues tab in
repository
<img width="1283" alt="截屏2023-03-14 14 35 01"
src="https://user-images.githubusercontent.com/17645053/224916250-8e452525-71d6-4b48-bf1c-bf7a176abaaa.png">

2. Assigee and Author on milestones issue page (Added missing search box
for author here)
<img width="1261" alt="截屏2023-03-14 14 38 20"
src="https://user-images.githubusercontent.com/17645053/224916569-d3105619-7824-4bb8-a6d0-1a600eaa9963.png">

3. Assignee on issues and PR Sidebar, Reviewer on PR Sidebar
<img width="976" alt="截屏2023-03-14 14 41 06"
src="https://user-images.githubusercontent.com/17645053/224917431-c45d821e-9660-4f58-a196-5979a0bb64ce.png">

<img width="1027" alt="截屏2023-03-14 14 41 58"
src="https://user-images.githubusercontent.com/17645053/224917290-ad4dbc52-0c20-45c4-9fce-9dcd59ad7d47.png">

4. Assignee when creating new issue
<img width="961" alt="截屏2023-03-14 14 44 33"
src="https://user-images.githubusercontent.com/17645053/224917694-34bee5a7-e975-4f37-8862-56ebc2556808.png">

5. Whitelisted users for pushing, Whitelisted users for merging and
Whitelisted reviewers in Protected branch settings
<img width="920" alt="截屏2023-03-14 14 48 56"
src="https://user-images.githubusercontent.com/17645053/224918551-9b46b44e-b075-4895-8d33-1aafc7d3c8e5.png">
<img width="901" alt="截屏2023-03-14 14 49 02"
src="https://user-images.githubusercontent.com/17645053/224918584-efa66f23-a593-4e26-a3eb-bb1fbc5516ae.png">
<img width="944" alt="截屏2023-03-14 14 49 21"
src="https://user-images.githubusercontent.com/17645053/224918591-be60455d-0513-4f66-84f6-b5e1bc40ff91.png">

6.  "Allowed users" in tags settings
<img width="935" alt="截屏2023-03-14 14 50 11"
src="https://user-images.githubusercontent.com/17645053/224918701-797699aa-c7e5-4290-b3fe-27dcead1c6c7.png">

19 months agoHandle files starting with colons in WalkGitLog (#22935)
Kirill Bolashev [Thu, 16 Mar 2023 16:03:04 +0000 (18:03 +0200)]
Handle files starting with colons in WalkGitLog (#22935)

Currently gitea shows no commit information for files starting with a
colon.

[I set up a minimal repro repository that reproduces this error once
it's migrated on gitea](https://github.com/kbolashev/colon-test)

<img width="1209" alt="image"
src="https://user-images.githubusercontent.com/111061261/219326625-0e6d3a86-8b58-4d67-bc24-8a78963f36b9.png">

This is happening because the filenames piped to the `git log` command
are written as is, and it doesn't work when you have a colon at the
start of the filename, and you need to escape it.

You can test it locally,  if you do
```
mkdir repo
git init
touch :file
git add . && git commit -m "Add file with colon"
git log -- :file
```
git log returns nothing. However, if you do `git log -- "\:file"`, it
will show the commit with the file change.

This PR escapes the starting colons in paths in the `LogNameStatusRepo`
function, making gitea return commit info about the file with the bad
filename.

<img width="1209" alt="image"
src="https://user-images.githubusercontent.com/111061261/219328299-46451246-4006-45e3-89b1-c244635ded23.png">

This error shows up only with files starting with colon, anywhere else
in filename is ok. Dashes at the beginning also seem to be working.
I don't know gitea internals well enough to know where else this error
can pop up, so I'm keeping this PR small as suggested by your
contributor guide

19 months agoChange `Close` to either `Close issue` or `Close pull request` (#23506)
Yarden Shoham [Thu, 16 Mar 2023 15:11:31 +0000 (17:11 +0200)]
Change `Close` to either `Close issue` or `Close pull request` (#23506)

Following [a discord
discussion](https://discord.com/channels/322538954119184384/977026554909581334/1085560443919147138),
the close button in the issue comment box is more descriptive.

# Before
For both issue and pull request

![image](https://user-images.githubusercontent.com/20454870/225449237-20c3a036-4b0f-40ab-b2f9-e72eff213165.png)

# After
## Issue

![image](https://user-images.githubusercontent.com/20454870/225550855-aa138ee5-e620-4f8c-b17b-91281677ecab.png)

## Pull request

![image](https://user-images.githubusercontent.com/20454870/225550750-4dd0906d-39a9-4678-9aee-e97e5e8c302d.png)

---------

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
19 months agoUpdate act (#23512)
Jason Song [Thu, 16 Mar 2023 10:09:11 +0000 (18:09 +0800)]
Update act (#23512)

Update replace:
```diff
- replace github.com/nektos/act => gitea.com/gitea/act v0.234.2-0.20230131074955-e46ede1b1744
+ replace github.com/nektos/act => gitea.com/gitea/act v0.243.1
```

Update require:
```diff
- github.com/nektos/act v0.0.0
+ github.com/nektos/act v0.2.43
```

Actually, `v0.2.43` doesn't work, it will be replaced by `gitea/act`, so
it's OK to put any version here. But `gitea/act` is based on
`nektos/act`, so keeping the right upstream version will make security
dependabot help.

BTW, the [security
report](https://github.com/go-gitea/gitea/security/dependabot/20) is
false positive, we don't use the artifact server in act, see #22738.

19 months agoMove pidfile creation from setting to web cmd package (#23285)
Lunny Xiao [Thu, 16 Mar 2023 07:22:54 +0000 (15:22 +0800)]
Move pidfile creation from setting to web cmd package (#23285)

Creating pid file should not belong to setting package and only web
command needs that. So this PR moves pidfile creation from setting
package to web command package to keep setting package more readable.

I marked this as `break` because the PIDFile path moved. For those who
have used the pid build argument, it has to be changed.

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
19 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 16 Mar 2023 00:16:23 +0000 (00:16 +0000)]
[skip ci] Updated translations via Crowdin

19 months agoReplace `repo.namedBlob` by `git.TreeEntry`. (#22898)
Nick [Wed, 15 Mar 2023 21:51:39 +0000 (17:51 -0400)]
Replace `repo.namedBlob` by `git.TreeEntry`. (#22898)

`namedBlob` turned out to be a poor imitation of a `TreeEntry`. Using
the latter directly shortens this code.

This partially undoes https://github.com/go-gitea/gitea/pull/23152/,
which I found a merge conflict with, and also expands the test it added
to cover the subtle README-in-a-subfolder case.