Lunny Xiao
3f26fe2fa2
Use db.ListOptions directly instead of Paginator interface to make it easier to use and fix performance of /pulls and /issues ( #29990 )
...
This PR uses `db.ListOptions` instead of `Paginor` to make the code
simpler.
And it also fixed the performance problem when viewing /pulls or
/issues. Before the counting in fact will also do the search.
---------
Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: silverwind <me@silverwind.io>
8 months ago
wxiaoguang
4734d43e14
Support repo code search without setting up an indexer ( #29998 )
...
By using git's ability, end users (especially small instance users) do
not need to enable the indexer, they could also benefit from the code
searching feature.
Fix #29996
![image](https://github.com/go-gitea/gitea/assets/2114189/11b7e458-88a4-480d-b4d7-72ee59406dd1 )
![image](https://github.com/go-gitea/gitea/assets/2114189/0fe777d5-c95c-4288-a818-0427680805b6 )
---------
Co-authored-by: silverwind <me@silverwind.io>
8 months ago
6543
b9c57fb78e
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.
8 months ago
Lunny Xiao
f8ab9dafb7
Use db.ListOptionsAll instead of db.ListOptions{ListAll: true} ( #29995 )
8 months ago
wxiaoguang
2ff213bbc1
Refactor markdown attention render ( #29984 )
...
Follow #29833 and add tests
8 months ago
wxiaoguang
226231ea27
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
8 months ago
wxiaoguang
ca4107dc96
Refactor external URL detection ( #29973 )
...
Follow #29960 , `IsExternalURL` is not needed anymore.
Add some tests for `RedirectToCurrentSite`
8 months ago
wxiaoguang
cdb4d1a8db
Refactor StringsToInt64s ( #29967 )
...
And close #27176
8 months ago
Lunny Xiao
62f8174aa2
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>
8 months ago
wxiaoguang
01500957c2
Refactor URL detection ( #29960 )
...
"Redirect" functions should only redirect if the target is for current Gitea site.
8 months ago
wxiaoguang
21151474e3
Fix loadOneBranch panic ( #29938 )
...
Try to fix #29936
Far from ideal, but still better than panic.
8 months ago
Jason Song
35cfd98e12
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 ">
8 months ago
coldWater
0e183d81fc
Fix missing error check of bufio.Scanner ( #29882 )
...
maybe more
8 months ago
Nanguan Lin
1f0d31ce8f
Remove unused error in graceful manager ( #29871 )
...
As title.
8 months ago
6543
c6e5ec51bd
Meilisearch double quote on "match" query ( #29740 )
...
make `nonFuzzyWorkaround` unessesary
cc @Kerollmops
8 months ago
wxiaoguang
66902d89e5
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.
8 months ago
6543
1262ff6734
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*
8 months ago
Yarden Shoham
3f1e4896b6
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>
8 months ago
coldWater
d08f4360c9
Refactor graceful manager, fix misused WaitGroup ( #29738 )
...
Follow #29629
8 months ago
silverwind
256a1eeb9a
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 ">
![image](https://github.com/go-gitea/gitea/assets/115237/0f43770c-834c-4a05-8e3d-d30eb8653786 )
![image](https://github.com/go-gitea/gitea/assets/115237/4b4c6bd7-843f-4f49-808f-6b3aed5e9f9a )
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>
8 months ago
Jason Song
487ac9bf6c
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>
8 months ago
sillyguodong
2033eb7c11
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.
8 months ago
coldWater
e79a807a84
Refactor markup/csv: don't read all to memory ( #29760 )
8 months ago
wxiaoguang
43de021ac1
Add test for webhook ( #29755 )
...
Follow #29690
8 months ago
wxiaoguang
3e94ac5c7c
Improve QueryEscape helper function ( #29768 )
...
Make it return "template.URL" to follow Golang template's context
auto-escaping.
8 months ago
KN4CK3R
85c59d6c21
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>
8 months ago
6543
7fd0a5b276
Refactor to use optional.Option for issue index search option ( #29739 )
...
Signed-off-by: 6543 <6543@obermui.de>
8 months ago
6543
9a93b1816e
Refactor label.IsArchived() ( #29750 )
...
just some missed nits
8 months ago
silverwind
857243bed7
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 ">
8 months ago
6543
36de5b299b
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
![image](https://github.com/go-gitea/gitea/assets/24977596/fd77c4d2-eff5-4afd-9bfa-19cb9991c5e7 )
![image](https://github.com/go-gitea/gitea/assets/24977596/2e0f30e5-f301-4c9c-8e9f-677298d90b27 )
![image](https://github.com/go-gitea/gitea/assets/24977596/53d70abf-b306-453d-aa95-a3a035b19a33 )
![image](https://github.com/go-gitea/gitea/assets/24977596/6020e5f5-2364-4807-979f-37dffa8735e5 )
---
*Sponsored by Kithara Software GmbH*
---------
Co-authored-by: delvh <dev.lh@web.de>
8 months ago
Lunny Xiao
aed3b53abd
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.
9 months ago
Lunny Xiao
e84e5db6de
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.
9 months ago
pengqiseven
7f856d5d74
remove repetitive words ( #29695 )
...
Signed-off-by: pengqiseven <912170095@qq.com>
9 months ago
yp05327
8fc1a8f0eb
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:
![image](https://github.com/go-gitea/gitea/assets/18380374/2a1c20c7-438e-4ab1-8c66-cf91c8343087 )
![image](https://github.com/go-gitea/gitea/assets/18380374/b81b8a93-8bca-46a5-b7db-e0d2f53e1342 )
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
9 months ago
Lunny Xiao
3c6fc25a77
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.
9 months ago
Ankit R Gadiya
5665a0212b
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
9 months ago
silverwind
6ea1c67ead
Update allowed attachment types ( #29688 )
...
Update to match GitHub's latest.
Co-authored-by: Giteabot <teabot@gitea.io>
9 months ago
6543
7fdc048153
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*
9 months ago
Yarden Shoham
b5c418f271
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
![image](https://github.com/go-gitea/gitea/assets/20454870/96b1de01-2c87-4d4f-83dd-98192b83e9d0 )
but looked like this in a README
![image](https://github.com/go-gitea/gitea/assets/20454870/474b636d-dd7a-4b7f-ba27-643803c71aa3 )
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
![image](https://github.com/go-gitea/gitea/assets/20454870/474b636d-dd7a-4b7f-ba27-643803c71aa3 )
![image](https://github.com/go-gitea/gitea/assets/20454870/167a8d37-9a44-4479-9340-5dc80347b595 )
# After
![image](https://github.com/go-gitea/gitea/assets/20454870/2f99fec0-98ff-4ba8-97fe-b4567041ae79 )
![image](https://github.com/go-gitea/gitea/assets/20454870/ffdeae11-fb06-4d00-b497-eae135f0d7ad )
---------
Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: silverwind <me@silverwind.io>
9 months ago
yp05327
9dc8a6336e
Fix incorrect rendering csv file when file size is larger than UI.CSV.MaxFileSize ( #29653 )
...
Fix #29506
9 months ago
Lunny Xiao
25b842df26
Move get/set default branch from git package to gitrepo package to hide repopath ( #29126 )
9 months ago
wxiaoguang
90a3f2d4b7
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.
9 months ago
yp05327
a2b0fb1a64
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>
9 months ago
wxiaoguang
5cddab4f74
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)
9 months ago
wxiaoguang
ebff37ae09
Improve natural sort ( #29611 )
...
Hugely simplify the code, and add more tests (only new approach could
pass)
9 months ago
wxiaoguang
dae7f1ebdb
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
9 months ago
KN4CK3R
c337ff0ec7
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:
![grafik](https://github.com/go-gitea/gitea/assets/1666336/4ed884f3-e06a-4862-afd3-3b8aa2488dc6 )
![grafik](https://github.com/go-gitea/gitea/assets/1666336/ae6d4981-f252-4f50-a429-04f0f9f1cdf1 )
![grafik](https://github.com/go-gitea/gitea/assets/1666336/ca153599-5b0f-4b4a-90fe-18bdfd6f0b6b )
---------
Co-authored-by: Lauris BH <lauris@nix.lv>
9 months ago
Lunny Xiao
8e12ba34ba
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>
9 months ago
Denys Konovalov
fe6792dff3
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.
![grafik](https://github.com/go-gitea/gitea/assets/47871822/b9b43fb4-824b-47f9-b8e2-12004313647c )
---------
Co-authored-by: delvh <dev.lh@web.de>
9 months ago
wxiaoguang
8553b4600e
Add an trailing slash to dashboard links ( #29555 )
...
Fix #29533 , and add some tests for "base/paginate.tmpl"
9 months ago