6543
7fe297730c
Determine fuzziness of bleve indexer by keyword length ( #29706 )
...
also bleve did match on fuzzy search and the other way around. this also fix that bug.
2024-03-23 16:45:13 +01:00
Lunny Xiao
4a361391e5
Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} ( #29995 )
2024-03-22 13:53:52 +01:00
wxiaoguang
9b53fbed86
Refactor markdown attention render ( #29984 )
...
Follow #29833 and add tests
2024-03-22 12:16:23 +00:00
wxiaoguang
aa20eb092a
Fix some pending problems ( #29985 )
...
These changes are quite independent and trivial, so I don't want to open
too many PRs.
* https://github.com/go-gitea/gitea/pull/29882#discussion_r1529607091
* the `f.Close` should be called properly
* the error message could be more meaningful
(https://github.com/go-gitea/gitea/pull/29882#pullrequestreview-1942557935 )
*
https://github.com/go-gitea/gitea/pull/29859#pullrequestreview-1942324716
* the new translation strings don't take arguments
* https://github.com/go-gitea/gitea/pull/28710#discussion_r1443778807
* stale for long time
* #28140
* a form was forgotten to be changed to work with backend code
2024-03-22 19:17:30 +08:00
wxiaoguang
f7cfff21b6
Refactor external URL detection ( #29973 )
...
Follow #29960 , `IsExternalURL` is not needed anymore.
Add some tests for `RedirectToCurrentSite`
2024-03-22 04:32:40 +08:00
wxiaoguang
183ecec433
Refactor StringsToInt64s ( #29967 )
...
And close #27176
2024-03-21 15:07:35 +00:00
Lunny Xiao
ad61a23ae6
Performance improvements for pull request list page ( #29900 )
...
This PR will avoid load pullrequest.Issue twice in pull request list
page. It will reduce x times database queries for those WIP pull
requests.
Partially fix #29585
---------
Co-authored-by: Giteabot <teabot@gitea.io >
2024-03-21 14:13:08 +01:00
wxiaoguang
9b2c291a5e
Refactor URL detection ( #29960 )
...
"Redirect" functions should only redirect if the target is for current Gitea site.
2024-03-21 12:02:34 +00:00
wxiaoguang
5a5fbbecc5
Fix loadOneBranch panic ( #29938 )
...
Try to fix #29936
Far from ideal, but still better than panic.
2024-03-20 15:38:22 +00:00
Jason Song
437f5b2cfe
Show Actions post step when it's running ( #29926 )
...
The post step was always waiting, even if all steps were done. Then,
once the task was done, the post step became success immediately.
Before:
<img width="915" alt="xnip_240320_120228"
src="https://github.com/go-gitea/gitea/assets/9418365/00347430-f998-4c43-917a-bf6dd6d0e333 ">
After:
<img width="905" alt="xnip_240320_120443"
src="https://github.com/go-gitea/gitea/assets/9418365/a419b111-17c2-4029-a022-c761cc419091 ">
2024-03-20 04:59:01 +00:00
coldWater
8b305b0c93
Fix missing error check of bufio.Scanner ( #29882 )
...
maybe more
2024-03-19 02:20:36 +00:00
Nanguan Lin
c6dcfcfa58
Remove unused error in graceful manager ( #29871 )
...
As title.
2024-03-18 21:14:51 +00:00
6543
d8d6b7cdc8
Meilisearch double quote on "match" query ( #29740 )
...
make `nonFuzzyWorkaround` unessesary
cc @Kerollmops
2024-03-16 13:19:41 +00:00
wxiaoguang
815bfaebc1
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.
2024-03-16 11:34:38 +00:00
6543
65f01c9349
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*
2024-03-16 10:32:45 +00:00
Yarden Shoham
ae7b69e3fc
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 >
2024-03-15 21:57:53 +00:00
coldWater
6c60dc30bc
Refactor graceful manager, fix misused WaitGroup ( #29738 )
...
Follow #29629
2024-03-15 10:59:11 +00:00
silverwind
645e3cbc94
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 ">


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 >
2024-03-15 02:05:31 +00:00
Jason Song
2e0feead8c
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 >
2024-03-14 16:44:49 +08:00
sillyguodong
7442ff6f49
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.
2024-03-14 04:59:52 +00:00
coldWater
8f8f2edb56
Refactor markup/csv: don't read all to memory ( #29760 )
2024-03-14 02:51:55 +00:00
wxiaoguang
014da1ac25
Add test for webhook ( #29755 )
...
Follow #29690
2024-03-14 01:10:51 +00:00
wxiaoguang
c956f82c8f
Improve QueryEscape helper function ( #29768 )
...
Make it return "template.URL" to follow Golang template's context
auto-escaping.
2024-03-13 21:32:30 +08:00
KN4CK3R
d11f6a560a
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 >
2024-03-13 10:34:58 +00:00
6543
5d55e42114
Refactor to use optional.Option for issue index search option ( #29739 )
...
Signed-off-by: 6543 <6543@obermui.de >
2024-03-13 08:25:53 +00:00
6543
08c1b39b4d
Refactor label.IsArchived() ( #29750 )
...
just some missed nits
2024-03-13 07:04:07 +01:00
silverwind
f969bce500
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 ">
2024-03-12 22:37:02 +00:00
6543
90a126f468
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




---
*Sponsored by Kithara Software GmbH*
---------
Co-authored-by: delvh <dev.lh@web.de >
2024-03-12 17:32:05 +00:00
Lunny Xiao
38c260ebf8
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.
2024-03-12 04:57:19 +00:00
Lunny Xiao
68375fec74
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.
2024-03-12 04:21:27 +00:00
pengqiseven
eb1e6b0e89
remove repetitive words ( #29695 )
...
Signed-off-by: pengqiseven <912170095@qq.com >
2024-03-11 09:24:23 +00:00
yp05327
bb91056bd4
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:


---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2024-03-11 05:00:50 +00:00
Lunny Xiao
2131e8b246
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.
2024-03-10 22:30:36 +01:00
Ankit R Gadiya
eb07ce0ec5
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
2024-03-10 18:30:14 +02:00
silverwind
7c1e0ca759
Update allowed attachment types ( #29688 )
...
Update to match GitHub's latest.
Co-authored-by: Giteabot <teabot@gitea.io >
2024-03-09 12:41:32 +00:00
6543
b8befb2404
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*
2024-03-09 01:39:27 +00:00
Yarden Shoham
b763d45469
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

but looked like this in a README

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


# After


---------
Signed-off-by: Yarden Shoham <git@yardenshoham.com >
Co-authored-by: silverwind <me@silverwind.io >
2024-03-08 09:30:41 +00:00
yp05327
90b19d7887
Fix incorrect rendering csv file when file size is larger than UI.CSV.MaxFileSize ( #29653 )
...
Fix #29506
2024-03-08 08:44:50 +00:00
Lunny Xiao
9d9c8c87e0
Move get/set default branch from git package to gitrepo package to hide repopath ( #29126 )
2024-03-08 15:30:10 +08:00
wxiaoguang
35c6d32080
Avoid unexpected panic in graceful manager ( #29629 )
...
There is a fundamental design problem of the "manager" and the "wait
group".
If nothing has started, the "Wait" just panics: sync: WaitGroup is
reused before previous Wait has returned
There is no clear solution besides a complete rewriting of the "manager"
If there are some mistakes in the app.ini, end users would just see the
"panic", but not the real error messages. A real case: #27643
This PR is just a quick fix for the annoying panic problem.
2024-03-06 11:50:39 +00:00
yp05327
db58279684
Fix wrong line number in code search result ( #29260 )
...
Fix #29136
Before: The result is a table and all line numbers are all in one row.
After: Use a separate table column for the line numbers.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2024-03-06 07:24:43 +00:00
wxiaoguang
74be6e3506
Make wiki default branch name changable ( #29603 )
...
Fix #29000
Fix #28685
Fix #18568
Related: #27497
And by the way fix #24036 , add a Cancel button there (one line)
2024-03-06 14:26:32 +08:00
wxiaoguang
561e50f07d
Improve natural sort ( #29611 )
...
Hugely simplify the code, and add more tests (only new approach could
pass)
2024-03-05 15:13:35 +00:00
wxiaoguang
800a08ca0b
Remove unnecessary SanitizeHTML from code ( #29575 )
...
* "mail/issue/default.tmpl": the body is rendered by backend
`markdown.RenderString() HTML`, it has been already sanitized
* "repo/settings/webhook/base_list.tmpl": "Description" is prepared by
backend `ctx.Tr`, it doesn't need to be sanitized
2024-03-04 12:02:45 +00:00
KN4CK3R
18f708ef00
Add user blocking ( #29028 )
...
Fixes #17453
This PR adds the abbility to block a user from a personal account or
organization to restrict how the blocked user can interact with the
blocker. The docs explain what's the consequence of blocking a user.
Screenshots:



---------
Co-authored-by: Lauris BH <lauris@nix.lv >
2024-03-04 08:16:03 +00:00
Lunny Xiao
9e42aaa55f
Allow options to disable user ssh keys configuration from the interface on app.ini ( #29447 )
...
Follow #29275
Extract from #20549
Fix #24716
---------
Co-authored-by: delvh <dev.lh@web.de >
2024-03-04 07:50:21 +00:00
Denys Konovalov
6755abb4ae
Enable/disable owner and repo projects independently ( #28805 )
...
Part of #23318
Add menu in repo settings to allow for repo admin to decide not just if
projects are enabled or disabled per repo, but also which kind of
projects (repo-level/owner-level) are enabled. If repo projects
disabled, don't show the projects tab.

---------
Co-authored-by: delvh <dev.lh@web.de >
2024-03-04 02:56:52 +00:00
wxiaoguang
97df266b10
Add an trailing slash to dashboard links ( #29555 )
...
Fix #29533 , and add some tests for "base/paginate.tmpl"
2024-03-04 01:02:51 +00:00
6543
d0384b2399
Extend issue template yaml engine ( #29274 )
...
Add new option:
`visible`: witch can hide a specific field of the form or the created
content afterwards
It is a string array witch can contain `form` and `content`. If only
`form` is present, it wont show up in the created issue afterwards and
the other way around. By default it sets both except for markdown
As they are optional and github don't have any similar thing, it is non
breaking and also do not conflict with it.
With this you can:
- define "post issue creation" elements like a TODO list to track an
issue state
- make sure to have a checkbox that reminds the user to check for a
thing but dont have it in the created issue afterwards
- define markdown for the created issue (was the downside of using yaml
instead of md in the past)
- ...
## Demo
```yaml
name: New Contribution
description: External Contributor creating a pull
body:
- type: checkboxes
id: extern-todo
visible: [form]
attributes:
label: Contribution Guidelines
options:
- label: I checked there exist no similar feature to be extended
required: true
- label: I did read the CONTRIBUTION.MD
required: true
- type: checkboxes
id: intern-todo
visible: [content]
attributes:
label: Maintainer Check-List
options:
- label: Does this pull follow the KISS principe
- label: Checked if internal bord was notifyed
# ....
```
[Demo
Video](https://cloud.obermui.de/s/tm34fSAbJp9qw9z/download/vid-20240220-152751.mkv )
---
*Sponsored by Kithara Software GmbH*
---------
Co-authored-by: John Olheiser <john.olheiser@gmail.com >
Co-authored-by: delvh <dev.lh@web.de >
2024-03-04 01:37:00 +01:00
wxiaoguang
97435b6436
Breaking summary for template refactoring ( #29395 )
...
https://github.com/go-gitea/gitea/pull/29395
2024-03-03 04:57:22 +00:00