Commit Graph

14955 Commits

Author SHA1 Message Date
wxiaoguang a83d597989
Merge different languages for language stats (#24900) (#24921)
Backport #24900

Fix #24896

If users set different languages by `linguist-language`, the `stats` map
could be: `java: 100, Java: 200`.

Language stats are stored as case-insensitive in database and there is a
unique key.

So, the different language names should be merged to one unique name:
`Java: 300`
2023-05-25 07:12:21 +02:00
Paweł Bogusławski c5dee8823c
Hiding Secrets options when Actions feature is disabled (#24792)
`Secrets` options should be hidden if `Actions` feature is disabled.

This fixes in release/v1.19. In main probably fixed in
63a401ac40 (didn't check).

Fixes: 659055138b
Author-Change-Id: IB#1134011

Signed-off-by: Pawel Boguslawski <pawel.boguslawski@ib.pl>
2023-05-24 18:01:11 +08:00
Giteabot 275abd6593
Only validate changed columns when update user (#24867) (#24903)
Backport #24867 by @lunny

Fix #23211
Replace #23496

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-05-24 04:24:02 -04:00
wxiaoguang d19d5bc5b8
Make DeleteIssue use correct context (#24885)
Fix #24884 , the `ctx.Repo.GitRepo` might be nil.
2023-05-23 13:11:19 -04:00
Lunny Xiao e7757aa4be
Remove unnecessary prefix usage (#24888)
Since now all articles have a class, the `Usage:` is unnecessary. This
PR will remove them.
2023-05-24 00:34:31 +08:00
silverwind e81d38b0f6
Set `--font-weight-bold` to 600 (#24840)
Backport of https://github.com/go-gitea/gitea/pull/24827 to 1.19, just
the font weight reduction.
2023-05-22 10:56:41 +08:00
Giteabot f29c52a169
Return `404` in the API if the requested webhooks were not found (#24823) (#24830)
Backport #24823 by @sonjek

Should resolve first point of the issue
https://github.com/go-gitea/gitea/issues/24574

Co-authored-by: Yevhen Pavlov <yevhen.pavlov.ua@gmail.com>
2023-05-21 14:05:58 -04:00
Giteabot 04f9ab1aa9
Fix topics deleted via API not being deleted in org page (#24825) (#24829)
Backport #24825 by @yardenshoham

The topics are saved in the repo_topic table with a repoID key. They are
also saved directly in the repository table.

Before this PR, only `AddTopic` and `SaveTopics` made sure the `topics`
field in the repository field was synced with the repo_topic table.

This PR makes sure `GenerateTopics` and `DeleteTopic` also sync the
`topics` in the repository table.

`RemoveTopicsFromRepo` doesn't need to sync the data as it is only used
to delete a repository.

- Fixes #24820
2023-05-21 20:48:54 +08:00
Giteabot b369ed579d
Fix Actions being enabled accidentally (#24802) (#24810)
Backport #24802 by @wolfogre

Regression of #24536. If the user doesn't explicitly disable Actions, it
will be enabled.

1. Gitea will call `loadRepositoryFrom` before `loadActionsFrom`.

25d4f95df2/modules/setting/setting.go (L234-L237)
2. In `loadRepositoryFrom`,
`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` will set
`actions.ENABLED` with `true`.

25d4f95df2/modules/setting/repository.go (L313-L315)
3. In `loadActionsFrom`, `rootCfg.Section("actions")` will get a section
with Actions enabled.

25d4f95df2/modules/setting/actions.go (L23-L26)


Although the cause of the problem was using `true` by copy-paste
mistake, it also surprised me that
**`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` doesn't
only read, but also write.**

Co-authored-by: Jason Song <i@wolfogre.com>
2023-05-19 15:17:48 +02:00
wxiaoguang 64cc691b7f
Fix safari cookie session bug (#24772)
Partically backport #24330

Related: #24176

Maybe fix #24770
2023-05-18 09:10:23 +08:00
Giteabot 1bad05da3d
Fix missed table name on iterate lfs meta objects (#24768) (#24774)
Backport #24768 by @lunny

Fix #24763

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-05-17 20:35:20 +02:00
Giteabot 57f520e7e5
Make mailer SMTP check have timed context (#24751) (#24759)
Backport #24751 by @wxiaoguang

Make mailer SMTP check have timed context

Otherwise Gitea may block for long time if the DNS request blocks.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-05-17 06:08:39 -04:00
Giteabot e4f200e616
Respect original content when creating secrets (#24745) (#24746)
Backport #24745 by @wolfogre

Fix #24721.

Follow what GitHub does:
- Don't trim spaces for secrets.
- Newline should be `\n` instead of `\r\n`.

Did some tests with:

```yaml
name: secrets
on: push
jobs:
  show_secrets:
    runs-on: ubuntu-latest
    steps:
      - name: Dump secrets context
        run: echo '${{ toJSON(secrets) }}' | base64
```

`AAAAAA`:
```text
   AAAAAA
AAAAAA


```
`BBBBBB`:
```text



BBBBBB
BBBBBB   
```


On GitHub:

<img width="675" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/0ec60652-c2a3-47bb-9f9d-7e81665355a8">


On Gitea (before):

<img width="673" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/cce818bf-5edc-4656-86e1-2c81c304cdb2">

On Gitea (after):

<img width="673" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/0b3b15af-4d48-4bab-a334-4738a1b0eb4a">

Co-authored-by: Jason Song <i@wolfogre.com>
2023-05-16 03:33:47 -04:00
wxiaoguang 6ecd2e782f
Fix Pull Mirror out-of-sync bugs (#24732) (#24733)
Backport #24732 

Bug-fix only
2023-05-15 20:30:21 +02:00
Giteabot 2fea93b2d3
Fix run list broken when trigger user deleted (#24706) (#24709)
Backport #24706 by @lunny

Fix #24682

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-05-14 04:55:58 -04:00
Giteabot 0ee51a5221
Add test for api team organization (#24699) (#24702)
Backport #24699 by @lunny

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-05-13 18:08:53 -04:00
Giteabot da1c38dd47
Fix `organization` field being `null` in `GET /api/v1/teams/{id}` (#24694) (#24696)
Backport #24694 by @yardenshoham

Enabled the organization loading flag.

- Fixes #20399 

# Before
```json
{
  ...
  "description": "",
  "organization": null,
  "includes_all_repositories": true,
  "permission": "owner",
  ...
}
```

# After
```json
{
  ...
  "description": "",
  "organization": {
    "id": 2,
    "name": "bigorg",
    "full_name": "",
    "avatar_url": "https://3000-yardenshoham-gitea-3gfrlc9gn4h.ws-us96b.gitpod.io/avatars/e2649b0c016d9102664a7d4349503eb9",
    "description": "",
    "website": "",
    "location": "",
    "visibility": "public",
    "repo_admin_change_team_access": true,
    "username": "bigorg"
  },
  "includes_all_repositories": true,
  "permission": "owner",
  ...
}
```

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2023-05-13 21:01:54 +02:00
Giteabot aa984f21fa
Fix docs documenting invalid `@every` for `OLDER_THAN` cron settings (#24695) (#24698)
Backport #24695 by @yardenshoham

Looks like a copy-paste leftover

- Fixes #20868

Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2023-05-13 23:47:56 +08:00
Giteabot 8f722012f6
Fix issues list page multiple selection update milestones (#24660) (#24663)
Backport #24660 by @lunny

Fix #24651

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-05-12 14:58:46 -04:00
oliverpool cb7ba8969d
fix: release page for empty or non-existing target (#24659)
Backport #24470

Fixes #24145

---

To solve the bug, I added a "computed" `TargetBehind` field to the
`Release` model, which indicates the target branch of a release. This is
particularly useful if the target branch was deleted in the meantime (or
is empty).

I also did a micro-optimization in `calReleaseNumCommitsBehind`. Instead
of checking that a branch exists and then call `GetBranchCommit`, I
immediately call `GetBranchCommit` and handle the `git.ErrNotExist`
error.

This optimization is covered by the added unit test.

_contributed in the context of @forgejo_
2023-05-12 14:14:41 -04:00
Giteabot 7eaf7aacde
Do not select line numbers when selecting text from the action run logs (#24594) (#24596)
Backport #24594 by @yardenshoham

- Fixes #24578

# Before

![image](https://user-images.githubusercontent.com/20454870/236873942-26e97f28-6595-4be9-88fa-158870eda253.png)

# After

![image](https://user-images.githubusercontent.com/20454870/236874171-8f0182a5-e953-4740-b875-f3542dee8325.png)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2023-05-08 15:56:53 -04:00
Giteabot b390b439e1
Fix close org projects (#24588) (#24591)
Backport #24588 by @yp05327

A part of #22865
We can not close org projects now. This PR will fix it.

Co-authored-by: yp05327 <576951401@qq.com>
2023-05-08 20:50:27 +02:00
Giteabot 306b7b5d1d
Refresh the refernce of the closed PR when reopening (#24231) (#24587)
Backport #24231 by @sillyguodong

Close #24213 
Replace #23830

#### Cause

- Before, in order to making PR can get latest commit after reopening,
the `ref`(${REPO_PATH}/refs/pull/${PR_INDEX}/head) of evrey closed PR
will be updated when pushing commits to the `head branch` of the closed
PR.

#### Changes

- For closed PR , won't perform these behavior: insert`comment`, push
`notification` (UI and email), exectue
[pushToBaseRepo](7422503341/services/pull/pull.go (L409))
function and trigger `action` any more when pushing to the `head branch`
of the closed PR.
- Refresh the reference of the PR when reopening the closed PR (**even
if the head branch has been deleted before**). Make the reference of PR
consistent with the `head branch`.

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
2023-05-08 12:48:06 +02:00
wxiaoguang 4498a26222
Improve decryption failure message (#24573) (#24575)
Backport #24573

Help some users like #16832 #1851

There are many users reporting similar problem: if the SECRET_KEY
mismatches, some operations (like 2FA login) only reports unclear 500
error and unclear "base64 decode error" log (some maintainers ever spent
a lot of time on debugging such problem)

The SECRET_KEY was not well-designed and it is also a kind of technical
debt. Since it couldn't be fixed easily, it's good to add clearer error
messages, then at least users could know what the real problem is.
2023-05-07 22:12:32 +08:00
Giteabot 6f57be0025
Makefile: Use portable !, not GNUish -not, with find(1). (#24565) (#24572)
Backport #24565 by @riastradh

fix https://github.com/go-gitea/gitea/issues/24564

Co-authored-by: Taylor R Campbell <campbell+gitea@mumble.net>
2023-05-07 19:30:13 +08:00
Giteabot 257287954c
Fix the permission of team's `Actions` unit issue (#24536) (#24545)
Backport #24536 by @sillyguodong

close #24449

The unit of `Actions` should be contorlled not only by
`repository.DISABLED_REPO_UNITS` but also by `actions.ENABLED`
in the `app.ini`.
Previously, the permission of the team's `Actions` unit was not
controlled by `actions.Enabled`. So, even if the user sets
`actions.Enabled` to false, he can still select the permission of the
`Actions` unit for the team.

This PR makes the permissions of the team's `Actions` unit also
controlled by `actions.Enabled`. Just append`TypeActions` into
`DisabledRepoUnits` slice when initializing if `actions.Enabled` is
false.


### Changes:

If `Actions` is set disbaled in `app.ini`, like below:
```yaml
[actions]
ENABLED = false
```

1. If user try to create/edit a team, will prompt user that `Actions` is
disbaled.
 

![image](https://user-images.githubusercontent.com/33891828/236370415-961082b2-82d2-4d9e-8025-83872ad08cbb.png)

2. `actions` is not displayed in the sidebar on the team details page


![image](https://user-images.githubusercontent.com/33891828/236371817-f39f9bc9-5926-4b88-b5e6-d93617fcfb07.png)

Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
2023-05-05 15:07:02 +02:00
Lunny Xiao 7a74957c19
Fix new wiki page mirror (#24518)
backport #24395

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-05-04 16:30:47 -04:00
Lunny Xiao f979569a3d
Bump go.etcd.io/bbolt and blevesearch deps (#23062) (#24519)
Backport #23062
Backport #24515
Fix #23617 

This notably brings support for GOARCH=loong64, among other fixes.
This PR also fix bleve search architecture problem.

---------

Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
Co-authored-by: WÁNG Xuěruì <1175567+xen0n@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
2023-05-04 12:41:36 +02:00
techknowlogick 8ceb78caad
Changelog for 1.19.3 (#24495)
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-05-03 11:14:50 -04:00
Giteabot 4dccac3dbf
Fix api error message if fork exists (#24487) (#24493)
Backport #24487 by @fnetX

On the @Forgejo instance of Codeberg, we discovered that forking a repo
which is already forked now returns a 500 Internal Server Error, which
is unexpected. This is an attempt at fixing this.

The error message in the log:
~~~
2023/05/02 08:36:30 .../api/v1/repo/fork.go:147:CreateFork() [E]
[6450cb8e-113] ForkRepository: repository is already forked by user
[uname: ...., repo path: .../..., fork path: .../...]
~~~

The service that is used for forking returns a custom error message
which is not checked against.

About the order of options:
The case that the fork already exists should be more common, followed by
the case that a repo with the same name already exists for other
reasons. The case that the global repo limit is hit is probably not the
likeliest.

---------

Co-authored-by: Otto Richter (fnetX) <git@fralix.ovh>
2023-05-03 08:15:56 -04:00
Giteabot 73e70f3c44 Enable whitespace rendering on selection in Monaco (#24444) (#24485)
Backport #24444 by @silverwind

Remove the
[renderWhitespace](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor.IEditorOptions.html#renderWhitespace)
override, so the default value of `selection` takes over and makes
whitespace visible on selection.

<img width="128" alt="Screenshot 2023-04-30 at 19 09 41"
src="https://user-images.githubusercontent.com/115237/235366707-d598268d-03cc-4839-a195-c460bddae99b.png">

Co-authored-by: silverwind <me@silverwind.io>
2023-05-02 23:29:38 -04:00
techknowlogick 499257d81e
nightly tag 2023-05-01 14:17:52 -04:00
wxiaoguang 84fa30e3d5
Remove less/_repository.less (#24467) 2023-05-01 10:37:49 -04:00
silverwind f1a0b64109
Skip known flaky `queue` tests on CI environment (#24443)
Backport of https://github.com/go-gitea/gitea/pull/24419 to 1.19.
2023-04-30 15:25:42 -04:00
techknowlogick bfdbc626cb
nightly tag for docker images 2023-04-30 13:42:37 -04:00
Giteabot 3abbf5fc21
Improve milestone filter on issues page (#22423) (#24440)
Backport #22423 by @lunny

Now we have `All milestones`, `No milestones`, `Open milestones` and
`Closed milestones`.
Fix #11924
Fix #22411 

<img width="1166" alt="image"
src="https://user-images.githubusercontent.com/81045/212243375-95eea035-a972-44b8-8088-53db614cb07e.png">

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-04-30 19:01:12 +02:00
wxiaoguang d9d3f5234e
Fix incorrect CurrentUser check for docker rootless (#24435)
Many users report that 1.19 has a regression bug: the rootless image
can't start if the UID is not 1000.

https://github.com/go-gitea/gitea/issues/23632#issuecomment-1524589213


https://discourse.gitea.io/t/gitea-doesnt-start-after-update-to-1-19/6920/9


The problem is that the IsRunUserMatchCurrentUser logic is fragile, the
"SSH" config is not ready when it executes.

This PR is just a quick fix for 1.19. For 1.20, we need a clear and
stable solution.
2023-04-29 23:47:04 -04:00
Giteabot 7d7ba76c08
Fix user-cards format (#24428) (#24431)
Backport #24428 by @KN4CK3R

Fixes #24418

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-04-29 22:05:34 -04:00
Giteabot e76b3f72b2
getting the tag list does not require being signed in (#24413) (#24416)
Backport #24413 by @earl-warren

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

Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
2023-04-29 09:43:37 +02:00
John Olheiser 4bc6bfb476
Changelog 1.19.2 (#24365)
Add changelog for 1.19.2

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-04-28 07:39:52 +08:00
Giteabot 5999349ce7
Fix auth check bug (#24382) (#24387)
Backport #24382 by @lunny

Fix https://github.com/go-gitea/gitea/pull/24362/files#r1179095324

`getAuthenticatedMeta` has checked them, these code are duplicated one.
And the first invokation has a wrong permission check. `DownloadHandle`
should require read permission but not write.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-04-27 17:49:50 -05:00
Zettat123 e301e26d7a
Add tags list for repos whose release setting is disabled (#23465) (#24369)
Backport #23465

Close #23427 

Co-Author: @wxiaoguang 

If a repo's release setting is enabled, the logic has't changed.
Clicking the "Tags" button will jump to `/{user}/{repo}/tags` and
`templates/repo/release/list.tmpl` template will be used.

<img
src="https://user-images.githubusercontent.com/15528715/224939362-bd8974fd-08b0-4f79-a114-3389d15847ca.png"
width="600px" />

If the release setting is disabled, clicking the "Tags" button will
still jump to `/{user}/{repo}/tags` but a new template
`templates/repo/tag/list.tmpl` will be used.

<img
src="https://user-images.githubusercontent.com/15528715/233834564-74741e49-f4e9-47c8-ac12-e306642798dc.png"
width="600px" />

Since both templates above need to render the tags list, I moved the
tags list to a shared template located in
`templates/repo/tag/table.tmpl`.
2023-04-27 12:40:36 +08:00
Giteabot d2efd2bf73
Require repo scope for PATs for private repos and basic authentication (#24362) (#24364)
Backport #24362 by @jolheiser

> The scoped token PR just checked all API routes but in fact, some web
routes like `LFS`, git `HTTP`, container, and attachments supports basic
auth. This PR added scoped token check for them.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-04-26 20:57:51 -04:00
yp05327 89297c9355
Fix no edit/close/delete button in org repo project view page (#24349)
Backport #24301
2023-04-26 07:38:41 -04:00
Giteabot d2328c4051
Fix Monaco IOS keyboard button (#24341) (#24347)
Backport #24341 by @silverwind

Fix https://github.com/go-gitea/gitea/issues/16188. Turns out the
element was completely misaligned by fomantic styles. Add most of the
original styles in `!important` form to fix.

Tapping the button doesn't do anything useful in Simulator.app, but I
guess it's still better to not outright hide it in case it has a
possiblity to work.

<img width="121" alt="image"
src="https://user-images.githubusercontent.com/115237/234379685-4e67f8cd-7e91-4bcc-8e17-9d5b2ebed6cd.png">

Co-authored-by: silverwind <me@silverwind.io>
2023-04-26 05:42:00 -04:00
Giteabot af5d66b341
Fix wrong error info in RepoRefForAPI (#24344) (#24351)
Backport #24344 by @yp05327

Co-authored-by: yp05327 <576951401@qq.com>
2023-04-26 11:07:51 +02:00
Giteabot 912a418920
Fix broken clone script on an empty archived repo (#24339) (#24348)
Backport #24339 by @yardenshoham

I made it render the script even if the repo is archived

- Fixes #24324

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: Yarden Shoham <git@yardenshoham.com>
2023-04-26 10:13:16 +02:00
Giteabot cc7a4f17e0
Don't set meta `theme-color` by default (#24340) (#24346)
Backport #24340 by @silverwind

Fixes https://github.com/go-gitea/gitea/issues/24321. By not setting
this meta tag, Safari will use body color for chrome and out-of-viewport
areas, which looks much better then static mismatching green.

As per
[MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color)
it's really only Apple browsers who still support this tag, most others
have dropped support.
 
Before:
<img width="347" alt="Screenshot 2023-04-25 at 19 59 13"
src="https://user-images.githubusercontent.com/115237/234363180-0fe667ef-5469-4f5f-b31a-c9d73aff10ac.png">

After:
<img width="361" alt="Screenshot 2023-04-25 at 20 00 00"
src="https://user-images.githubusercontent.com/115237/234363185-e2d2b62f-0133-4316-944d-b614ffb84eb0.png">

Co-authored-by: silverwind <me@silverwind.io>
2023-04-26 01:33:15 -04:00
wxiaoguang 5f82011b7c
Add --font-weight-bold and set previous bold to 601 (#24307) (#24331)
Backport #24307

Fix #24305

According to MDN, "bold" starts from 700, some fonts do not provide
"bolding" for weight 600

Manually backport, no CSS conflict.
2023-04-25 19:51:54 -04:00
Giteabot 1bbbeb24ef
Respect the REGISTER_MANUAL_CONFIRM setting when registering via OIDC (#24035) (#24333)
Backport #24035 by @garymoon

This change prevents Gitea from bypassing the manual approval process
for newly registered users when OIDC is used.

- Resolves https://github.com/go-gitea/gitea/issues/23392

Signed-off-by: Gary Moon <gary@garymoon.net>
Co-authored-by: Gary Moon <garymoon@users.noreply.github.com>
2023-04-25 15:25:08 -04:00