]> source.dussan.org Git - gitea.git/log
gitea.git
7 months agoForbid variables containing jQuery collections not having the `$` prefix (#29839)
Yarden Shoham [Sat, 16 Mar 2024 12:22:16 +0000 (14:22 +0200)]
Forbid variables containing jQuery collections not having the `$` prefix (#29839)

See
https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/docs/rules/variable-pattern.md

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoRemove AddParamIfExist(AddParam) (#29841)
wxiaoguang [Sat, 16 Mar 2024 12:07:56 +0000 (20:07 +0800)]
Remove AddParamIfExist(AddParam) (#29841)

Follow #29834

Remove AddParamIfExist, use "AddParamString" instead, it should clearly
know what is being added into the parameters.

7 months agoRefactor markdown attention render (#29833)
wxiaoguang [Sat, 16 Mar 2024 11:34:38 +0000 (19:34 +0800)]
Refactor markdown attention render (#29833)

* Remove some deadcode
* Use 2-word name for CSS class names
* Remove "gt-*" rules for sanitizer

The UI doesn't change much.

7 months agoRefactor code_indexer to use an SearchOptions struct for PerformSearch (#29724)
6543 [Sat, 16 Mar 2024 10:32:45 +0000 (11:32 +0100)]
Refactor code_indexer to use an SearchOptions struct for PerformSearch (#29724)

similar to how it's already done for the issue_indexer

---
*Sponsored by Kithara Software GmbH*

7 months agoRefactor AddParam to AddParamIfExist (#29834)
wxiaoguang [Sat, 16 Mar 2024 09:20:13 +0000 (17:20 +0800)]
Refactor AddParam to AddParamIfExist (#29834)

When read the code: `pager.AddParam(ctx, "search", "search")`, the
question always comes: What is it doing? Where is the value from? Why
"search" / "search" ?

Now it is clear: `pager.AddParamIfExist("search", ctx.Data["search"])`

7 months agoForbid jQuery AJAX (#29818)
Yarden Shoham [Sat, 16 Mar 2024 02:01:25 +0000 (04:01 +0200)]
Forbid jQuery AJAX (#29818)

Please use the fetch wrapper instead, or even better `htmx`.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: 6543 <6543@obermui.de>
7 months agoRemove jQuery AJAX from the notifications (#29817)
Yarden Shoham [Sat, 16 Mar 2024 01:56:17 +0000 (03:56 +0200)]
Remove jQuery AJAX from the notifications (#29817)

- Removed 2 jQuery AJAX calls and replaced with our fetch wrapper
- Deleted an AJAX call that wasn't attached to any element since #24989
- Tested the notification count and notification table functionality and
it works as before

# Demo using `fetch` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/ff862a9a-1c88-41cc-bd01-5a0711dbd6f8)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoLight theme color enhancements (#29830)
silverwind [Sat, 16 Mar 2024 01:33:01 +0000 (02:33 +0100)]
Light theme color enhancements (#29830)

Same as https://github.com/go-gitea/gitea/pull/29822 but for light
theme. Slight shift towards blue and made the themes match more, like on
header and footer background.

Before
<img width="1342" alt="Screenshot 2024-03-16 at 00 43 03"
src="https://github.com/go-gitea/gitea/assets/115237/b46021a1-241c-446a-b220-ca25cc90f3bf">

After
<img width="1343" alt="Screenshot 2024-03-16 at 00 45 21"
src="https://github.com/go-gitea/gitea/assets/115237/1c898875-a6bb-4bd3-b059-f82e1a145c99">

Before
<img width="1018" alt="Screenshot 2024-03-16 at 00 43 13"
src="https://github.com/go-gitea/gitea/assets/115237/d237ee7d-b4cc-4688-a074-1e96515ac475">

After
<img width="1022" alt="Screenshot 2024-03-16 at 00 43 50"
src="https://github.com/go-gitea/gitea/assets/115237/89b1da77-6bc9-4b38-9688-546e794aadfa">

7 months agoBetter highlighting of archved labels (#29749)
6543 [Fri, 15 Mar 2024 22:35:47 +0000 (23:35 +0100)]
Better highlighting of archved labels (#29749)

as followup of the not jet finished discussion at
https://github.com/go-gitea/gitea/pull/29680#discussion_r1521867261

we enhance and chat about how best to highlight archived labels here :)

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoRemove the `time-since` class (#29826)
Yarden Shoham [Fri, 15 Mar 2024 21:57:53 +0000 (23:57 +0200)]
Remove the `time-since` class (#29826)

It serves no purpose.

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoRemove jQuery AJAX from the project page (#29814)
Yarden Shoham [Fri, 15 Mar 2024 21:23:56 +0000 (23:23 +0200)]
Remove jQuery AJAX from the project page (#29814)

Removed all jQuery AJAX calls and replaced with our fetch wrapper.

Tested the following functionalities and they work as before:
- column creation
- column deletion
- issue movement between columns
- column reordering
- column edit
- default column changing

# Demo using `fetch` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/99e6898f-baa3-462c-acec-46a910874dbe)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
7 months agoUpgrade `htmx` to v1.9.11 (#29821)
Yarden Shoham [Fri, 15 Mar 2024 18:24:27 +0000 (20:24 +0200)]
Upgrade `htmx` to v1.9.11 (#29821)

Also added BSD Zero Clause License to the list of allowed licenses in
webpack.

Tested various `htmx` operations. Nothing broke.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoDark theme color enhancements (#29822)
silverwind [Fri, 15 Mar 2024 18:14:33 +0000 (19:14 +0100)]
Dark theme color enhancements (#29822)

- Few very minor colors tweaks to dark theme. Slightly darker
background, slightly bluer secondary colors.
- Alias `--color-nav-hover-bg` in both themes.

Before:
<img width="1013" alt="Screenshot 2024-03-15 at 18 43 59"
src="https://github.com/go-gitea/gitea/assets/115237/ce4bdb0d-6e25-4fd6-88f5-dc8f9e3093cd">

After:
<img width="1016" alt="Screenshot 2024-03-15 at 19 02 04"
src="https://github.com/go-gitea/gitea/assets/115237/4a6dd5a1-a5b4-4fc2-9835-05a0c2c58c42">

Before:
<img width="1340" alt="Screenshot 2024-03-15 at 18 40 19"
src="https://github.com/go-gitea/gitea/assets/115237/4465fa9c-d529-4a05-94d7-e21080e0a153">

After:
<img width="1341" alt="Screenshot 2024-03-15 at 19 00 51"
src="https://github.com/go-gitea/gitea/assets/115237/6595afef-592b-42c4-a6cd-196968ba5881">

7 months agoRemove jQuery AJAX from the comment edit box (#29812)
Yarden Shoham [Fri, 15 Mar 2024 18:02:43 +0000 (20:02 +0200)]
Remove jQuery AJAX from the comment edit box (#29812)

- Removed all jQuery AJAX calls and replaced with our fetch wrapper
- Tested the file addition and removal functionality and it works as
before

# Demo using `fetch` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/846ed6d5-3798-43ca-920c-d619e9c3d745)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoTweak labeler (#29809)
silverwind [Fri, 15 Mar 2024 15:27:51 +0000 (16:27 +0100)]
Tweak labeler (#29809)

- `poetry.toml` does not picture dependencies
- Add `.vue` files to `modifies/js`

7 months agoFix `for` attribute not pointing to the ID of the color picker (#29813)
Yarden Shoham [Fri, 15 Mar 2024 13:12:08 +0000 (15:12 +0200)]
Fix `for` attribute not pointing to the ID of the color picker (#29813)

It didn't include the word picker.

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
7 months agoRefactor graceful manager, fix misused WaitGroup (#29738)
coldWater [Fri, 15 Mar 2024 10:59:11 +0000 (18:59 +0800)]
Refactor graceful manager, fix misused WaitGroup (#29738)

Follow #29629

7 months agoImprove repo search UI (#29767)
wxiaoguang [Fri, 15 Mar 2024 09:45:30 +0000 (17:45 +0800)]
Improve repo search UI (#29767)

1. Introduce a special "flex-items-block" for menu items, to align the
dropdown menu items
2. Simplify the "repo search" form
3. Add missing "TopicOnly" search option

Screenshots:

The old UI items don't align:

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/b965ac00-bad6-4d2f-9103-8841bd940aa5)

</details>

New UI (doesn't change much, but the items align)

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/a1add892-21dc-423b-90d5-5569faa3dced)

![image](https://github.com/go-gitea/gitea/assets/2114189/fb4040b2-96d8-4fb2-a0ed-760b9881fd86)

</details>

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoUse `Temporal.PlainDate` for absolute dates (#29804)
silverwind [Fri, 15 Mar 2024 09:13:01 +0000 (10:13 +0100)]
Use `Temporal.PlainDate` for absolute dates (#29804)

Use the upcoming
[Temporal.PlainDate](https://tc39.es/proposal-temporal/docs/plaindate.html)
via polyfill. If there is any remaining bugs in `<absolute-date>` this
will iron them out. I opted for the lightweight polyfill because both
seem to achieve our goal of localizeable absolute dates.

- With
[`@js-temporal/polyfill`](https://www.npmjs.com/package/@js-temporal/polyfill)
chunk size goes from 81.4 KiB to 274 KiB
- With
[`temporal-polyfill`](https://www.npmjs.com/package/temporal-polyfill)
chunk size goes from 81.4 KiB to 142 KiB

Also see [this
table](https://github.com/fullcalendar/temporal-polyfill?tab=readme-ov-file#comparison-with-js-temporalpolyfill)
for more comparisons of these polyfills. Soon there will be
[treeshakable
API](https://github.com/fullcalendar/temporal-polyfill?tab=readme-ov-file#tree-shakable-api)
as well which will further reduce size.

7 months agoFix codeowner detected diff base branch to mergebase (#29783)
Lunny Xiao [Fri, 15 Mar 2024 05:13:09 +0000 (13:13 +0800)]
Fix codeowner detected diff base branch to mergebase (#29783)

Fix #29763

This PR fixes 2 problems with CodeOwner in the pull request.
- Don't use the pull request base branch but merge-base as a diff base to
detect the code owner.
- CodeOwner detection in fork repositories will be disabled because
almost all the fork repositories will not change CODEOWNERS files but it
should not be used on fork repositories' pull requests.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoRemove scrollbar customizations (#29800)
silverwind [Fri, 15 Mar 2024 04:45:45 +0000 (05:45 +0100)]
Remove scrollbar customizations (#29800)

Fixes https://github.com/go-gitea/gitea/issues/29652. Removes all
scrollbar customization as per popular vote on
https://github.com/go-gitea/gitea/issues/29652#issuecomment-1985846162.

There is one more case of `-webkit-scrollbar` left in CSS and
https://github.com/go-gitea/gitea/pull/29400 will get rid of that as
well.

7 months agoImprove branch select list ui in go templates (#29729)
HEREYUA [Fri, 15 Mar 2024 03:43:10 +0000 (11:43 +0800)]
Improve branch select list ui in go templates (#29729)

Relate:[#27417](https://github.com/go-gitea/gitea/issues/27471)
Reference:  [#26631](https://github.com/go-gitea/gitea/pull/26631)

Before

![image](https://github.com/go-gitea/gitea/assets/37935145/88ca8da5-25dd-4f60-bea8-a80107f19cc5)

After

![image](https://github.com/go-gitea/gitea/assets/37935145/3cb180dc-1331-43e9-8633-be5e288401e8)

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoFix Citation modal responsiveness and clipboard copy (#29799)
silverwind [Fri, 15 Mar 2024 02:38:13 +0000 (03:38 +0100)]
Fix Citation modal responsiveness and clipboard copy (#29799)

The modal was broken in two ways:

- On small screens, the input box was partially hanging outside the
modal. Fixed with flexbox and increased modal width.
- The clipboard copy was not working because the modal had both
`data-clipboard-text` and `data-clipboard-target`, while we only support
one of those. Made a small tweak in clipboard as well so that it will
still fall back to target if text is empty.

7 months agoAdd `<overflow-menu>`, rename webcomponents (#29400)
silverwind [Fri, 15 Mar 2024 02:05:31 +0000 (03:05 +0100)]
Add `<overflow-menu>`, rename webcomponents (#29400)

1. Add `<overflow-menu>` web component
2. Rename `<gitea-origin-url>` to `<origin-url>` and make filenames
match.

<img width="439" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/2fbe4ca4-110b-4ad2-8e17-c1e116ccbd74">

<img width="444" alt="Screenshot 2024-03-02 at 21 36 52"
src="https://github.com/go-gitea/gitea/assets/115237/aa8f786e-dc8c-4030-b12d-7cfb74bdfd6e">

<img width="537" alt="Screenshot 2024-03-03 at 03 05 06"
src="https://github.com/go-gitea/gitea/assets/115237/fddd50aa-adf1-4b4b-bd7f-caf30c7b2245">

![image](https://github.com/go-gitea/gitea/assets/115237/0f43770c-834c-4a05-8e3d-d30eb8653786)

![image](https://github.com/go-gitea/gitea/assets/115237/4b4c6bd7-843f-4f49-808f-6b3aed5e9f9a)

TODO:

- [x] Check if removal of `requestAnimationFrame` is possible to avoid
flash of content. Likely needs a `MutationObserver`.
- [x] Hide tippy when button is removed from DOM.
- [x] ~~Implement right-aligned items
(https://github.com/go-gitea/gitea/pull/28976)~~. Not going to do it.
- [x] Clean up CSS so base element has no background and add background
via tailwind instead.
- [x] Use it for org and user page.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoUpdate JS dependences (#29797)
silverwind [Thu, 14 Mar 2024 23:33:06 +0000 (00:33 +0100)]
Update JS dependences (#29797)

Update all non-excluded JS deps, tested monaco, swagger and mermaid.

7 months agoUnify search boxes (#29530)
Denys Konovalov [Thu, 14 Mar 2024 23:24:59 +0000 (00:24 +0100)]
Unify search boxes (#29530)

Unify all but a few search boxes to use uniform style, uniform
translations and shared templates where possible.
Remove a few duplicated search templates, e. g. code search.

<details><summary>Example after screenshots:</summary>

![grafik](https://github.com/go-gitea/gitea/assets/47871822/e20e7d6b-c6be-4a47-b132-672766f41421)

![grafik](https://github.com/go-gitea/gitea/assets/47871822/d5b11b9c-c12f-4a29-8fb0-24e5aa511d18)

![grafik](https://github.com/go-gitea/gitea/assets/47871822/d86bb444-36c7-426d-9cf1-c634963dffb1)

![grafik](https://github.com/go-gitea/gitea/assets/47871822/a76c0319-0518-484a-a840-563d02b61198)

</details>

Also includes #29700

Co-authored-by: 6543 <6543@obermui.de>
---------

Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoFix document error about 'make trans-copy' (#29710)
Daniel YC Lin [Thu, 14 Mar 2024 22:54:11 +0000 (06:54 +0800)]
Fix document error about 'make trans-copy' (#29710)

Change document to 'make docs'

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.com>
7 months agoRemove jQuery AJAX from the diff functions (#29743)
Yarden Shoham [Thu, 14 Mar 2024 22:21:14 +0000 (00:21 +0200)]
Remove jQuery AJAX from the diff functions (#29743)

- Removed all jQuery AJAX calls and replaced with our fetch wrapper
- Tested the review conversation comment, resolve, unresolve, show more
files, and load diff functionality and it works as before

# Demo using `fetch` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/cc0bed59-f11f-4e48-bfa3-59ab52d9889e)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoFix Safari spinner rendering (#29801)
silverwind [Thu, 14 Mar 2024 22:04:33 +0000 (23:04 +0100)]
Fix Safari spinner rendering (#29801)

Fixes: https://github.com/go-gitea/gitea/issues/29041
Fixes: https://github.com/go-gitea/gitea/pull/29713
Any of the `width: *-content` properties seem to workaround this Webkit
bug, this one seemed most suitable.

7 months agoRemove jQuery AJAX from the `repo-issue.js` file (#29776)
Yarden Shoham [Thu, 14 Mar 2024 21:36:17 +0000 (23:36 +0200)]
Remove jQuery AJAX from the `repo-issue.js` file (#29776)

Removed all jQuery AJAX calls and replaced with our fetch wrapper.

Tested the following functionalities and they work as before:
- due-date update
- comment deletion
- branch update by merge or rebase
- allow edits from maintainers button
- reviewer addition or deletion
- WIP toggle button
- new diff code comment button
- issue title edit button

# Demo using `fetch` instead of jQuery AJAX
## Updating the due-date of an issue

![due_date](https://github.com/go-gitea/gitea/assets/20454870/7de395d3-63e8-49e8-9a13-8d14fc26810d)

## Deleting a comment

![comment_delete](https://github.com/go-gitea/gitea/assets/20454870/2814e695-44e3-4548-9ee7-7b437bef4b01)

## Updating a branch in a pull request

![branch_update](https://github.com/go-gitea/gitea/assets/20454870/137da77e-acc4-4984-a1bc-be58583bf52a)

## Checking and unchecking the "Allow edits from maintainers" checkbox

![allow_edits](https://github.com/go-gitea/gitea/assets/20454870/8d4829af-5813-432d-90ef-da057f8cdafc)

## Requesting review and removing review request

![reviewer_addition](https://github.com/go-gitea/gitea/assets/20454870/08f210e0-be3f-41af-b271-214a1dd2d0ba)

## Toggling the WIP status of a pull request

![wip](https://github.com/go-gitea/gitea/assets/20454870/dea5e668-1c89-4f3d-a5d6-4c26aefc4814)

## Clicking the new code comment button on the diff page

![code_comment](https://github.com/go-gitea/gitea/assets/20454870/1d17174e-3bba-4cf8-81fe-c3a2c21f80b9)

## Editing the issue title and target branch

![issue_title](https://github.com/go-gitea/gitea/assets/20454870/7099888e-81c0-47d4-9371-8e4469e9e519)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoImprove commit record's ui in comment list (#26619)
yp05327 [Thu, 14 Mar 2024 19:01:16 +0000 (04:01 +0900)]
Improve commit record's ui in comment list (#26619)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/795f9941-9989-4045-b0fc-d6dd0262269b)

![image](https://github.com/go-gitea/gitea/assets/18380374/f6505f5e-4248-456e-a98d-e714c6484b2f)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/321dda1e-6999-4851-afff-2e6c8d20367b)

![image](https://github.com/go-gitea/gitea/assets/18380374/182f18d1-2295-4004-852b-c0ebb498b411)

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoenable tailwind nesting (#29746)
Rafael Heard [Thu, 14 Mar 2024 18:20:54 +0000 (14:20 -0400)]
enable tailwind nesting (#29746)

Currently, if you implement native CSS nesting within a Vue component a
warning will appear in the terminal. It states
`Nested CSS was detected, but CSS nesting has not been configured
correctly.
Please enable a CSS nesting plugin *before* Tailwind in your
configuration.` To fix this error we need to enable the built-in
[tailwinds nesting
config](https://tailwindcss.com/docs/using-with-preprocessors#nesting).

Example code to trigger the warning within a vue component:

```CSS
<style>
.example {
  &:hover,
  &:focus-visible {
    color: var(--color-text);
  }

  & svg {
    margin-right: 0.78rem;
  }
}
</style>
```

---------

Co-authored-by: rafh <rafaelheard@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoSupport GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env (#29788)
Jason Song [Thu, 14 Mar 2024 08:44:49 +0000 (16:44 +0800)]
Support GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env (#29788)

It is convenient to skip by setting environment, since it's OK
to use root user in job containers.

It's not a bug, but I want to backport it to v1.21 since it doesn't
break anything.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoFix missing translation on milestons (#29785)
Lunny Xiao [Thu, 14 Mar 2024 07:40:52 +0000 (15:40 +0800)]
Fix missing translation on milestons (#29785)

Caused by #26569
Fix #29778

7 months agoFix lint-swagger warning (#29787)
sillyguodong [Thu, 14 Mar 2024 04:59:52 +0000 (12:59 +0800)]
Fix lint-swagger warning (#29787)

Caused by: #23106
Fix:
https://github.com/go-gitea/gitea/actions/runs/8274650046/job/22640335697

1. Delete `UserBadgeList` in `options.go`, because it wasn't used. (The
struct defined in `options.go` is the struct used to parse the request
body)
2. Move `BadgeList` struct under `routers/api/v1/swagger` folder which
response should be defined in.

7 months agoTweak actions view sticky (#29781)
silverwind [Thu, 14 Mar 2024 04:30:10 +0000 (05:30 +0100)]
Tweak actions view sticky (#29781)

Add some space when the left side items are sticky due to scrolling the
right side.

<img width="419" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/292e1b03-a071-4744-bb79-e50d109056c8">

7 months agoadd skip ci support for pull request title (#29774)
Denys Konovalov [Thu, 14 Mar 2024 03:18:04 +0000 (04:18 +0100)]
add skip ci support for pull request title (#29774)

Extends #28075 to support [skip ci] inside PR titles.

Close #29265

7 months agoRefactor markup/csv: don't read all to memory (#29760)
coldWater [Thu, 14 Mar 2024 02:51:55 +0000 (10:51 +0800)]
Refactor markup/csv: don't read all to memory (#29760)

7 months agoFix `make generate-swagger` in go 1.22 (#29780)
silverwind [Thu, 14 Mar 2024 02:23:58 +0000 (03:23 +0100)]
Fix `make generate-swagger` in go 1.22 (#29780)

Fixes: https://github.com/go-gitea/gitea/issues/29664. No release
available for https://github.com/go-swagger/go-swagger/issues/3070 so
let's depend on latest commit hash. Output is the same as before for me.

7 months agoFix incorrect menu/link on webhook edit page (#29709)
yp05327 [Thu, 14 Mar 2024 01:37:15 +0000 (10:37 +0900)]
Fix incorrect menu/link on webhook edit page (#29709)

Fix #29699

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoAdd test for webhook (#29755)
wxiaoguang [Thu, 14 Mar 2024 01:10:51 +0000 (09:10 +0800)]
Add test for webhook (#29755)

Follow #29690

7 months agoFix possible NPE in ToPullReviewList (#29759)
Lunny Xiao [Wed, 13 Mar 2024 19:46:15 +0000 (03:46 +0800)]
Fix possible NPE in ToPullReviewList (#29759)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agofix missed RenderLabel change in card template (#29772)
6543 [Wed, 13 Mar 2024 18:00:38 +0000 (19:00 +0100)]
fix missed RenderLabel change in card template (#29772)

regression of #29680
close  #29770

PS: it would be nice to have a linter that is able to check template
helpers ...

7 months agoFix incorrect locale Tr for gpg command (#29754)
wxiaoguang [Wed, 13 Mar 2024 16:24:34 +0000 (00:24 +0800)]
Fix incorrect locale Tr for gpg command (#29754)

7 months agoImprove a11y document and dropdown item (#29753)
wxiaoguang [Wed, 13 Mar 2024 13:44:46 +0000 (21:44 +0800)]
Improve a11y document and dropdown item (#29753)

Co-authored-by: silverwind <me@silverwind.io>
7 months agoImprove QueryEscape helper function (#29768)
wxiaoguang [Wed, 13 Mar 2024 13:32:30 +0000 (21:32 +0800)]
Improve QueryEscape helper function (#29768)

Make it return "template.URL" to follow Golang template's context
auto-escaping.

7 months agoUse relative links for commits, mentions, and issues in markdown (#29427)
KN4CK3R [Wed, 13 Mar 2024 10:34:58 +0000 (11:34 +0100)]
Use relative links for commits, mentions, and issues in markdown (#29427)

Fixes #29404

Use relative links for
- commits
- mentions
- issues

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoMove fork router functions to a standalone file (#29756)
Lunny Xiao [Wed, 13 Mar 2024 10:07:53 +0000 (18:07 +0800)]
Move fork router functions to a standalone file (#29756)

To reduce the pull.go file's size.

7 months agoConfigure pinned JS dependencies via updates.config.js (#29696)
silverwind [Wed, 13 Mar 2024 08:43:58 +0000 (09:43 +0100)]
Configure pinned JS dependencies via updates.config.js (#29696)

Split out from https://github.com/go-gitea/gitea/pull/29684. This
configures the [`updates`](https://github.com/silverwind/updates) module
to exclude these modules for reasons stated in the comments.

7 months agoRefactor to use optional.Option for issue index search option (#29739)
6543 [Wed, 13 Mar 2024 08:25:53 +0000 (09:25 +0100)]
Refactor to use optional.Option for issue index search option (#29739)

Signed-off-by: 6543 <6543@obermui.de>
7 months agoFix user router possbile panic (#29751)
Lunny Xiao [Wed, 13 Mar 2024 06:57:30 +0000 (14:57 +0800)]
Fix user router possbile panic (#29751)

regression from #28023

7 months agoRefactor label.IsArchived() (#29750)
6543 [Wed, 13 Mar 2024 06:04:07 +0000 (07:04 +0100)]
Refactor label.IsArchived() (#29750)

just some missed nits

7 months agoFix date rendering by adding `<gitea-absolute-date>` (#29725)
silverwind [Tue, 12 Mar 2024 22:37:02 +0000 (23:37 +0100)]
Fix date rendering by adding `<gitea-absolute-date>` (#29725)

Alternative to: https://github.com/go-gitea/gitea/pull/29698
Fixes: https://github.com/go-gitea/gitea/issues/29034
<img width="278" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/12ecd967-2723-410d-8a28-a1b0f41b7bba">

It also fixes a secondary issue that we were showing timestamp tooltips
over date, which makes no sense, so these are now gone as well:

<img width="284" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/a70432f3-97b6-41e6-b202-b53b76924a66">

7 months agoUpdate to labeler v5 (#29721)
Denys Konovalov [Tue, 12 Mar 2024 22:09:02 +0000 (23:09 +0100)]
Update to labeler v5 (#29721)

Updated to actions/labeler@v5

Updated labeler config accordingly, also improved the config and added
more labels.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoUpdate Chroma to v2.13.0 (#29732)
JakobDev [Tue, 12 Mar 2024 21:40:43 +0000 (22:40 +0100)]
Update Chroma to v2.13.0 (#29732)

This adds new lexers and includes some fixes. See
https://github.com/alecthomas/chroma/releases/tag/v2.13.0 for the full
changelog.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoHighlight archived labels (#29680)
6543 [Tue, 12 Mar 2024 17:32:05 +0000 (18:32 +0100)]
Highlight archived labels (#29680)

the issue is, that you can not distinguish between normal and archived
labels.

So this will make archived labels 80% **grayscale**. And prepend
"Archived: " to the tooltip info

![image](https://github.com/go-gitea/gitea/assets/24977596/fd77c4d2-eff5-4afd-9bfa-19cb9991c5e7)

![image](https://github.com/go-gitea/gitea/assets/24977596/2e0f30e5-f301-4c9c-8e9f-677298d90b27)

![image](https://github.com/go-gitea/gitea/assets/24977596/53d70abf-b306-453d-aa95-a3a035b19a33)

![image](https://github.com/go-gitea/gitea/assets/24977596/6020e5f5-2364-4807-979f-37dffa8735e5)

---
*Sponsored by Kithara Software GmbH*

---------

Co-authored-by: delvh <dev.lh@web.de>
7 months agoAdd more stats tables (#29730)
Lunny Xiao [Tue, 12 Mar 2024 11:21:09 +0000 (19:21 +0800)]
Add more stats tables (#29730)

Add `Tags`, `Branches` and `CommitStatus` to monitor/stats

7 months agoUse Get but not Post to get actions artifacts (#29734)
Lunny Xiao [Tue, 12 Mar 2024 10:53:53 +0000 (18:53 +0800)]
Use Get but not Post to get actions artifacts (#29734)

7 months agoDo some performance optimize for issues list and view issue/pull (#29515)
Lunny Xiao [Tue, 12 Mar 2024 07:23:44 +0000 (15:23 +0800)]
Do some performance optimize for issues list and view issue/pull (#29515)

This PR do some performance optimzations.

- [x] Add `index` for the column `comment_id` of `Attachment` table to
accelerate query from the database.
- [x] Remove unnecessary database queries when viewing issues. Before
some conditions which id = 0 will be sent to the database
- [x] Remove duplicated load posters
- [x] Batch loading attachements, isread of comments on viewing issue

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
7 months agoSome performance optimization on dashboard and issues page (#29010)
Lunny Xiao [Tue, 12 Mar 2024 04:57:19 +0000 (12:57 +0800)]
Some performance optimization on dashboard and issues page (#29010)

This PR do some loading speed optimization for feeds user interface
pages.
- Load action users batchly but not one by one.
- Load action repositories batchly but not one by one.
- Load action's Repo Owners batchly but not one by one.
- Load action's possible issues batchly but not one by one.
- Load action's possible comments batchly but not one by one.

7 months agoRemove jQuery AJAX from the issue branch reference selection (#29722)
Yarden Shoham [Tue, 12 Mar 2024 04:29:51 +0000 (06:29 +0200)]
Remove jQuery AJAX from the issue branch reference selection (#29722)

- Replaced a single jQuery AJAX instance with our fetch wrapper
- Tested the issue branch reference selection and it works as before

# Demo using `fetch` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/7e195632-41f8-494b-b599-f6291860f330)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
7 months agoLazy load object format with command line and don't do it in OpenRepository (#29712)
Lunny Xiao [Tue, 12 Mar 2024 04:21:27 +0000 (12:21 +0800)]
Lazy load object format with command line and don't do it in OpenRepository (#29712)

Most time, when invoking `git.OpenRepository`, `objectFormat` will not
be used, so it's a waste to invoke commandline to get the object format.
This PR make it a lazy operation, only invoke that when necessary.

7 months agoremove repetitive words (#29695)
pengqiseven [Mon, 11 Mar 2024 09:24:23 +0000 (17:24 +0800)]
remove repetitive words (#29695)

Signed-off-by: pengqiseven <912170095@qq.com>
7 months agoSync branches first (#29714)
Jason Song [Mon, 11 Mar 2024 06:42:50 +0000 (14:42 +0800)]
Sync branches first (#29714)

Follow #29493.

Sync branches to DB first, then trigger push events.

7 months agoAdd a warning for disallowed email domains (#29658)
Zettat123 [Mon, 11 Mar 2024 06:07:36 +0000 (14:07 +0800)]
Add a warning for disallowed email domains (#29658)

Resolve #29660

Follow #29522 and #29609

Add a warning for disallowed email domains when admins manually add/edit
users.

Thanks @yp05327 for the
[comment](https://github.com/go-gitea/gitea/pull/29605#issuecomment-1980105119)

![image](https://github.com/go-gitea/gitea/assets/15528715/6737b221-a3a2-4180-9ef8-b846c10f96e0)

7 months agoFix inconsistent rendering of block mathematical expressions (#29677)
yp05327 [Mon, 11 Mar 2024 05:00:50 +0000 (14:00 +0900)]
Fix inconsistent rendering of block mathematical expressions (#29677)

Fix #28735

GitHub render `\```math\``` ` as a block now.
Add `display` class will render it as a block.

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/2a1c20c7-438e-4ab1-8c66-cf91c8343087)

![image](https://github.com/go-gitea/gitea/assets/18380374/b81b8a93-8bca-46a5-b7db-e0d2f53e1342)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoUse repo object format name instead of detecting from git repository (#29702)
Lunny Xiao [Sun, 10 Mar 2024 21:30:36 +0000 (05:30 +0800)]
Use repo object format name instead of detecting from git repository (#29702)

It's unnecessary to detect the repository object format from git
repository. Just use the repository's object format name.

7 months agoImprove CSV rendering (#29638)
silverwind [Sun, 10 Mar 2024 19:28:59 +0000 (20:28 +0100)]
Improve CSV rendering (#29638)

Before:

<img width="1332" alt="Screenshot 2024-03-06 at 21 42 17"
src="https://github.com/go-gitea/gitea/assets/115237/0ea07eee-31f8-4783-bd56-37bd8396f00d">

After:
<img width="1336" alt="Screenshot 2024-03-06 at 21 41 58"
src="https://github.com/go-gitea/gitea/assets/115237/eb7f9cc9-587f-4e3b-92bd-cc67ca639963">

7 months agoRemove jQuery AJAX from the comment edit history (#29703)
Yarden Shoham [Sun, 10 Mar 2024 19:26:41 +0000 (21:26 +0200)]
Remove jQuery AJAX from the comment edit history (#29703)

- Removed all jQuery AJAX calls and replaced with our fetch wrapper
- Tested the comment edit history list, diff, and delete functionality
and it works as before

# Demo using `fetch` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/e8c557bc-f2b9-4d73-b55e-0850c1b19364)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
7 months agofix: rendering internal file links in org (#29669)
Ankit R Gadiya [Sun, 10 Mar 2024 16:30:14 +0000 (22:00 +0530)]
fix: rendering internal file links in org (#29669)

The internal links to other files in the repository were not rendering
with the Src Prefix (/src/branch-name/file-path). This commit fixes that
by using the `SrcLink` as base if available.

Resolves #29668

7 months agoFix broken webhooks (#29690)
Lunny Xiao [Sun, 10 Mar 2024 01:32:48 +0000 (09:32 +0800)]
Fix broken webhooks (#29690)

Fix #29689

7 months agoSuppress error from monaco-editor (#29684)
silverwind [Sat, 9 Mar 2024 17:37:29 +0000 (18:37 +0100)]
Suppress error from monaco-editor (#29684)

Fixes: https://github.com/go-gitea/gitea/issues/29414
I see no way for us to catch this error, so downgrade it until
https://github.com/microsoft/monaco-editor/issues/4325 is fixed, which
will likely take a few weeks to propagate up from vscode.

The entries in `updates.config.js` will make
[`updates`](https://github.com/silverwind/updates) not upgrade these
anymore and I think it's good documentation as well to have the reasons
why we don't upgrade these dependencies.

7 months agoFix action runner offline label padding (#29691)
Chongyi Zheng [Sat, 9 Mar 2024 13:13:08 +0000 (08:13 -0500)]
Fix action runner offline label padding (#29691)

Before:

The `offline` padding is `calc(.833em - 1px)` from `basic` CSS class,
but `idle` padding is `6px`.

<img width="1035" alt="image"
src="https://github.com/go-gitea/gitea/assets/37034805/ccb42615-20d7-4032-a805-40cd9643012d">

After:

<img width="1035" alt="image"
src="https://github.com/go-gitea/gitea/assets/37034805/d6af99c8-76cb-4850-96d6-5289b06e1ca8">

7 months agoUpdate allowed attachment types (#29688)
silverwind [Sat, 9 Mar 2024 12:41:32 +0000 (13:41 +0100)]
Update allowed attachment types (#29688)

Update to match GitHub's latest.

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoCompletely style the webkit autofill (#29683)
silverwind [Sat, 9 Mar 2024 12:14:42 +0000 (13:14 +0100)]
Completely style the webkit autofill (#29683)

Previously it was only partially styled, e.g. there was black text on
white background even in dark theme caused by fomantic styles.

<img width="195" alt="image"
src="https://github.com/go-gitea/gitea/assets/115237/bc5cf516-2aef-45c3-854a-c9f5497aacca">

<img width="195" alt="Screenshot 2024-03-09 at 02 09 29"
src="https://github.com/go-gitea/gitea/assets/115237/ef0af17d-6e0b-402e-b24d-bfa34dc2f4e0">

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoInclude go files in tailwind processing (#29686)
silverwind [Sat, 9 Mar 2024 12:09:22 +0000 (13:09 +0100)]
Include go files in tailwind processing (#29686)

We need to scan `.go` files for tailwind classes. Does not seem to
affect build time much luckily.

Fixes:
https://github.com/go-gitea/gitea/pull/29678#discussion_r1518448600

Verified via `rg tw-object-contain public/assets/css/index.css`.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoFix WebHookEditor regression from jQuery removal (#29692)
Yarden Shoham [Sat, 9 Mar 2024 11:59:16 +0000 (13:59 +0200)]
Fix WebHookEditor regression from jQuery removal (#29692)

Make these calls optional

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
7 months agoPatch in exact search for meilisearch (#29671)
6543 [Sat, 9 Mar 2024 01:39:27 +0000 (02:39 +0100)]
Patch in exact search for meilisearch (#29671)

meilisearch does not have an search option to contorl fuzzynes per query
right now:
 - https://github.com/meilisearch/meilisearch/issues/1192
 - https://github.com/orgs/meilisearch/discussions/377
 - https://github.com/meilisearch/meilisearch/discussions/1096

so we have to create a workaround by post-filter the search result in
gitea until this is addressed.

For future works I added an option in backend only atm, to enable
fuzzynes for issue indexer too.
And also refactored the code so the fuzzy option is equal in logic to
code indexer

---
*Sponsored by Kithara Software GmbH*

7 months agoUse more specific selector for `name` links (#29679)
silverwind [Fri, 8 Mar 2024 23:21:45 +0000 (00:21 +0100)]
Use more specific selector for `name` links (#29679)

Followup https://github.com/go-gitea/gitea/pull/29305. As per discussion
in https://github.com/go-gitea/gitea/pull/29666#discussion_r1517506422,
make this selector only search in the current `.markup` document, as
there can be multiples displayed at the same time.

@DanielMatiasCarvalho maybe you can review.

7 months agoReplace more gt- with tw- (#29678)
silverwind [Fri, 8 Mar 2024 21:02:05 +0000 (22:02 +0100)]
Replace more gt- with tw- (#29678)

This will conclude the trivial class replacements.

7 months agoFix commit_status problem when testing (#29672)
charles [Fri, 8 Mar 2024 15:43:48 +0000 (23:43 +0800)]
Fix commit_status problem when testing (#29672)

Close #29661

fix #29656

Co-authored-by: Giteabot <teabot@gitea.io>
7 months agoSupport pasting URLs over markdown text (#29566)
silverwind [Fri, 8 Mar 2024 15:15:58 +0000 (16:15 +0100)]
Support pasting URLs over markdown text (#29566)

Support pasting URLs over selection text in the textarea editor. Does
not work in EasyMDE and I don't intend to support it. Image paste works
as usual in both Textarea and EasyMDE.

The new `replaceTextareaSelection` function changes textarea content via
[`insertText`](https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand#using_inserttext)
command, which preserves history, e.g. `CTRL-Z` works and is also
demostrated below. We should later refactor the image paste code to use
the same function because it currently destroys history.

Overriding the formatting via `Shift` key is supported as well, e.g.
`Ctrl+Shift+V` will insert the URL as-is, like on GitHub.

![urlpaste](https://github.com/go-gitea/gitea/assets/115237/522b1023-6797-401c-9e4a-498570adfc88)

7 months agobump python version to 3.12 in dev container (#29670)
yp05327 [Fri, 8 Mar 2024 15:10:01 +0000 (00:10 +0900)]
bump python version to 3.12 in dev container (#29670)

![image](https://github.com/go-gitea/gitea/assets/18380374/963dc021-ac9b-4713-8344-654f966c80a4)

The default version is 3.9.2, which is not supported by poetry.

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoAdd cache for branch divergence on branch list page (#29577)
Lunny Xiao [Fri, 8 Mar 2024 10:21:24 +0000 (18:21 +0800)]
Add cache for branch divergence on branch list page (#29577)

The branch page for blender project will take 6s because calculating
divergence is very slow.
This PR will add a cache for the branch divergence calculation. So when
the second visit the branch list, it will take only less 200ms.

7 months agoFix user-defined markup links targets (#29305)
DC [Fri, 8 Mar 2024 09:53:01 +0000 (09:53 +0000)]
Fix user-defined markup links targets (#29305)

This seeks to fix the bug reported on issue #29196.

Cause:
ID's with custom characters (- , _ , etc.), were not linking correctly
in the Markdown file when rendered in the browser because the ID in the
respective destinies would be different than the one in anchor, while
for IDs with only letters, the ID would be the same.

Fix:
It was suggested that to fix this bug, it should more or less like
GitHub does it. While in gitea the anchors would be put in HTML like
this:
```
<p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p>
<p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p>
<p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p>
<p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p>
<p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p>

```
In GitHub, the same anchor's href properties would be the same without
"user-content-" trailing behind.

So my code made sure to change those anchors, so it would not include
"user-content-" and then add respective Event Listeners so it would
scroll into the supposed places.

Fixes: #29196
---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoDon't show AbortErrors on logout (#29639)
silverwind [Fri, 8 Mar 2024 09:47:32 +0000 (10:47 +0100)]
Don't show AbortErrors on logout (#29639)

When logging out of Gitea, a error toast can be seen for a split second.
I don't know why or how it happens but I found it it's an `AbortError`
(related to
[AbortController#abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)),
so let's hide it.

7 months agoStyle fomantic grey labels (#29458)
silverwind [Fri, 8 Mar 2024 09:42:12 +0000 (10:42 +0100)]
Style fomantic grey labels (#29458)

Fomantic grey labels in the dashboard repo lists were showing original
fomantic colors, fixed that. Also slightly tweaked the light theme
colors so it uses same opacity values as dark theme.

<img width="165" alt="Screenshot 2024-03-07 at 21 06 23"
src="https://github.com/go-gitea/gitea/assets/115237/72744d6f-2ee1-4e5d-8ba0-b482a446f535">
<img width="167" alt="Screenshot 2024-03-07 at 21 06 00"
src="https://github.com/go-gitea/gitea/assets/115237/1ba93775-e5a9-4b28-b90f-59c1e9199687">

7 months agoDon't use `<br />` in alert block (#29650)
Yarden Shoham [Fri, 8 Mar 2024 09:30:41 +0000 (11:30 +0200)]
Don't use `<br />` in alert block (#29650)

- Follows https://github.com/go-gitea/gitea/pull/29121

When I implemented alert blocks I was always testing the markdown in
issue comments. I used `<br />` for line breaks and it looked good. I
have since learned that the markdown on README files doesn't allow these
tags. So a comment with

```md
> [!NOTE]
> If you're interested in using our APIs, we have experimental support with [documentation](https://try.gitea.io/api/swagger).
```

looked like this in a comment

![image](https://github.com/go-gitea/gitea/assets/20454870/96b1de01-2c87-4d4f-83dd-98192b83e9d0)
but looked like this in a README

![image](https://github.com/go-gitea/gitea/assets/20454870/474b636d-dd7a-4b7f-ba27-643803c71aa3)

So I changed how we render the alert block by having the alert itself
have a dedicated paragraph, so line breaks happen naturally between
paragraphs.

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/474b636d-dd7a-4b7f-ba27-643803c71aa3)

![image](https://github.com/go-gitea/gitea/assets/20454870/167a8d37-9a44-4479-9340-5dc80347b595)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/2f99fec0-98ff-4ba8-97fe-b4567041ae79)

![image](https://github.com/go-gitea/gitea/assets/20454870/ffdeae11-fb06-4d00-b497-eae135f0d7ad)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoFix incorrect rendering csv file when file size is larger than UI.CSV.MaxFileSize...
yp05327 [Fri, 8 Mar 2024 08:44:50 +0000 (17:44 +0900)]
Fix incorrect rendering csv file when file size is larger than UI.CSV.MaxFileSize (#29653)

Fix #29506

7 months agoSet user's 24h preference from their current OS locale (#29651)
silverwind [Fri, 8 Mar 2024 07:57:52 +0000 (08:57 +0100)]
Set user's 24h preference from their current OS locale (#29651)

Fixes: https://github.com/go-gitea/gitea/issues/28371
Fixed by using a JS solution that formats according to `lang`, but alters the 24h format setting as per user's locale. This will work for all tooltips:

<img width="243" alt="Screenshot 2024-03-07 at 23 03 35" src="https://github.com/go-gitea/gitea/assets/115237/6d16c71c-6786-4eda-8cdc-50ec68ba62c6">
<img width="250" alt="Screenshot 2024-03-07 at 23 03 17" src="https://github.com/go-gitea/gitea/assets/115237/4e26bbb7-12df-4b81-bd37-14705e87e8f7">
<img width="310" alt="Screenshot 2024-03-07 at 23 14 34" src="https://github.com/go-gitea/gitea/assets/115237/1ef599f0-6401-4e19-b1da-59cdfc09b0f6">

I think there is only one other place in the UI where we render such absolute dates, which is in the actions view and which I've also fixed:

<img width="275" alt="Screenshot 2024-03-07 at 23 04 00" src="https://github.com/go-gitea/gitea/assets/115237/df0fbe1f-96ee-4338-ab5e-2b10e215005d">

7 months agoMove get/set default branch from git package to gitrepo package to hide repopath...
Lunny Xiao [Fri, 8 Mar 2024 07:30:10 +0000 (15:30 +0800)]
Move get/set default branch from git package to gitrepo package to hide repopath (#29126)

7 months agoMake runs-on support variable expression (#29468)
sillyguodong [Fri, 8 Mar 2024 06:14:35 +0000 (14:14 +0800)]
Make runs-on support variable expression (#29468)

As title.
Close issue: https://gitea.com/gitea/act_runner/issues/445
Follow: https://gitea.com/gitea/act/pulls/91

Move `getSecretsOfTask` and `getVariablesOfTask` under `models` because
of circular dependency issues.

7 months agoFilter for default-branch selection (#29388)
Tim-Niclas Oelschläger [Fri, 8 Mar 2024 05:36:27 +0000 (06:36 +0100)]
Filter for default-branch selection (#29388)

Filter for default-branch selection (fixes #4751)

before:

![image](https://github.com/go-gitea/gitea/assets/72873130/dcae266d-2e04-41bf-8739-64a85c9007f6)

after:

![image](https://github.com/go-gitea/gitea/assets/72873130/5f27c0a7-1d30-4ccd-b4bb-6c34fff1b79f)

---------

Co-authored-by: silverwind <me@silverwind.io>
7 months agoFixing the issue when status check per rule matches multiple actions (#29631)
charles [Fri, 8 Mar 2024 05:02:13 +0000 (13:02 +0800)]
Fixing the issue when status check per rule matches multiple actions (#29631)

Close #29628
rule
```
Test / Build*
Test / Build *
Test / Build 2*
Test / Build 1*
```

![image](https://github.com/go-gitea/gitea/assets/30816317/19bef0a9-fa97-43c5-887b-dece76064aa8)
rule2
```
Test / Build*
Test / Build 1*
```

![image](https://github.com/go-gitea/gitea/assets/30816317/19bef0a9-fa97-43c5-887b-dece76064aa8)

rule3
```
Test / Build*
Test / Build 1*
NotExist*
```

![image](https://github.com/go-gitea/gitea/assets/30816317/f6a5e832-2e1b-4049-915b-45bec5ef070c)

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
7 months agoFix 500 when deleting account with incorrect password or unsupported login type ...
Lunny Xiao [Fri, 8 Mar 2024 04:28:21 +0000 (12:28 +0800)]
Fix 500 when deleting account with incorrect password or unsupported login type (#29579)

Fix #26210

---------

Co-authored-by: Jason Song <i@wolfogre.com>
7 months agoPartially enable MSSQL case-sensitive collation support (#29238)
wxiaoguang [Fri, 8 Mar 2024 03:19:35 +0000 (11:19 +0800)]
Partially enable MSSQL case-sensitive collation support (#29238)

Follow #28662

7 months agoStore webhook event in database (#29145)
oliverpool [Thu, 7 Mar 2024 22:18:38 +0000 (23:18 +0100)]
Store webhook event in database (#29145)

Refactor the webhook logic, to have the type-dependent processing happen
only in one place.

---

## Current webhook flow

1. An event happens
2. It is pre-processed (depending on the webhook type) and its body is
added to a task queue
3. When the task is processed, some more logic (depending on the webhook
type as well) is applied to make an HTTP request

This means that webhook-type dependant logic is needed in step 2 and 3.
This is cumbersome and brittle to maintain.

Updated webhook flow with this PR:
1. An event happens
2. It is stored as-is and added to a task queue
3. When the task is processed, the event is processed (depending on the
webhook type) to make an HTTP request

So the only webhook-type dependent logic happens in one place (step 3)
which should be much more robust.

## Consequences of the refactor

- the raw event must be stored in the hooktask (until now, the
pre-processed body was stored)
- to ensure that previous hooktasks are correctly sent, a
`payload_version` is added (version 1: the body has already been
pre-process / version 2: the body is the raw event)

So future webhook additions will only have to deal with creating an
http.Request based on the raw event (no need to adjust the code in
multiple places, like currently).

Moreover since this processing happens when fetching from the task
queue, it ensures that the queuing of new events (upon a `git push` for
instance) does not get slowed down by a slow webhook.

As a concrete example, the PR #19307 for custom webhooks, should be
substantially smaller:
- no need to change `services/webhook/deliver.go`
- minimal change in `services/webhook/webhook.go` (add the new webhook
to the map)
- no need to change all the individual webhook files (since with this
refactor the `*webhook_model.Webhook` is provided as argument)

7 months agoFix bug hidden on CI and make ci failed if tests failure (#29254)
Lunny Xiao [Thu, 7 Mar 2024 16:43:32 +0000 (00:43 +0800)]
Fix bug hidden on CI and make ci failed if tests failure (#29254)

The tests on migration tests failed but CI reports successfully

https://github.com/go-gitea/gitea/actions/runs/7364373807/job/20044685969#step:8:141

This PR will fix the bug on migration v283 and also the CI hidden
behaviour.

The reason is on the Makefile

`GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini $(GO) test
$(GOTESTFLAGS) -tags='$(TEST_TAGS)' $(MIGRATE_TEST_PACKAGES)` will
return the error exit code.

But

`for pkg in $(shell $(GO) list
code.gitea.io/gitea/models/migrations/...); do \
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mysql.ini $(GO) test
$(GOTESTFLAGS) -tags '$(TEST_TAGS)' $$pkg; \
done`

will not work.

This also fix #29602

7 months agoRemove jQuery AJAX from the repo editor (#29636)
Yarden Shoham [Thu, 7 Mar 2024 07:28:33 +0000 (09:28 +0200)]
Remove jQuery AJAX from the repo editor (#29636)

# Preview Tab
- Removed the jQuery AJAX call and replaced with our fetch wrapper
- Tested the preview tab functionality and it works as before

# Diff Tab
- Removed the jQuery AJAX call and replaced with htmx
- Tested the diff tab functionality and it works as before

## htmx Attributes
- `hx-post="{{.RepoLink}}..."`: make a POST request to the endpoint
- `hx-indicator=".tab[data-tab='diff']"`: attach the loading indicator
to the tab body
- `hx-target=".tab[data-tab='diff']"`: target the tab body for swapping
with the response
- `hx-swap="innerHTML"`: swap the target's inner HTML
- `hx-include="#edit_area"`: include the value of the textarea (content)
in the request body
- `hx-vals='{"context":"{{.BranchLink}}"}'`: include the context in the
request body
- `hx-params="context,content"`: include only these keys in the request
body

# Demo using `fetch` and `htmx` instead of jQuery AJAX

![demo](https://github.com/go-gitea/gitea/assets/20454870/585cd6e8-f329-4c9e-ab53-a540acbd7988)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
7 months agoUse strict protocol check when redirect (#29642)
wxiaoguang [Thu, 7 Mar 2024 02:03:41 +0000 (10:03 +0800)]
Use strict protocol check when redirect (#29642)