Commit graph

17704 commits

Author SHA1 Message Date
6543 7db422d989
Make optional.Option[T] type serializable (#29282)
make the generic `Option` type de-/serializable for json and yaml

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 53c7d8908e5ef35818b72b8c3d873b509269bc1a)
2024-02-26 22:30:26 +01:00
Yarden Shoham 7bf905a43c
Remove jQuery from the stopwatch (#29351)
- Switched to plain JavaScript
- Tested the stopwatch functionality and it works as before

# Demo using JavaScript without jQuery

![action](https://github.com/go-gitea/gitea/assets/20454870/c8e9a401-45e5-4a1d-a683-0d655f1d570e)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 12d233faf786a54579a33b99b3cd56586c279f56)
2024-02-26 22:30:26 +01:00
Zettat123 826bf12bb4
Fix tarball/zipball download bug (#29342)
Fix #29249

~~Use the `/repos/{owner}/{repo}/archive/{archive}` API to download.~~

Apply #26430 to archive download URLs.

(cherry picked from commit b762a1f1b1f7941a7db2207552d7b441d868cbe9)
2024-02-26 22:30:26 +01:00
Lunny Xiao 767e9634d3
Allow options to disable user deletion from the interface on app.ini (#29275)
Extract from #20549

This PR added a new option on app.ini `[admin]USER_DISABLED_FEATURES` to
allow the site administrator to disable users visiting deletion user
interface or allow.
This options are also potentially allowed to define more features in
future PRs.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 3ef6252e06a1f3981f8b7d1717bfc581418b1dc5)

Conflicts:
	custom/conf/app.example.ini
	docs/content/administration/config-cheat-sheet.en-us.md
	modules/setting/admin.go
	context
2024-02-26 22:30:26 +01:00
6543 8ff858b94b
Start to migrate from util.OptionalBool to optional.Option[bool] (#29329)
just create transition helper and migrate two structs

(cherry picked from commit 7fbdb60fc1152acc9a040dc04b1b0f5a3475b081)
2024-02-26 22:30:26 +01:00
Tim-Nicas Oelschläger 4b494d341f
Unify organizations header (#29248)
Unify organizations header

before:

![image](https://github.com/go-gitea/gitea/assets/72873130/74474e0d-33c3-4bbf-9324-d130ea2c62f8)

after:

![image](https://github.com/go-gitea/gitea/assets/72873130/1c65de0d-fa0f-4b17-ab8d-067de8c7113b)

---------

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 532e422027c88a4a3dc0c2968857f8d5f94d861f)

Conflicts:
	routers/web/shared/user/header.go
	templates/org/home.tmpl
	context
2024-02-26 22:30:26 +01:00
silverwind 643d66ee0e
Upgrade to fabric 6 (#29334)
Upgrade fabric to latest v6 beta. It works for our use case, even
thought it does not fix the upstream issue
https://github.com/fabricjs/fabric.js/issues/9679 that
https://github.com/go-gitea/gitea/issues/29326 relates to.

(cherry picked from commit c4b0cb4d0d527793296cf801e611f77666f86551)

Conflicts:
	public/assets/img/favicon.svg
	public/assets/img/logo.svg
2024-02-26 22:30:26 +01:00
silverwind c432f141bb
Don't show third-party JS errors in production builds (#29303)
So we don't get issues like
https://github.com/go-gitea/gitea/issues/29080 and
https://github.com/go-gitea/gitea/issues/29273 any more. Only active in
[production
builds](https://webpack.js.org/guides/production/#specify-the-mode), in
non-production the errors will still show.

(cherry picked from commit 532da5ed5ee3edb45d2ee63c6ab0fad53473691f)
2024-02-26 22:30:26 +01:00
Lunny Xiao 44f45d8b72
Ignore the linux anchor point to avoid linux migrate failure (#29295)
Fix #28843

This PR will bypass the pushUpdateTag to database failure when
syncAllTags. An error log will be recorded.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 5ed17d9895bf678374ef5227ca37870c1c170802)
2024-02-26 22:30:26 +01:00
Yarden Shoham 6db296f1cb
Remove jQuery from the repo commit functions (#29230)
- Switched to plain JavaScript
- Tested the commit ellipsis button functionality and it works as before
- Tested the commits statuses tippy functionality and it works as before
- Tested the last commit loader functionality and it works as before

# Demo using JavaScript without jQuery

![action](https://github.com/go-gitea/gitea/assets/20454870/465516f8-0ff3-438c-a17e-26cbab82750b)

![action](https://github.com/go-gitea/gitea/assets/20454870/968da210-9382-4b50-a4c2-09419dc86e07)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit eaede2de98fbe0ac2156c9f4cd8b5899d2c7cbbf)
2024-02-26 22:30:26 +01:00
wxiaoguang 60447a7097
Remove unnecessary "Safe" modifier from templates (#29318)
Follow #29165

(cherry picked from commit 7a1557d2cc893030ae900c4333eeb12d84b891dc)

Conflicts:
	templates/package/content/alpine.tmpl
	templates/package/content/cargo.tmpl
	templates/package/content/chef.tmpl
	templates/package/content/composer.tmpl
	templates/package/content/conan.tmpl
	templates/package/content/conda.tmpl
	templates/package/content/container.tmpl
	templates/package/content/cran.tmpl
	templates/package/content/debian.tmpl
	templates/package/content/generic.tmpl
	templates/package/content/go.tmpl
	templates/package/content/helm.tmpl
	templates/package/content/maven.tmpl
	templates/package/content/npm.tmpl
	templates/package/content/nuget.tmpl
	templates/package/content/pub.tmpl
	templates/package/content/pypi.tmpl
	templates/package/content/rpm.tmpl
	templates/package/content/rubygems.tmpl
	templates/package/content/swift.tmpl
	templates/package/content/vagrant.tmpl
	templates/package/shared/cargo.tmpl
	templates/package/shared/list.tmpl
	templates/repo/code/recently_pushed_new_branches.tmpl
	templates/repo/issue/view_content/comments.tmpl
	templates/status/404.tmpl
	templates/user/settings/packages.tmpl
	context
2024-02-26 22:30:26 +01:00
Yarden Shoham 01fa6fbb97
Remove jQuery from the image pasting functionality (#29324)
- Switched to plain JavaScript
- Tested the image pasting functionality and it works as before

# Demo using JavaScript without jQuery

![demo](https://github.com/go-gitea/gitea/assets/20454870/018993ff-7b09-4d5f-88e0-f276368bacd6)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit f390d5eb4f4db21eeacdf2e7a093f6bd4e87c96f)
2024-02-26 22:30:26 +01:00
Zettat123 ff5df5fc97
Improve the issue_comment workflow trigger event (#29277)
Fix #29175
Replace #29207

This PR makes some improvements to the `issue_comment` workflow trigger
event.

1. Fix the bug that pull requests cannot trigger `issue_comment`
workflows
2. Previously the `issue_comment` event only supported the `created`
activity type. This PR adds support for the missing `edited` and
`deleted` activity types.
3. Some events (including `issue_comment`, `issues`, etc. ) only trigger
workflows that belong to the workflow file on the default branch. This
PR introduces the `IsDefaultBranchWorkflow` function to check for these
events.

(cherry picked from commit a4fe1cdf38f9a063e44b197ef07e4260f731c919)

Conflicts:
	modules/actions/github.go
	context
2024-02-26 22:30:26 +01:00
Sebastian Brückner 542badbb76
Properly migrate automatic merge GitLab comments (#27873)
GitLab generates "system notes" whenever an event happens within the
platform. Unlike Gitea, those events are stored and retrieved as text
comments with no semantic details. The only way to tell whether a
comment was generated in this manner is the `system` flag on the note
type.

This PR adds detection for two specific kinds of events: Scheduling and
un-scheduling of automatic merges on a PR. When detected, they are
downloaded using Gitea's type for these events, and eventually uploaded
into Gitea in the expected format, i.e. with no text content in the
comment.

This PR also updates the template used to render comments to add support
for migrated comments of these two types.

ref:
11bd6dc826/app/services/system_notes/merge_requests_service.rb (L6-L17)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit a70c00b80bcb5de8479e407f1b8f08dcf756019d)
2024-02-26 22:30:26 +01:00
wxiaoguang 7906838669
Refactor cmd setup and remove deadcode (#29313)
* use `setup(ctx, c.Bool("debug"))` like all other callers
* `setting.RunMode = "dev"` is a no-op.
* `if _, err := os.Stat(setting.RepoRootPath); err != nil` could be
simplified

(cherry picked from commit e9b13732f3d3b5536e43bdfdb5757dbbf484d694)
2024-02-26 22:30:25 +01:00
KN4CK3R 9debff3b71
Discard unread data of git cat-file (#29297)
Fixes #29101
Related #29298

Discard all read data to prevent misinterpreting existing data. Some
discard calls were missing in error cases.

---------

Co-authored-by: yp05327 <576951401@qq.com>
(cherry picked from commit d6811baf88ca6d58b92d4dc12b1f2a292198751f)
2024-02-26 22:30:25 +01:00
silverwind 3591d9bff9
Don't install playwright twice (#29302)
1. `playwright/test` is already installed as part of `deps-frontend` on
CI which runs before, so it's better to not install it again (on a
potentially different version), and just use the version from
package.json and add the `deps-frontend` dependency.
2. `PLAYWRIGHT_DIR` is a undefined variable, so I removed it

```bash
$ git show c8ded77680 | grep PLAYWRIGHT_DIR
+playwright: $(PLAYWRIGHT_DIR)
```

(cherry picked from commit c236e64aca42b9ab0743431bc505033a0cb78b93)
2024-02-26 22:30:25 +01:00
GiteaBot 0f793ef6b9
[skip ci] Updated translations via Crowdin
(cherry picked from commit 2bd999a28b472f2909f6856740cdc712eb0ad136)

Conflicts:
	options/locale/locale_fr-FR.ini
	options/locale/locale_ja-JP.ini
	options/locale/locale_pt-PT.ini
	options/locale/locale_ru-RU.ini
	options/locale/locale_zh-CN.ini
        removal of
         runs.no_workflows.quick_start=
         runs.no_workflows.documentation=
2024-02-26 22:30:25 +01:00
KN4CK3R 5f79550a0d
Prevent double use of git cat-file session. (#29298)
Fixes the reason why #29101 is hard to replicate.
Related #29297

Create a repo with a file with minimum size 4097 bytes (I use 10000) and
execute the following code:
```go
gitRepo, err := gitrepo.OpenRepository(db.DefaultContext, <repo>)
assert.NoError(t, err)

commit, err := gitRepo.GetCommit(<sha>)
assert.NoError(t, err)

entry, err := commit.GetTreeEntryByPath(<file>)
assert.NoError(t, err)

b := entry.Blob()

// Create a reader
r, err := b.DataAsync()
assert.NoError(t, err)
defer r.Close()

// Create a second reader
r2, err := b.DataAsync()
assert.NoError(t, err) // Should be no error but is ErrNotExist
defer r2.Close()
```

The problem is the check in `CatFileBatch`:

79217ea63c/modules/git/repo_base_nogogit.go (L81-L87)
`Buffered() > 0` is used to check if there is a "operation" in progress
at the moment. This is a problem because we can't control the internal
buffer in the `bufio.Reader`. The code above demonstrates a sequence
which initiates an operation for which the code thinks there is no
active processing. The second call to `DataAsync()` therefore reuses the
existing instances instead of creating a new batch reader.

(cherry picked from commit f74c869221624092999097af38b6f7fae4701420)
2024-02-26 22:30:25 +01:00
Lunny Xiao c88ae2e382
Revert #28753 because UI broken. (#29293)
Revert #29255
Revert #28753

(cherry picked from commit e6e50696b83164805bec83a1b20c95a85a4dd7e5)
2024-02-26 22:30:25 +01:00
Zettat123 321aaedc4e
Fix error display when merging PRs (#29288)
Partially fix #29071, regression of Modernize merge button #28140

Fix some missing `Redirect` -> `JSONRedirect`.

Thanks @yp05327 for the help in
https://github.com/go-gitea/gitea/issues/29071#issuecomment-1931261075

(cherry picked from commit 79217ea63c1f77de7ca79813ae45950724e63d02)
2024-02-26 22:30:25 +01:00
Yarden Shoham 769db26c5a
Remove jQuery from the installation page (#29284)
- Switched to plain JavaScript
- Tested the installation page functionality and it works as before

# Demo using JavaScript without jQuery

![action](https://github.com/go-gitea/gitea/assets/20454870/286475b3-1919-4d99-b790-def10fa36e66)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
(cherry picked from commit 4e536edaead97d61a64508db0e93cf781a889472)
2024-02-26 22:30:25 +01:00
wxiaoguang 2c8f112c1c
Always write proc-receive hook for all git versions (#29287)
(cherry picked from commit 7f45dfb030f30a3ada58e636e3b8bfde391224bd)
2024-02-26 22:30:25 +01:00
Earl Warren d3a642a7e0
Revert "[BUG] Initalize Git for hook regeneration"
This reverts commit 815abad84c.

Redundant with:

 Always write proc-receive hook for all git versions (#29287)
2024-02-26 22:30:25 +01:00
Jason Song 52bf6bf60c
Do not use ctx.Doer when reset password (#29289)
Fix #29278.

Caused by a small typo in #28733

(cherry picked from commit 22b8de85ddda50725480b21c5bf6ef9c0202b5e9)
2024-02-26 21:42:15 +01:00
DC f803c5c0f4
Update Discord logo (#29285)
Fixes #27057 by changing the discord .svg file and running `make svg`.

Before:

<img width="637"
src="https://private-user-images.githubusercontent.com/85847352/267667100-1eaf5d20-b4e9-4736-bb55-7f1da04bbde7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDg0NzAwNDUsIm5iZiI6MTcwODQ2OTc0NSwicGF0aCI6Ii84NTg0NzM1Mi8yNjc2NjcxMDAtMWVhZjVkMjAtYjRlOS00NzM2LWJiNTUtN2YxZGEwNGJiZGU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjIwVDIyNTU0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIwN2Y2ODc5N2MzZDU5NzgzODRhNDIzZWY3MDk3ODhiYmIzZDU4NWVlYmFmZjc2OTIyZjE3MWM4ZDg0ODZjNTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.C6jVQLFPfq4fhGV8wiY9D-P21PUNTDMkX2d2-kU17Ug">

After:

<img width="637"
src="https://github.com/go-gitea/gitea/assets/106393991/45b197ae-e422-42f4-999e-25dc8f6b7a92">

(cherry picked from commit 3d3c3d9ee5e934c515370d98f1c552ca8ef10f8a)
2024-02-26 21:42:15 +01:00
GiteaBot 1410079b98
[skip ci] Updated translations via Crowdin
(cherry picked from commit 69dbfbe4e52845a807302a15e8d79d183acf683b)
2024-02-26 21:42:15 +01:00
silverwind 6068537f8a
Remove jQuery .map() and enable eslint rules for it (#29272)
- Use case in `repo-commit` was tested until the point where the POST
request was sent with the same payload.
- Use case in `repo-legacy` was tested completely with comment editing.
- `jquery/no-fade` was disabled as well to stay in sync with
`no-jquery/no-fade`, had no violations.

(cherry picked from commit a5c570c1e02302212a5d8f7cf7d91f24ab0578d5)
2024-02-26 21:42:15 +01:00
Yarden Shoham 0d61f3decc
Remove jQuery from repo wiki creation page (#29271)
- Switched to plain JavaScript
- Tested the wiki creation form functionality and it works as before

# Demo using JavaScript without jQuery

![action](https://github.com/go-gitea/gitea/assets/20454870/2dfc95fd-40cc-4ffb-9ae6-50f798fddd67)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit ade1110e8b7d94dc142a259854e2b73845eab8b9)
2024-02-26 21:42:15 +01:00
Zettat123 eefc4bf6f0
Do not show delete button when time tracker is disabled (#29257)
Fix #29233

The delete button of time logs won't be shown when the time tracker is disabled.

![image](https://github.com/go-gitea/gitea/assets/15528715/5cc4e0c9-d2f9-4b8f-a2f5-fe202b94c191)

(cherry picked from commit 8c21bc0d51ab22c0d05d8ce2ea8bc80d6f893800)
2024-02-26 21:42:15 +01:00
Rafael Heard 89eca88643
Left align the input labels for the link account page (#29255)
In a previous [PR](https://github.com/go-gitea/gitea/pull/28753) we
moved the labels to be above the inputs. The PR ensures that the
alignment is also on both tabs of the link account page
(`/user/link_account`).

Before
<img width="1094" alt="before"
src="https://github.com/go-gitea/gitea/assets/6152817/ac1e86bd-c4d6-4e45-87d1-87bb8a736149">

After
<img width="1094" alt="after"
src="https://github.com/go-gitea/gitea/assets/6152817/1b5fc109-f4d2-43ee-b924-0a9e53a0e391">

---------

Co-authored-by: rafh <rafaelheard@gmail.com>
(cherry picked from commit e4e5d76932e9d5ba1f8c63213aefae1493012a81)
2024-02-26 21:42:15 +01:00
GiteaBot 445c78e09f
[skip ci] Updated translations via Crowdin
(cherry picked from commit d9268369473965fce1464325d9f4b15ed9d38046)
2024-02-26 21:42:15 +01:00
Yarden Shoham 58699d21e7
Remove jQuery from the repo migration form (#29229)
- Switched to plain JavaScript
- Tested the repo migration form functionality and it works as before

# Demo using JavaScript without jQuery

![action](https://github.com/go-gitea/gitea/assets/20454870/3496ec05-48a7-449e-8cdd-f8372ba0d589)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 100031f5f143a15c79ebbe1b77c86091e3b6d489)
2024-02-26 21:42:14 +01:00
vincent fb137d1e49
Fix content size does not match error when uploading lfs file (#29259)
![image](https://github.com/go-gitea/gitea/assets/38434877/cd726b4d-4771-4547-8aee-ae4e4b56b1d1)
When we update an lfs file by API
`api/v1/repos/{owner}/{repo}/contents/{filepath}`, there will show an
error

```json
{
  "message": "Put \"05904d6c7b\": readfrom tcp [::1]:57300->[::1]:9000: content size does not match",
  "url": "http://localhost:3000/api/swagger"
}
```

The reason of this error is
https://github.com/go-gitea/gitea/blob/main/services/repository/files/update.go,
in this file, the `file.ContentReader` been used twice. So when use
`file.ContentReader` in the second time, the `i` of this Reader has been
updated to the length of the content. it will return 0 and an `io.EOF`
error when we try to read cotent from this Reader.

(cherry picked from commit 35d5e4aea4bb02a0b4c7b38ecb2acf612151e891)
2024-02-26 21:42:14 +01:00
6543 f796548225
Workaround to clean up old reviews on creating a new one (#28554)
close  #28542

blocks  #28544

---
*Sponsored by Kithara Software GmbH*

(cherry picked from commit 217d71c48a10265e08b95cc961656b921f61f9ff)

Conflicts:
	tests/integration/api_pull_review_test.go
	context
2024-02-26 21:42:14 +01:00
Earl Warren fe8c9b74cd Merge pull request '[BUG] Fix diff patch operation in web UI' (#2449) from gusted/forgejo-fix-diffpatch into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2449
Reviewed-by: Otto <otto@codeberg.org>
2024-02-26 20:27:07 +00:00
Gergely Nagy 0b4a9c4ec2
Disabling Stars should disable the routes too
Similarly to how `[repository].DISABLE_FORKS` works, lets make
`[repository].DISABLE_STARS` disable the routes too, not just hide the
functionality from the UI.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-26 20:50:32 +01:00
Gusted 3d3196eb3c Merge pull request '[TRANSLATION] Clarify description in deletion modal' (#2488) from gusted/forgejo-clarify-translation into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2488
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-26 15:51:14 +00:00
Gusted b4360d504c
[BUG] Remember topic only in repo search
- If the user is searching repositories with an specific topic, adding
any other filter option, such as showing unrelevant repositories or
using another sort Forgejo should remember that 'topic only' was set.
- Adds integration test.
- Resolves #2461
2024-02-26 16:25:01 +01:00
Gusted 8018c2c761
[TRANSLATION] Clarify description in deletion modal
- The value is now in the form `owner/repo` since #1473, so update the
label to reflect this.
- Ref: #2412
2024-02-26 16:09:06 +01:00
Earl Warren 775956cc68 Merge pull request '[BUG] Don't overwrite protected branch accidentally' (#2473) from gusted/forgejo-error-duplicate into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2473
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-26 14:55:09 +00:00
Earl Warren f91702dd74 Merge pull request 'Split up repo.Action in routers/web into smaller functions.' (#2476) from algernon/forgejo:refactor/routes/web/repo-action into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2476
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-26 14:54:35 +00:00
Earl Warren 393f98e888 Merge pull request '[BUG] Use correct logout URL' (#2475) from gusted/forgejo-logout-url into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2475
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-26 14:51:58 +00:00
Earl Warren 5e1d7b3c82 Merge pull request 'Linguist support enhancements from gitea#29267 & bugfixes' (#2487) from algernon/forgejo:linguist/gitea-29267 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2487
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-26 14:27:07 +00:00
Gergely Nagy ae0635fd61
Correctly support linguist-documentation=false
If a documentation file is marked with a `linguist-documentation=false`
attribute, include it in language stats.

However, make sure that we do *not* include documentation languages as
fallback.

Added a new test case to exercise the formerly buggy behaviour.

Problem discovered while reviewing @KN4CK3R's tests from gitea#29267.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-26 14:18:33 +01:00
Gergely Nagy ee39c58120
Convert linguist attribute handling to optional.Option
Based on @KN4CK3R's work in gitea#29267. This drops the custom
`LinguistBoolAttrib` type, and uses `optional.Option` instead. I added
the `isTrue()` and `isFalse()` (function-local) helpers to make the code
easier to follow, because these names convey their goal better than
`v.ValueorDefault(false)` or `!v.ValueOrDefault(true)`.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-26 12:52:59 +01:00
Gergely Nagy 7e6fe41389
Add tests for the star/unstar & watch/unwatch UI
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-26 09:14:11 +01:00
Earl Warren c80406332f Merge pull request '[CI] run frontend checks' (#2477) from earl-warren/forgejo:wip-ci-frontend into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2477
2024-02-26 07:48:30 +00:00
Earl Warren 4b859fd51f Merge pull request 'Add API to get PR by base/head' (#2481) from 6543-forks/forgejo:gitea_29242 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2481
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-26 07:46:22 +00:00
Gergely Nagy 38e30f2a8f
Refactor routers/web/repo.Action
Split up `repo.Action` in `routers/web` into smaller functions.

While some of the functionality was very similar (starring / watching),
they are ultimately separate actions. Rather than collecting all of them
under a single handler (`repo.Action`), split them up into smaller,
independent functions.

This does result in a little bit of code duplication, but the
independent functions should be easier to follow and understand.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-26 08:29:13 +01:00