Commit graph

19554 commits

Author SHA1 Message Date
Earl Warren
fb1338537b Merge pull request '[FEAT] Wiki Search' (#3847) from snematoda/wiki-search-grep into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3847
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-21 06:27:30 +00:00
Mai-Lapyst
d4b1ed859c Port: Fix issue/PR title edit (gitea#30858) (#3797)
This PR ports [gitea#30858](https://github.com/go-gitea/gitea/pull/30858) / [this commit](5c236bd4c0) to forgejo.

[week 2024-20 cherry pick](https://codeberg.org/forgejo/forgejo/pulls/3729)

## Tests
- [ ] Click "edit" to get into edit mode, change the title and then use Alt+Enter to save the title

## Screenshots

Before:
![grafik](/attachments/bb0b2562-7da0-4205-a647-3270d66f2ad7)
![grafik](/attachments/c3d05a21-659d-4616-b357-87de57232182)

After:
![grafik](/attachments/d9af6966-3282-439b-a845-76618a24b9a6)
![grafik](/attachments/5acd6684-69c4-41a4-8e27-7cb75fe3c7e4)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3797
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
2024-05-20 23:32:48 +00:00
Léana 江
3561cc710b [I18N] Injected updated time in translation string (#3837)
Hello,

It is more idiomatic to put the date/time before the action in Mandarin (in this context). To achieve this, instead of having the time following the string that's passed to the translating function, I added it as a parameter so that one can reference it and reorder the sentence for better translatability.

Only Traditional Chinese has been changed at the time of opening this PR, as this is more of a proof of concept and I would like to have feedbacks on whether this is a good solution or is there a better alternative.

Thank you and have a nice day :)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3837
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Léana 江 <leana.jiang+git@icloud.com>
Co-committed-by: Léana 江 <leana.jiang+git@icloud.com>
2024-05-20 18:47:35 +00:00
0ko
bcd2e64a93 s/return_to_gitea/return_to_forgejo (#3822)
Just a small actualization of a string key. I don't think we have any more replaceable `gitea` in the locales at the moment.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3822
Reviewed-by: Otto <otto@codeberg.org>
2024-05-20 18:44:33 +00:00
Codeberg Translate
504d4abe12 [I18N] Translations update from Weblate (#3759)
Translations update from [Weblate](https://translate.codeberg.org) for [Forgejo/forgejo](https://translate.codeberg.org/projects/forgejo/forgejo/).

Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: kdh8219 <kdh8219@monamo.dev>
Co-authored-by: Salif Mehmed <mail@salif.eu>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: leana8959 <leana8959@users.noreply.translate.codeberg.org>
Co-authored-by: yeziruo <yeziruo@users.noreply.translate.codeberg.org>
Co-authored-by: Fitik <Fitik@users.noreply.translate.codeberg.org>
Co-authored-by: b1nar10 <b1nar10@users.noreply.translate.codeberg.org>
Co-authored-by: hankskyjames777 <hankskyjames777@users.noreply.translate.codeberg.org>
Co-authored-by: Mumulhl <mumulhl@duck.com>
Co-authored-by: Kita Ikuyo <searinminecraft@courvix.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3759
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-05-20 18:37:38 +00:00
Victoria Nadasdi
df0d1a2134 feat: parse prefix from redis URI for queues (#3836)
For security reasons, scoping access to a redis server via ACL rules is
a good practice. Some parts of the codebase handles prefix like cache[^1]
and session[^2], but the queue module doesn't.

This patch adds this missing functionality to the queue module.

Note about relevant test:
I tried to keep the PR as small as possible (and reasonable), and not
change how the test runs. Updated the existing test to use the same
redis address and basically duplicated the test with the extra flag. It
does NOT test if the keys are correct, it ensures only it works as
expected. To make assertions about the keys, the whole test has to be
updated as the general wrapper doesn't allow the main test to check
anything provider (redis) specific property. That's not something I
wanted to take on now.

[^1]: e4c3c039be/modules/cache/cache_redis.go (L139-L150)
[^2]: e4c3c039be/modules/session/redis.go (L122-L129)

Signed-off-by: Victoria Nadasdi <victoria@efertone.me>

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3836
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Victoria Nadasdi <victoria@efertone.me>
Co-committed-by: Victoria Nadasdi <victoria@efertone.me>
2024-05-20 14:10:54 +00:00
Shiny Nematoda
ec4f5495ba feat: wiki search using git-grep
+ add release note
2024-05-20 13:48:50 +00:00
Earl Warren
37962e2b2a Merge pull request 'badges: Relax the default workflow badge conditions' (#3843) from algernon/forgejo:relax-and-have-a-badge into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3843
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-20 10:44:12 +00:00
Gergely Nagy
d6915f4d5f
badges: Relax the default workflow badge conditions
Previously, if no branch was explicitly specified for a workflow, it
defaulted to the default branch of the repo. This worked fine for
workflows that were triggered on push, but it prevented showing badges
for workflows that only run on tags, or on schedule - since they do not
run on a specific branch.

Thus, relax the conditions, and if no branch is specified, just return
the latest run of the given workflow. If one is specified, *then*
restrict it to said branch.

Fixes #3487.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-20 11:20:11 +02:00
Haoyuan (Bill) Xing
6cb8c81de1 Add minimal implementation for RubyGems compact index API. (#3811)
Current package registry for RubyGems does not work with Bundler, because it implements neither the [compact index](https://guides.rubygems.org/rubygems-org-compact-index-api/) or the [dependency API](https://guides.rubygems.org/rubygems-org-api/). As a result, bundler complains about finding non-existing dependencies when installing anything with dependency: `revealed dependencies not in the API or the lockfile`.

This patch provides a minimal implementation for the compact index API to solve this issue. Specifically, we implemented a version that does not cache the results / do incremental updates; which is consistent with the current implementation.

Testing:
  * Modified existing integration tests.
  * Manually Verified bundler is able to parse the served versions / info file.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3811
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Haoyuan (Bill) Xing <me@hoppinglife.com>
Co-committed-by: Haoyuan (Bill) Xing <me@hoppinglife.com>
2024-05-19 23:30:41 +00:00
0ko
3351ce2bc5 Fix error on renaming merged PRs (#3840)
Closes https://codeberg.org/forgejo/forgejo/issues/3743.

This is a simple fix for https://codeberg.org/forgejo/forgejo/issues/3743, based on changes in [gitea#30990](https://github.com/go-gitea/gitea/pull/30990), which was not included in https://codeberg.org/forgejo/forgejo/pulls/3838 due to large code differences.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3840
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-19 18:19:31 +00:00
Earl Warren
fc45a0d9ba
cleanup(services/mailer): mark deadcode for removal
There is no activities_model.Action* when sending a review comment,
this is deadcode and should be removed. Or a new event should be added
to differentiate it from a regular comment when evaluating templates.
2024-05-19 16:47:34 +02:00
Earl Warren
55c850a8a8
tests(services/mailer): coverage for the issue/default.tmpl logic
* the tests fail when issue/default.tmpl is removed
* coverage for:
  * activities_model.ActionCreateIssue
  * activities_model.ActionCommentIssue
  * activities_model.ActionCloseIssue
  * activities_model.ActionReopenIssue
  * activities_model.ActionCommentPull
  * activities_model.ActionMergePullRequest
  * activities_model.ActionApprovePullRequest
  * activities_model.ActionRejectPullRequest
* replace mocks with calls to mockMailSettings
2024-05-19 16:47:22 +02:00
wxiaoguang
193ac67176
Always load or generate oauth2 jwt secret (#30942)
Fix #30923

(cherry picked from commit effb405cae88474c27f5c8322a2627019af1cf64)
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>

Conflicts:
	- modules/setting/oauth2.go
	  Conflicted due to different ways of logging. Since the log
	  message is removed anyway, resolved by removing it.
	- modules/setting/oauth2_test.go
	  Manually copied the test added by Gitea.
	- routers/install/install.go
	  Not a conflict per se, but adjusted to use NewJwtSecret().
2024-05-19 15:47:39 +02:00
Lunny Xiao
1be797faba
Fix bug on avatar (#31008)
Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit 58a03e9fadb345de5653345c2a68ecfd0750940a)
2024-05-19 13:57:52 +02:00
silverwind
99f29e59a1
Clean up revive linter config, tweak golangci output (#30980)
The `errorCode` and `warningCode` options were removed at some point,
they are not recognized by golangci-lint any more at least and they do
not match their published json schema. `confidence` and
`ignore-generated-header` are at the default value so does not need to
be configured.

https://golangci-lint.run/usage/linters/#revive
(cherry picked from commit 028992429a2e14de39c9bb028637948e446d23ad)
2024-05-19 13:57:52 +02:00
wxiaoguang
50b4e7f26e
Simplify mirror repository API logic (#30963)
Fix #30921

(cherry picked from commit 821d2fc2a3cc897f21d707455850177077b72410)
2024-05-19 13:57:52 +02:00
silverwind
87def3837b
Upgrade tqdm dependency (#30996)
Result of `make update-py`

Fixes: https://github.com/go-gitea/gitea/security/dependabot/65
(cherry picked from commit a73e3c6a696029541ebd423f4eb2fec1ba151f79)
2024-05-19 13:57:52 +02:00
Lunny Xiao
a20e924ee7
Remove unnecessary double quotes on language file (#30977)
The double quotes and the prefix/suffix space are unnecessary.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit 5b6f80989fbd0574ca188ab683389ff7659de30d)
2024-05-19 13:15:16 +02:00
KN4CK3R
597dcd864a
Protected tag is no internal server error (#30962)
Fixes #30959

Adds an API test for protected tags.
Fix existing tag in combination with fixtures.

(cherry picked from commit b1d8f13bd0ecd9c576ebf2ecbd9c7dbeb3f5254f)
2024-05-19 13:12:35 +02:00
Zettat123
8e1de85980
Support using label names when changing issue labels (#30943)
Resolve #30917

Make the APIs for adding labels and replacing labels support both label
IDs and label names so the
[`actions/labeler`](https://github.com/actions/labeler) action can work
in Gitea.

<img width="600px"
src="https://github.com/go-gitea/gitea/assets/15528715/7835c771-f637-4c57-9ce5-e4fbf56fa0d3"
/>

(cherry picked from commit b3beaed147466739de0c24fd80206b5af8b71617)

Conflicts:
	- modules/structs/issue_label.go
	  Resolved by applying the Gitea change by hand.
	- tests/integration/api_issue_label_test.go
	  Resolved by copying the new tests.
2024-05-19 13:12:35 +02:00
GiteaBot
4fb3f2a1fe
[skip ci] Updated licenses and gitignores
(cherry picked from commit 2442ead6807528f5791671b8a3aab6629bae66ad)
2024-05-19 12:54:14 +02:00
Emmanuel BENOÎT
0801518f5d fix(actions): prevent deleted records' UUID from colliding with new records (#3830)
This commit changes the code that deletes a runner so it updates the UUID before deleting the record. The new UUID is set to 8 0xff bytes followed by a little endian version of the record's numeric ID. Such UUIDs cannot be created from tokens when registering runners, as the first 16 bytes of the token are in the `[0-9a-f]` range. This should prevent deleted runners from colliding with new records if the tokens share the same first 16 characters.

It is a possible solution to issue #3828

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3830
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Emmanuel BENOÎT <tseeker@nocternity.net>
Co-committed-by: Emmanuel BENOÎT <tseeker@nocternity.net>
2024-05-19 10:46:15 +00:00
Earl Warren
23bbec4459
tests(services/mailer): refactor mail_admin_new_user_test
* use MockVariableValue where appropriate
* split the tests in two with t.Run for clarity
2024-05-19 08:54:25 +02:00
David Davies-Payne
e4c3c039be Suppress Monaco JavaScript errors in Safari (#3805)
Fix #3638

This is a manual Forgejo-specific version of the Gitea PR https://github.com/go-gitea/gitea/pull/30862. The weekly Forgejo PR #3772 could not cherry-pick this commit due to conflicts (eg subsequent CodeSpell changes).

Only occurs with Webkit in Safari over eg `http://192..`. (not localhost).
See https://webkit.org/blog/10855/async-clipboard-api/

---
**Before**
![Before.jpg](/attachments/c570d030-fcce-48ea-ac96-06b624541c7b)

**After**
![After.jpg](/attachments/1a9132ab-f7f3-43a5-b3ea-37b6f2b671c4)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3805
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: David Davies-Payne <d2p@me.com>
Co-committed-by: David Davies-Payne <d2p@me.com>
2024-05-18 21:07:09 +00:00
Earl Warren
11a031e238 Merge pull request '[I18N] Some English decap and other fixes' (#3823) from 0ko/forgejo:i18n-20240518 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3823
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-18 06:52:53 +00:00
Earl Warren
ed46d44b97 Merge pull request 'Fix overflowing titles in project columns' (#3821) from beowulf/projects-issue-title-overflows into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3821
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-18 06:44:48 +00:00
0ko
1b12ca80ec [I18N] Some English decap and other fixes 2024-05-18 10:24:39 +05:00
Beowulf
853f005180
fixed overflow of projects column title
This fixes that titles of project columns can overflow and push the
action menu out of the card, so that interaction is no longer possible.

Fixes #3717
2024-05-17 23:11:11 +02:00
Earl Warren
deec6c43a1 Merge pull request 'Fix contrast for issue count in projects columns' (#3804) from beowulf/projects-column-issue-count-contrast into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3804
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-17 10:14:08 +00:00
0ko
f9ac5b327a Remove title from email heads (#3810)
One part of https://codeberg.org/forgejo/forgejo/pulls/3316, though it may have a little more files touched because I re-created the changes.

> Removed HTML `<title>` part in `<head>` that was present inconsistently in these emails. It doesn't appear to be used by other websites. After all, these are emails, not webpages.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3810
Reviewed-by: Otto <otto@codeberg.org>
2024-05-17 10:10:33 +00:00
Michael Jerger
5ce359b14e rename fkt name 2024-05-17 08:15:51 +02:00
Michael Jerger
8b90194d1b lint it 2024-05-17 07:54:46 +02:00
Renovate Bot
f64c2e0a7f Update dependency @github/text-expander-element to v2.7.0 2024-05-17 00:06:12 +00:00
Beowulf
82e0066ed4
Fixed contrast for issue count in projects column
Regression introduced by 9934931f1f

See #3772
2024-05-17 00:54:10 +02:00
Michael Jerger
b2c3eb1644 add migration & enhance int-test 2024-05-16 18:25:16 +02:00
Earl Warren
45a41811de Merge pull request 'Update dependency mermaid to v10.9.1' (#3776) from renovate/mermaid-10.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3776
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-16 15:55:54 +00:00
Earl Warren
e47dd122f8
chore(release-notes): update dependency mermaid to v10.9.1
Refs: https://codeberg.org/forgejo/forgejo/pulls/3776
2024-05-16 15:34:17 +02:00
Earl Warren
e8c32255da Merge pull request 'Port: Fix some UI problems (install) (gitea#30854)' (#3787) from Mai-Lapyst/forgejo:cherry-pick-30854 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3787
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-16 13:13:48 +00:00
Earl Warren
d30fa97729 Merge pull request 'Update module github.com/go-swagger/go-swagger/cmd/swagger to v0.31.0' (#3778) from renovate/github.com-go-swagger-go-swagger-cmd-swagger-0.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3778
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-16 13:10:44 +00:00
Earl Warren
56ca2e43e9 Merge pull request 'test: add more sha256 repositories tests' (#3794) from oliverpool/forgejo:push_deploy_sha256 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3794
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-16 13:02:44 +00:00
Otto
c4d7045a24 Merge pull request 'template: label fix correct input id' (#3789) from Frankkkkk/forgejo:fvd/fix-label into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3789
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
Reviewed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
2024-05-16 10:15:10 +00:00
oliverpool
67effd6985 test-sha256: APICreateFile 2024-05-16 11:01:47 +02:00
oliverpool
df8aaeb1d5 test-sha256: APICreateBranch 2024-05-16 10:54:40 +02:00
oliverpool
348182f4b3 test-sha256: PushDeployKeyOnEmptyRepo 2024-05-16 10:54:40 +02:00
oliverpool
e3e82d02ad test: useless duplication 2024-05-16 09:56:13 +02:00
Michael Jerger
1c7a9b00be initial 2024-05-16 08:15:43 +02:00
0ko
fc0c5e80da Fix and improve repo visibility checkbox when FORCE_PRIVATE is on (#3786)
This was [implemented](022820103d) almost 10 years ago in Gogs.

It was using `readonly` attribute instead of `disabled` on checkbox which was doing nothing. According to [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly), `readonly` attribute is not applicable to checkbox inputs. This bug was reported by mrwusel in Matrix room.
Fork page that has similar UI feature did not have this bug.

- replace `readonly` with `disabled`
- do not put info about the restriction directly into the checkbox title

### Before
![image](/attachments/6adaf1a3-6e28-416a-ac85-aa6e570e438d)

### After
![image](/attachments/3590b02b-3c83-4864-bae8-ff1a6a56b2b0)

### In other case
![image](/attachments/7f49d84d-5b3a-43a1-b09c-fb6089c1fb5e)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3786
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-16 05:51:55 +00:00
Frank Villaro-Dixon
208eed05ff template: label fix correct input id
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
2024-05-15 23:13:05 +02:00
Earl Warren
cb551effb9 Merge pull request 'fix: hook post-receive for sha256 repos' (#3652) from oliverpool/forgejo:hook_post_receive_error into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3652
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-15 21:06:24 +00:00