aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
Commit message (Collapse)AuthorAgeFilesLines
* Add option to set language in admin user view (#28449)65432024-03-021-0/+1
| | | | | | | | | | | ![image](https://github.com/go-gitea/gitea/assets/24977596/be7e3f92-af3f-4628-b4ed-abf6439687f3) `/admin/users/<UserID>/edit` ![image](https://github.com/go-gitea/gitea/assets/24977596/906af0dd-cceb-4ed9-9cd9-32c71ae1bf71) `/admin/users/<UserID>` --- *Sponsored by Kithara Software GmbH*
* Fix elipsis button not working if the last commit loading is deferred (#29544)Yarden Shoham2024-03-021-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, if we had more than 200 entries being deferred in loading, the entire table would get replaced thus losing any event listeners attached to the elements within the table, such as the elipsis button and commit list with tippy. With this change we remove the previous javascript code that replaced the table and use htmx to replace the table. htmx attributes added: - `hx-indicator="tr.notready td.message span"`: attach the loading spinner to the files whose last commit is still being loaded - `hx-trigger="load"` trigger the request-replace behavior as soon as possible - `hx-swap="morph"`: use the idiomorph morphing algorithm, this is the thing that makes it so the elipsis button event listener is kept during the replacement, fixing the bug because we don't actually replace the table, only modifying it - `hx-post="{{.LastCommitLoaderURL}}"`: make a post request to this url to get the table with all of the commit information As part of this change I removed the handling of partial replacement in the case we have less than 200 "not ready" files. The first reason is that I couldn't make htmx replace only a subset of returned elements, the second reason is that we have a cache implemented in the backend already so the only cost added is that we query the cache a few times (which is sure to be populated due to the initial request), and the last reason is that since the last refactor of this functionality that removed jQuery we don't properly send the "not ready" entries as the backend expects `FormData` with `f[]` and we send a JSON with `f` so we always query for all rows anyway. # Before ![before](https://github.com/go-gitea/gitea/assets/20454870/482ebfec-66c5-40cc-9c1e-e3b3bfe1bbc1) # After ![after](https://github.com/go-gitea/gitea/assets/20454870/454c517e-3a4e-4006-a49f-99cc56e0fd60) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix incorrect relative/absolute URL usages (#29531)wxiaoguang2024-03-021-1/+1
| | | | Add two "HTMLURL" methods for PackageDescriptor. And rename "FullWebLink" to "VersionWebLink"
* remove util.OptionalBool and related functions (#29513)65432024-03-0217-92/+87
| | | | | | and migrate affected code _last refactoring bits to replace **util.OptionalBool** with **optional.Option[bool]**_
* Make PR form use toast to show error message (#29545)wxiaoguang2024-03-024-20/+20
| | | ![image](https://github.com/go-gitea/gitea/assets/2114189/b7a14ed6-db89-4f21-a590-66cd33307233)
* Fix a bug returning 404 when display a single tag with no release (#29466)Lunny Xiao2024-03-021-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Partially caused by #29149 When use ```go releases, err := getReleaseInfos(ctx, &repo_model.FindReleasesOptions{ ListOptions: db.ListOptions{Page: 1, PageSize: 1}, RepoID: ctx.Repo.Repository.ID, TagNames: []string{ctx.Params("*")}, // only show draft releases for users who can write, read-only users shouldn't see draft releases. IncludeDrafts: writeAccess, }) ``` replace ```go release, err := repo_model.GetRelease(ctx, ctx.Repo.Repository.ID, ctx.Params("*")) ``` It missed `IncludeTags: true,`. That means this bug will be occupied only when the release is a tag. This PR will fix - Get the right tag record when it's not a release - Display correct tag tab but not release tag when it's a tag. - The button will bring the tag name to the new page when it's a single tag page - the new page will automatically hide the release target inputbox when the tag name is pre filled. This should be backport to v1.21.
* Fix incorrect redirection when creating a PR fails (#29537)wxiaoguang2024-03-021-1/+1
| | | | | | | | | | | This is only a quick fix to make it easier to backport. After this PR gets merged, I will propose a new PR to fix the FIXME. <details> ![image](https://github.com/go-gitea/gitea/assets/2114189/98d1d5c4-2e79-4a75-80e9-76fd898986e0) </details>
* Actions Artifacts v4 backend (#28965)ChristopherHX2024-03-021-0/+23
| | | | | | | | | | Fixes #28853 Needs both https://gitea.com/gitea/act_runner/pulls/473 and https://gitea.com/gitea/act_runner/pulls/471 on the runner side and patched `actions/upload-artifact@v4` / `actions/download-artifact@v4`, like `christopherhx/gitea-upload-artifact@v4` and `christopherhx/gitea-download-artifact@v4`, to not return errors due to GHES not beeing supported yet.
* Allow options to disable user gpg keys configuration from the interface on ↵Lunny Xiao2024-03-021-0/+10
| | | | | | | | app.ini (#29486) Follow #29447 Fix #29454 Extract from #20549
* Fix issue & comment history bugs (#29525)wxiaoguang2024-03-011-1/+5
| | | | | | * Follow #17746: `HasIssueContentHistory` should use expr builder to make sure zero value (0) be respected. * Add "doer" check to make sure `canSoftDeleteContentHistory` only be called by sign-in users.
* Use a predictiable fork URL to allow forking repositories without providing ↵wxiaoguang2024-03-012-5/+3
| | | | | | | | | | a repo ID (#29519) Close #29512 The "fork" URL: * Before: `/repo/fork/{RepoID}` * After: `/{OwnerName}/{RepoName}/fork`
* Rename Str2html to SanitizeHTML and clarify its behavior (#29516)wxiaoguang2024-03-013-5/+5
| | | | | Str2html was abused a lot. So use a proper name for it: SanitizeHTML And add some tests to show its behavior.
* Refactor some Str2html code (#29397)wxiaoguang2024-03-015-13/+20
| | | | | | | | | | | | | | | This PR touches the most interesting part of the "template refactoring". 1. Unclear variable type. Especially for "web/feed/convert.go": sometimes it uses text, sometimes it uses HTML. 2. Assign text content to "RenderedContent" field, for example: ` project.RenderedContent = project.Description` in web/org/projects.go 3. Assign rendered content to text field, for example: `r.Note = rendered content` in web/repo/release.go 4. (possible) Incorrectly calling `{{Str2html .PackageDescriptor.Metadata.ReleaseNotes}}` in package/content/nuget.tmpl, I guess the name Str2html misleads developers to use it to "render string to html", but it only sanitizes. if ReleaseNotes really contains HTML, then this is not a problem.
* Move migration functions to services layer (#29497)Lunny Xiao2024-03-011-2/+1
|
* migrate some more "OptionalBool" to "Option[bool]" (#29479)65432024-02-2911-33/+37
| | | | | | | | just some refactoring bits towards replacing **util.OptionalBool** with **optional.Option[bool]** --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix incorrect user location link on profile page (#29474)wxiaoguang2024-02-281-2/+3
| | | Fix #29472. Regression of #29236, a "if" check was missing.
* Move generate from module to service (#29465)Lunny Xiao2024-02-281-1/+1
|
* Let ctx.FormOptionalBool() return optional.Option[bool] (#29461)65432024-02-282-2/+4
| | | | just some refactoring bits towards replacing **util.OptionalBool** with **optional.Option[bool]**
* Implement actions badge svgs (#28102)Nanguan Lin2024-02-272-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | replace #27187 close #23688 The badge has two parts: label(workflow name) and message(action status). 5 colors are provided with 7 statuses. Color mapping: ```go var statusColorMap = map[actions_model.Status]string{ actions_model.StatusSuccess: "#4c1", // Green actions_model.StatusSkipped: "#dfb317", // Yellow actions_model.StatusUnknown: "#97ca00", // Light Green actions_model.StatusFailure: "#e05d44", // Red actions_model.StatusCancelled: "#fe7d37", // Orange actions_model.StatusWaiting: "#dfb317", // Yellow actions_model.StatusRunning: "#dfb317", // Yellow actions_model.StatusBlocked: "#dfb317", // Yellow } ``` preview: ![1](https://github.com/go-gitea/gitea/assets/70063547/5465cbaf-23cd-4437-9848-2738c3cb8985) ![2](https://github.com/go-gitea/gitea/assets/70063547/ec393d26-c6e6-4d38-b72c-51f2494c5e71) ![3](https://github.com/go-gitea/gitea/assets/70063547/3edb4fdf-1b08-4a02-ab2a-6bdd7f532fb2) ![4](https://github.com/go-gitea/gitea/assets/70063547/8c189de2-2169-4251-b115-0e39a52f3df8) ![5](https://github.com/go-gitea/gitea/assets/70063547/3fe22c73-c2d7-4fec-9ea4-c501a1e4e3bd) --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: delvh <dev.lh@web.de>
* Allow to change primary email before account activation (#29412)wxiaoguang2024-02-272-5/+30
|
* Only use supported sort order for "explore/users" page (#29430)wxiaoguang2024-02-272-4/+32
| | | | | | | | | | | | | | Thanks to inferenceus : some sort orders on the "explore/users" page could list users by their lastlogintime/updatetime. It leaks user's activity unintentionally. This PR makes that page only use "supported" sort orders. Removing the "sort orders" could also be a good solution, while IMO at the moment keeping the "create time" and "name" orders is also fine, in case some users would like to find a target user in the search result, the "sort order" might help. ![image](https://github.com/go-gitea/gitea/assets/2114189/ce5c39c1-1e86-484a-80c3-33cac6419af8)
* Not trigger all jobs any more, when re-running the first job (#29439)sillyguodong2024-02-271-3/+8
| | | | | Previously, it will be treated as "re-run all jobs" when `jobIndex == 0`. So when you click re-run button on the first job, it triggers all the jobs actually.
* Move context from modules to services (#29440)Lunny Xiao2024-02-27150-168/+165
| | | | | | | | | | | | | | | Since `modules/context` has to depend on `models` and many other packages, it should be moved from `modules/context` to `services/context` according to design principles. There is no logic code change on this PR, only move packages. - Move `code.gitea.io/gitea/modules/context` to `code.gitea.io/gitea/services/context` - Move `code.gitea.io/gitea/modules/contexttest` to `code.gitea.io/gitea/services/contexttest` because of depending on context - Move `code.gitea.io/gitea/modules/upload` to `code.gitea.io/gitea/services/context/upload` because of depending on context
* Refactor "user/active" related logic (#29390)wxiaoguang2024-02-251-59/+66
| | | | | And add more tests. Remove a lot of fragile "if" blocks. The old logic is kept as-is.
* Add attachment support for code review comments (#29220)Jimmy Praet2024-02-254-1/+37
| | | | | | | Fixes #27960, #24411, #12183 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor modules/git global variables (#29376)wxiaoguang2024-02-252-2/+2
| | | Move some global variables into a struct to improve maintainability
* Remove RenderEmojiPlain from template helper (#29375)wxiaoguang2024-02-242-2/+4
| | | | | | | | | | RenderEmojiPlain(emoji.ReplaceAliases) should be called explicitly for some contents, but not for everything. Actually in modern days, in most cases it doesn't need such "ReplaceAliases". So only keep it for issue/PR titles. If anyone really needs to do ReplaceAliases for some contents, I will propose a following fix.
* Refactor git attributes (#29356)KN4CK3R2024-02-241-5/+2
|
* Customizable "Open with" applications for repository clone (#29320)wxiaoguang2024-02-243-10/+87
| | | | | | | | Users could customize the "clone" menu with their own application URLs on the admin panel. Replace #22378 Close #21121 Close #22149
* Allow non-admin users to delete review requests (#29057)Zettat1232024-02-241-17/+4
| | | | | | | | Fix #14459 The following users can add/remove review requests of a PR - the poster of the PR - the owner or collaborators of the repository - members with read permission on the pull requests unit
* Do not double close reader (#29354)KN4CK3R2024-02-241-3/+0
| | | | | | | Fixes #29346 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Implement recent commits graph (#29210)Şahin Akkaya2024-02-242-0/+45
| | | | | | | This is the implementation of Recent Commits page. This feature was mentioned on #18262. It adds another tab to Activity page called Recent Commits. Recent Commits tab shows number of commits since last year for the repository.
* Use the database object format name but not read from git repoisitory ↵Lunny Xiao2024-02-243-8/+5
| | | | | | | | | | | | | everytime and fix possible migration wrong objectformat when migrating a sha256 repository (#29294) Now we can get object format name from git command line or from the database repository table. Assume the column is right, we don't need to read from git command line every time. This also fixed a possible bug that the object format is wrong when migrating a sha256 repository from external. <img width="658" alt="image" src="https://github.com/go-gitea/gitea/assets/81045/6e9a9dcf-13bf-4267-928b-6bf2c2560423">
* Revert "Support SAML authentication (#25165)" (#29358)65432024-02-247-326/+39
| | | | | | | | | | This reverts #25165 (5bb8d1924d77c675467694de26697b876d709a17), as there was a chance some important reviews got missed. so after reverting this patch it will be resubmitted for reviewing again https://github.com/go-gitea/gitea/pull/25165#issuecomment-1960670242 temporary Open #5512 again
* Implement code frequency graph (#29191)Şahin Akkaya2024-02-232-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Overview This is the implementation of Code Frequency page. This feature was mentioned on these issues: #18262, #7392. It adds another tab to Activity page called Code Frequency. Code Frequency tab shows additions and deletions over time since the repository existed. Before: <img width="1296" alt="image" src="https://github.com/go-gitea/gitea/assets/32161460/2603504f-aee7-4929-a8c4-fb3412a7a0f6"> After: <img width="1296" alt="image" src="https://github.com/go-gitea/gitea/assets/32161460/58c03721-729f-4536-a663-9f337f240963"> --- #### Features - See additions deletions over time since repository existed - Click on "Additions" or "Deletions" legend to show only one type of contribution - Use the same cache from Contributors page so that the loading of data will be fast once it is cached by visiting either one of the pages --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Allow options to disable user deletion from the interface on app.ini (#29275)Lunny Xiao2024-02-231-0/+6
| | | | | | | | | | | | | Extract from #20549 This PR added a new option on app.ini `[admin]USER_DISABLED_FEATURES` to allow the site administrator to disable users visiting deletion user interface or allow. This options are also potentially allowed to define more features in future PRs. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Start to migrate from `util.OptionalBool` to `optional.Option[bool]` (#29329)65432024-02-235-7/+10
| | | just create transition helper and migrate two structs
* Unify organizations header (#29248)Tim-Nicas Oelschläger2024-02-233-33/+1
| | | | | | | | | | | | | | | Unify organizations header before: ![image](https://github.com/go-gitea/gitea/assets/72873130/74474e0d-33c3-4bbf-9324-d130ea2c62f8) after: ![image](https://github.com/go-gitea/gitea/assets/72873130/1c65de0d-fa0f-4b17-ab8d-067de8c7113b) --------- Co-authored-by: silverwind <me@silverwind.io>
* Support SAML authentication (#25165)techknowlogick2024-02-237-39/+326
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes https://github.com/go-gitea/gitea/issues/5512 This PR adds basic SAML support - Adds SAML 2.0 as an auth source - Adds SAML configuration documentation - Adds integration test: - Use bare-bones SAML IdP to test protocol flow and test account is linked successfully (only runs on Postgres by default) - Adds documentation for configuring and running SAML integration test locally Future PRs: - Support group mapping - Support auto-registration (account linking) Co-Authored-By: @jackHay22 --------- Co-authored-by: jackHay22 <jack@allspice.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: morphelinho <morphelinho@users.noreply.github.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: silverwind <me@silverwind.io>
* Remove unnecessary "Str2html" modifier from templates (#29319)wxiaoguang2024-02-221-3/+4
| | | Follow #29165
* Fix error display when merging PRs (#29288)Zettat1232024-02-211-4/+4
| | | | | | | | Partially fix #29071, regression of Modernize merge button #28140 Fix some missing `Redirect` -> `JSONRedirect`. Thanks @yp05327 for the help in https://github.com/go-gitea/gitea/issues/29071#issuecomment-1931261075
* Do not use `ctx.Doer` when reset password (#29289)Jason Song2024-02-211-1/+1
| | | | | Fix #29278. Caused by a small typo in #28733
* Deduplicate translations for contributors graph (#29256)Şahin Akkaya2024-02-191-1/+1
| | | | | | | | | I have implemented three graph pages ([contributors](https://github.com/go-gitea/gitea/pull/27882), [code frequency](https://github.com/go-gitea/gitea/pull/29191) and [recent commits](https://github.com/go-gitea/gitea/pull/29210)) and they have all same page title as the tab name so I decided to use same translations for them. This PR is for contributors graph. Other PR's have their own respective commits.
* Show commit status for releases (#29149)KN4CK3R2024-02-191-87/+87
| | | | | Fixes #29082 ![grafik](https://github.com/go-gitea/gitea/assets/1666336/bb2ccde1-ee99-459d-9e74-0fb8ea79e8b3)
* Disallow merge when required checked are missing (#29143)Markus Amshove2024-02-191-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes #21892 This PR disallows merging a PR when not all commit status contexts configured in the branch protection are met. Previously, the PR was happy to merge when one commit status was successful and the other contexts weren't reported. Any feedback is welcome, first time Go :-) I'm also not sure if the changes in the template break something else Given the following branch protection: ![branch_protection](https://github.com/go-gitea/gitea/assets/2401875/f871b4e4-138b-435a-b496-f9ad432e3dec) This was shown before the change: ![before](https://github.com/go-gitea/gitea/assets/2401875/60424ff0-ee09-4fa0-856e-64e6e3fb0612) With the change, it is now shown as this: ![after](https://github.com/go-gitea/gitea/assets/2401875/4e464142-efb1-4889-8166-eb3be26c8f3d) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Artifact deletion in actions ui (#27172)FuXiaoHei2024-02-182-9/+43
| | | | | | | | | | | Add deletion link in runs view page. Fix #26315 ![image](https://github.com/go-gitea/gitea/assets/2142787/aa65a4ab-f434-4deb-b953-21e63c212033) When click deletion button. It marks this artifact `need-delete`. This artifact would be deleted when actions cleanup cron task.
* Refactor more code in templates (#29236)wxiaoguang2024-02-183-23/+5
| | | | | | | | Follow #29165. * Introduce JSONTemplate to help to render JSON templates * Introduce JSEscapeSafe for templates. Now only use `{{ ... | JSEscape}}` instead of `{{ ... | JSEscape | Safe}}` * Simplify "UserLocationMapURL" useage
* Load outdated comments when (un)resolving conversation on PR timeline (#29203)Jimmy Praet2024-02-172-3/+4
| | | | | | | | | Relates to #28654, #29039 and #29050. The "show outdated comments" flag should only apply to the file diff view. On the PR timeline, outdated comments are always shown. So they should also be loaded when (un)resolving a conversation on the timeline page.
* Fix missing template for follow button in organization (#29215)Yarden Shoham2024-02-171-1/+1
| | | | | | | | | | | | | | | Leftover from https://github.com/go-gitea/gitea/pull/29005 # Before ![before](https://github.com/go-gitea/gitea/assets/20454870/24c74278-ccac-4dc6-bf26-713e90c07239) # After ![after](https://github.com/go-gitea/gitea/assets/20454870/f91d503b-87d4-4c17-a56c-9c0a81fd9082) --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com>
* Fix broken following organization (#29005)yp053272024-02-171-2/+12
| | | | - following organization is broken from #28908 - add login check for the follow button in organization profile page