Commit graph

18802 commits

Author SHA1 Message Date
Earl Warren
a7400b1812 Merge pull request 'Upgrade github.com/editorconfig-checker/editorconfig-checker to v2.8.0' (#3610) from earl-warren/forgejo:wip-lint-editorconfig into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3610
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: thefox <thefox@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-05-02 17:09:33 +00:00
Earl Warren
a6d31a30a2
Upgrade github.com/editorconfig-checker/editorconfig-checker to v2.8.0
Manual backport: https://codeberg.org/forgejo/forgejo/pulls/3181
because it conflicts with a number of evolutions in how the tools are
upgraded in the development branch.
2024-05-02 17:38:26 +01:00
forgejo-backport-action
4b79a98910 Fix inconsistent required field (#3591)
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3591
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-01 19:05:43 +00:00
Earl Warren
9d1ffeaf8d Merge pull request '[skip ci] [v7.0/forgejo] docs(release-notes): 7.0.2' (#3586) from earl-warren/forgejo:wip-release-notes-v7.0.2 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3586
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-01 14:35:52 +00:00
Earl Warren
9db70035b1
[skip ci] docs(release-notes): 7.0.2
(cherry picked from commit a050b546b9)
2024-05-01 15:05:28 +02:00
Earl Warren
ad0b97c7c2 Merge pull request '[v1.22/gitea] week 2024-18 cherry pick v7.0 (take 2)' (#3580) from earl-warren/forgejo:wip-v7.0-gitea-cherry-pick into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3580
Reviewed-by: twenty-panda <twenty-panda@noreply.codeberg.org>
2024-05-01 12:36:57 +00:00
Earl Warren
61230e72b5 Merge pull request '[v7.0/forgejo] Fix Issue watching / unwatching on the web ui' (#3585) from algernon/forgejo:backport/v7.0/3562 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3585
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-01 12:26:04 +00:00
forgejo-backport-action
50b7009603 [v7.0/forgejo] Add inline attachments to comments and prevent double handling of mails (#3566)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/3504

If incoming email is configured and an email is sent, inline attachments are currently not added to the comment if it has the `Content-Disposition: inline` instead of `Content-Disposition: attachment` as e.g. with Apple Mail.

This adds inline attachments (`Content-Disposition: inline`) that *have a filename* as attachment to the comment. Other elements with `Content-Disposition: inline` are not attached as attachment to the comment.

In addition, a check has been added to prevent mails from being processed twice.

Fixes #3496

Co-authored-by: Beowulf <beowulf@beocode.eu>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3566
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2024-05-01 12:19:38 +00:00
Gergely Nagy
36b8e68eee
Add a test case for unsubscribing from an issue
Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:32:39 +02:00
Gergely Nagy
f83ae0fad2
tests: Support creating a declarative repo without AutoInit
To be able to easily test cases where the repository does not have any
code, where the git repo itself is completely uninitialized, lets
support a case where the `AutoInit` property is false.

For the sake of backwards compatibility, if the option is not set either
way, it will default to `true`.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:32:39 +02:00
Gergely Nagy
6f35a5ab90
Fix Issue watching / unwatching on the web ui
When subscribing or unsubscribing to/from an issue on the web ui, the
request was posted to a route handled by `repo.IssueWatch`. This
function used `ctx.Req.PostForm.Get()`, erroneously.

`request.PostForm` is *only* available if `request.ParseForm()` has been
called before it. The function in question did not do that. Under some
circumstances, something, somewhere did end up calling `ParseForm()`,
but not in every scenario.

Since we do not need to check for multiple values, the easiest fix here
is to use `ctx.Req.PostFormValue`, which will call `ParseForm()` if
necessary.

Fixes #3516.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:32:39 +02:00
Gergely Nagy
0da02b9213
tests: Let CreateDeclarativeRepoWithOptions create a Wiki too
Add a new member to `DeclarativeRepoOptions`: `WikiBranch`. If
specified, create a Wiki with the given branch, and a single "Home"
page.

This will be used by an upcoming test.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:30:32 +02:00
Gergely Nagy
13892121e6
tests: Refactor CreateDeclarativeRepo
Lets introduce a new helper function,
`CreateDeclarativeRepoWithOptions`! This is almost the same as the
existing `CreateDeclarativeRepo` helper, but instead of taking a list of
random parameters the author thought of at the time of its introduction,
it takes a `DeclarativeRepoOptions` struct, with optional members.

This makes it easier to extend the function, as new members can be added
without breaking or having to update existing callsites, as long as the
newly added members default to compatible values.

`CreateDeclarativeRepo` is then reimplemented on top of the new
function. Callsites aren't updated yet, we can do that organically,
whenever touching code that uses the older function.

No new functionality is introduced just yet, this is merely a refactor.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-05-01 13:29:21 +02:00
Earl Warren
ad7bf760ac Merge pull request '[v7.0/forgejo] [I18N] Fix tepository->repository typo' (#3581) from bp-v7.0/forgejo-5ed3ffc into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3581
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-05-01 07:36:46 +00:00
proton-ab
d6597b8f7a [I18N] Fix tepository->repository typo
Signed-off-by: proton-ab <proton_ab@tuta.io>
(cherry picked from commit 5ed3ffc0c8)
2024-05-01 07:00:09 +00:00
Earl Warren
6069fcced6 Merge pull request '[v7.0/forgejo] Fix SQL command with too many placeholders' (#3578) from bp-v7.0/forgejo-33cd844-0d029eb into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3578
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-01 06:50:49 +00:00
Zettat123
4fa80332e9
Fix duplicate status check contexts (#30660) (#30779)
Backport #30660.

Caused by #30076.

There may be some duplicate status check contexts when setting status
checks for a branch protection rule. The duplicate contexts should be
removed.

Before:
<img

src="https://github.com/go-gitea/gitea/assets/15528715/97f4de2d-4868-47a3-8a99-5a180f9ac0a3"
width="600px" />

After:
<img

src="https://github.com/go-gitea/gitea/assets/15528715/ff7289c5-9793-4090-ba31-e8cb3c85f8a3"
width="600px" />

(cherry picked from commit 99e89e57bc4d2b3a3cd6c3068f818a0c7e8cec28)
2024-05-01 08:34:29 +02:00
6543
2da615c37c
Get repo assignees and reviewers should ignore deactivated users (#30770) (#30782)
Backport  #30770

If an user is deactivated, it should not be in the list of users who are
suggested to be assigned or review-requested.

old assignees or reviewers are not affected.

---
*Sponsored by Kithara Software GmbH*

(cherry picked from commit 022eac4ac8e59f861237cc1e02f7ef117eaf8e30)

Conflicts:
	models/repo/user_repo_test.go
	because there is one less fixture user compared to Gitea
2024-05-01 08:31:47 +02:00
wxiaoguang
78517f80bb
Fix nil dereference on error (#30740) (#30746)
Backport #30740 manually

Co-authored-by: Chongyi Zheng <git@zcy.dev>
(cherry picked from commit d07019f539c475466748fbf730d7f270a92fdb8b)
2024-05-01 08:14:16 +02:00
Earl Warren
16e7af48bd Merge pull request '[v7.0/forgejo] Fix user mention processing' (#3567) from bp-v7.0/forgejo-9a01062 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3567
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-05-01 05:37:13 +00:00
Gergely Nagy
275f5326a1 Performance improvement for FindReposLastestCommitStatuses
If `commitstatus_service.FindReposLastestCommitStatuses` receives no
repos in its params, short-circuit, and return early, without performing
any potentially expensive work.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 33cd8446d3)
2024-05-01 05:36:50 +00:00
Gergely Nagy
dd8d3f5ebe Fix git_model.FindBranchesByRepoAndBranchName
When a logged in user with no repositories visits their dashboard, it will
display a search box that lists their own repositories.

This is served by the `repo.SearchRepos` handler, which in turn calls
`commitstatus_service.FindReposLastestCommitStatuses()` with an empty
repo list.

That, in turn, will call `git_model.FindBranchesByRepoAndBranchName()`,
with an empty map. With no map, `FindBranchesByRepoAndBranchName()` ends
up querying the entire `branch` table, because no conditions were set
up.

Armed with a gazillion repo & commit shas, we return to
`FindReposLastestCommitStatuses`, and promptly call
`git_model.GetLatestCommitStatusForPairs`, which constructs a monstrous
query with so many placeholders that the database tells us to go
somewhere else, and flips us off. At least on instances the size of
Codeberg. On smaller instances, it will eventually return, and throw
away all the data, and return an empty set, having performed all this
for naught.

We fix this by short-circuiting `FindBranchesByRepoAndBranchName`, and
returning fast if our inputs are empty.

A test case is included.

Fixes #3521.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 0d029ebe6d)
2024-05-01 05:36:50 +00:00
Otto
04ce562f62 Merge pull request 'Backport: Cumulative English locale improvements' (#3568) from 0ko/forgejo:i18n-backport-20240430 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3568
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: crystal <crystal@noreply.codeberg.org>
2024-04-30 22:38:06 +00:00
0ko
3178f1614a [I18N] Cumulative English locale improvements
- decap wiki UI
- decap release UI
- fix cap of self visibility toggle button on org member list
- simplify `release.add_tag`
- simplify `admin_indexer_commit_sha` (we got multiple hash types now, but this referes to commit)
- some improvements to admin dashboard
- fnetX suggestions: [[1]](https://codeberg.org/forgejo/forgejo/pulls/3266#issuecomment-1795685), [[2]](https://codeberg.org/forgejo/forgejo/pulls/3266#issuecomment-1795734)
2024-04-30 20:05:42 +05:00
Earl Warren
a64e000e42 Merge pull request '[v7.0/forgejo] Fix colour contrast issues in forms' (#3553) from bp-v7.0/forgejo-03c1c88 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3553
Reviewed-by: Otto <otto@codeberg.org>
2024-04-30 14:07:35 +00:00
Earl Warren
86251afec6 Merge pull request '[v7.0/forgejo] UI: Disable internal wiki options when enabling external wiki' (#3550) from bp-v7.0/forgejo-103306f into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3550
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
2024-04-30 14:06:37 +00:00
Earl Warren
cfbc52921e Merge pull request '[v7.0/forgejo] fix: webhook: send short ref on gitea create/delete payload' (#3560) from bp-v7.0/forgejo-0d3a9e6-cb0f361 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3560
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 12:51:43 +00:00
Earl Warren
8915d65aa1 Merge pull request '[v7.0/forgejo] fix: webhook getPayloadBranch' (#3557) from bp-v7.0/forgejo-df06904-79380c2 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3557
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-30 12:45:26 +00:00
Earl Warren
f874c5e978 Merge pull request '[v7.0/forgejo] Choose better icon for Add more repo units suggestion' (#3552) from bp-v7.0/forgejo-a8211e0 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3552
Reviewed-by: Otto <otto@codeberg.org>
2024-04-30 12:42:08 +00:00
Gergely Nagy
75aa4c28f0 Fix user mention processing
When mentioning a user, the markup post-processor did not handle the
case where the mentioned user did not exist well: it tried to skip to
the next node, which in turn, ended up skipping the rest of the line.

To fix this, lets skip just the mentioned, but non-existing user, and
continue processing the current node from there.

Fixes #3535.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
(cherry picked from commit 9a01062ae2)
2024-04-30 12:28:49 +00:00
Earl Warren
c3e5e9ffb8 Merge pull request '[v7.0/forgejo] Fix toggling WIP state in PR footer' (#3551) from bp-v7.0/forgejo-900bf43 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3551
Reviewed-by: Otto <otto@codeberg.org>
2024-04-30 09:47:54 +00:00
oliverpool
e97ffdae6f webhook: send short ref on gitea create/delete payload
(cherry picked from commit 0d3a9e6491)
2024-04-30 09:12:11 +00:00
oliverpool
67647d5f39 test: webhook gitea tag creation ref
(cherry picked from commit cb0f361171)
2024-04-30 09:12:10 +00:00
oliverpool
b15d2a6bc7 webhook: fix getPayloadBranch
(cherry picked from commit df06904f4a)
2024-04-30 08:17:11 +00:00
oliverpool
cd77a78a93 test: webhook fix branch filter tests
(cherry picked from commit 79380c209d)
2024-04-30 08:17:10 +00:00
Otto Richter
a1496ec0bc Fix colour contrast issues
(cherry picked from commit 03c1c88b5b)
2024-04-30 05:49:30 +00:00
Codeberg Build Maintainers
f69fc18980 CB/tmpl: Modify icon for add more button
(cherry picked from commit a8211e07d8)
2024-04-30 05:48:40 +00:00
Otto Richter
1241ac9da5 Fix PR WIP toggle prefixes
When the variable was renamed, this occurence was missed.

(cherry picked from commit 900bf43a8a)
2024-04-30 05:37:30 +00:00
Panagiotis "Ivory" Vasilopoulos
023cd2ee90 UI: Disable internal wiki options when enabling external wiki
Using "data-target", it is possible to set a value to a target element
that can enable it or disable it. Using "data-context" lets us perform
the opposite action on a different target.

Before, only the #external_wiki_box target was used, which was enabled
or disabled depending on whether the user has chosen to use the internal
wiki or the external wiki. If the user chooses to use the internal wiki,
they will disable the box that lets them enter a link pointing to an
external wiki, and vice versa. Although it is not possible to use, say,
boolean operations, we can introduce a target that is
called #globally_writeable_checkbox that gets enabled when
the #external_wiki_box box is disabled, and vice versa.

This makes the box's behavior more consistent with the behavior in the
"Issues" section. To keep things consistent with that section, a new
property was assigned to the "globally_writeable_checkbox" that makes
the box go a bit further in (`tw-pl-4`).

(cherry picked from commit 103306f00c)
2024-04-30 05:33:31 +00:00
Otto
54f875df46 Merge pull request '[v7.0/forgejo] Show repo activities even if only code unit active or git repo is empty but issue is active' (#3514) from bp-v7.0/forgejo-c54896b into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3514
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
2024-04-29 21:41:09 +00:00
Earl Warren
b7efd1e1da Merge pull request '[v7.0/forgejo] Fixes that the settings button moves in the overflow menu when the add more button is shown' (#3529) from bp-v7.0/forgejo-fb5e36b into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3529
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
2024-04-29 12:15:33 +00:00
Beowulf
0b7e2ba549 Fixes that the settings button moves in the overflow menu
and the add more button is on the right

This fix moves the settings button back to the right and the add more
button back to the left.

(cherry picked from commit fb5e36bc6f)
2024-04-29 10:54:39 +00:00
Earl Warren
f4a61b3299 Merge pull request '[v7.0/forgejo] replaced link to gitea docu' (#3515) from bp-v7.0/forgejo-10cd0f3 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3515
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-28 15:43:38 +00:00
Robin Kloppe
9df576d7b7 replaced link to gitea docu
(cherry picked from commit 10cd0f3992)
2024-04-28 14:27:11 +00:00
Beowulf
135764f244 Show repo activities even if only code unit active or git repo is empty but issue is active (#3455)
When all repository units are deactivated except for the code unit, the activity tab will not be shown.
Since the activities tab also shows contributing stats, it would be good to show the activities tab also when only code is active.
This commit changes the behavior when the activities tab is shown.
Previous it would only be shown when Issues, Pull-Requests or Releases are activated. Now it would additionally be shown when the code unit is activated.

Refs: #3429

| Before (Code + Issues - Owner) | Before (Code - Viewer) | After (Code + Issues - Owner) | After (Code - Viewer) |
| -- | -- | -- | -- |
| ![image](/attachments/2af997bc-1f38-48c6-bdf3-cfbd7087b220)  | ![image](/attachments/ef1797f0-5c9a-4a1a-ba82-749f3ab4f403) | ![image](/attachments/fd28a96c-04ca-407e-a70d-d28b393f223d) | ![image](/attachments/2cd0d559-a6de-4ca0-a736-29c5fea81b5a) |
|  | `/activity` returns 404 for everyone | ![image](/attachments/e0e97d8f-48cb-4c16-a505-1fafa46c4b8e)  | - |

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3455
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Beowulf <beowulf@beocode.eu>
Co-committed-by: Beowulf <beowulf@beocode.eu>
(cherry picked from commit c54896ba70)
2024-04-28 13:50:45 +00:00
Earl Warren
0160acbc05 Merge pull request '[v7.0/forgejo] Move settings button back to the right in repo and org header' (#3507) from bp-v7.0/forgejo-f9628f8 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3507
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-28 08:14:43 +00:00
Beowulf
5f5d66624e Move settings button back to the right in repo and org header
This will move the settings button back to the right, like known from
older versions.
For this, the overflow-menu was changed when a setting button is
available. If no settings button is available, the behavior will not
change.

Fixes #3301

(cherry picked from commit f9628f883d)
2024-04-28 06:21:47 +00:00
Earl Warren
6a3b0d1fc8 Merge pull request '[v7.0/forgejo] RELEASE Version Link Interface customization' (#3501) from bp-v7.0/forgejo-df8b1b5 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3501
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-27 21:01:17 +00:00
Robin Kloppe
7857b80373 RELEASE Version Link
(cherry picked from commit df8b1b5dd2)
2024-04-27 20:14:07 +00:00
Earl Warren
57cde25958 Merge pull request 'Backport translations update from Weblate (#3359)' (#3497) from 0ko/forgejo:i18n-backport-20240427 into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3497
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-04-27 19:52:15 +00:00