aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/org
Commit message (Collapse)AuthorAgeFilesLines
* Refactor names (#31405)wxiaoguang2024-06-195-31/+31
| | | | | | | This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
* Add missed return after `ctx.ServerError` (#31130)Lunny Xiao2024-05-281-0/+1
|
* Rename project board -> column to make the UI less confusing (#30170)Lunny Xiao2024-05-272-62/+60
| | | | | | | | | | | | | This PR split the `Board` into two parts. One is the struct has been renamed to `Column` and the second we have a `Template Type`. But to make it easier to review, this PR will not change the database schemas, they are just renames. The database schema changes could be in future PRs. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: yp05327 <576951401@qq.com>
* Fix various problems around projects board view (#30696)Lunny Xiao2024-05-081-69/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | # The problem The previous implementation will start multiple POST requests from the frontend when moving a column and another bug is moving the default column will never be remembered in fact. # What's changed - [x] This PR will allow the default column to move to a non-first position - [x] And it also uses one request instead of multiple requests when moving the columns - [x] Use a star instead of a pin as the icon for setting the default column action - [x] Inserted new column will be append to the end - [x] Fix #30701 the newly added issue will be append to the end of the default column - [x] Fix when deleting a column, all issues in it will be displayed from UI but database records exist. - [x] Add a limitation for columns in a project to 20. So the sorting will not be overflow because it's int8. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix project description rendering for org (#30587)wxiaoguang2024-04-191-2/+2
| | | | | | | | Fix #30263 ![image](https://github.com/go-gitea/gitea/assets/2114189/41cabe6c-f94a-4874-a26f-d01bb89bb28c) Co-authored-by: Giteabot <teabot@gitea.io>
* Fix network error when open/close organization/individual projects and ↵yp053272024-04-131-4/+4
| | | | | | | | | | | redirect to project page (#30387) Follow #27734 ![image](https://github.com/go-gitea/gitea/assets/18380374/02ed6b9a-cbb6-4f49-a54a-ca76a0d052a9) Updated: Redirect to project page instead of project list page.
* Add default board to new projects, remove uncategorized pseudo-board (#29874)Denys Konovalov2024-03-271-90/+18
| | | | | | | | | | | | | | | | | | On creation of an empty project (no template) a default board will be created instead of falling back to the uneditable pseudo-board. Every project now has to have exactly one default boards. As a consequence, you cannot unset a board as default, instead you have to set another board as default. Existing projects will be modified using a cron job, additionally this check will run every midnight by default. Deleting the default board is not allowed, you have to set another board as default to do it. Fixes #29873 Fixes #14679 along the way Fixes #29853 Co-authored-by: delvh <dev.lh@web.de>
* Remove AddParamIfExist(AddParam) (#29841)wxiaoguang2024-03-162-2/+2
| | | | | | Follow #29834 Remove AddParamIfExist, use "AddParamString" instead, it should clearly know what is being added into the parameters.
* Refactor AddParam to AddParamIfExist (#29834)wxiaoguang2024-03-162-2/+2
| | | | | | | When read the code: `pager.AddParam(ctx, "search", "search")`, the question always comes: What is it doing? Where is the value from? Why "search" / "search" ? Now it is clear: `pager.AddParamIfExist("search", ctx.Data["search"])`
* Add user blocking (#29028)KN4CK3R2024-03-043-16/+61
| | | | | | | | | | | | | | | | | | | | | | 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>
* Filter Repositories by type (#29231)Tim-Niclas Oelschläger2024-03-031-0/+20
| | | | | | | | | | | | | Filter Repositories by type (resolves #1170, #1318) before: ![image](https://github.com/go-gitea/gitea/assets/72873130/74e6be62-9010-4ab4-8f9b-bd8afbebb8fb) after: ![image](https://github.com/go-gitea/gitea/assets/72873130/e4d85ed6-7864-4150-8d72-5194dac1293f)
* remove util.OptionalBool and related functions (#29513)65432024-03-021-4/+4
| | | | | | and migrate affected code _last refactoring bits to replace **util.OptionalBool** with **optional.Option[bool]**_
* Rename Str2html to SanitizeHTML and clarify its behavior (#29516)wxiaoguang2024-03-011-2/+2
| | | | | 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-011-2/+3
| | | | | | | | | | | | | | | 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 context from modules to services (#29440)Lunny Xiao2024-02-2711-11/+11
| | | | | | | | | | | | | | | 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
* Unify organizations header (#29248)Tim-Nicas Oelschläger2024-02-231-18/+0
| | | | | | | | | | | | | | | 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>
* Refactor locale&string&template related code (#29165)wxiaoguang2024-02-142-4/+4
| | | | | | Clarify when "string" should be used (and be escaped), and when "template.HTML" should be used (no need to escape) And help PRs like #29059 , to render the error messages correctly.
* bump to use go 1.22 (#29119)techknowlogick2024-02-141-4/+4
|
* Unify user update methods (#28733)KN4CK3R2024-02-041-38/+35
| | | | | | | | | | | Fixes #28660 Fixes an admin api bug related to `user.LoginSource` Fixed `/user/emails` response not identical to GitHub api This PR unifies the user update methods. The goal is to keep the logic only at one place (having audit logs in mind). For example, do the password checks only in one method not everywhere a password is updated. After that PR is merged, the user creation should be next.
* Improve user search display name (#29002)KN4CK3R2024-02-011-2/+1
| | | | | | | | | | | | | | | | | I tripped over this strange method and I don't think we need that workaround to fix the value. old: ![grafik](https://github.com/go-gitea/gitea/assets/1666336/c8b6797b-eb45-4dec-99db-1b0649a34ec5) new: ![grafik](https://github.com/go-gitea/gitea/assets/1666336/ab1a65ae-de5b-4ce4-9813-3b8b39c7922e) --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Rework markup link rendering (#26745)KN4CK3R2024-01-151-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #26548 This PR refactors the rendering of markup links. The old code uses `strings.Replace` to change some urls while the new code uses more context to decide which link should be generated. The added tests should ensure the same output for the old and new behaviour (besides the bug). We may need to refactor the rendering a bit more to make it clear how the different helper methods render the input string. There are lots of options (resolve links / images / mentions / git hashes / emojis / ...) but you don't really know what helper uses which options. For example, we currently support images in the user description which should not be allowed I think: <details> <summary>Profile</summary> https://try.gitea.io/KN4CK3R ![grafik](https://github.com/go-gitea/gitea/assets/1666336/109ae422-496d-4200-b52e-b3a528f553e5) </details> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix wrong link in user and organization profile when using relative url (#28617)katsu2023-12-271-6/+11
| | | | | | | | | | fix #28436. the doc https://docs.gitea.com/usage/profile-readme maybe also need to be updated to tell that the main branch is necessary,which means the following three conditions should be satisfied: - repo: **.profile** - branch: **[default branch]** - markdown: **README.md**
* Use db.Find instead of writing methods for every object (#28084)Lunny Xiao2023-11-243-5/+12
| | | | For those simple objects, it's unnecessary to write the find and count methods again and again.
* Improve profile for Organizations (#27982)yp053272023-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes some problems in #27955: - autofocus of the search box before: if access the home page will jump to the search box ![image](https://github.com/go-gitea/gitea/assets/18380374/7f100e8d-2bd6-4563-85ba-d6008ffc71d7) after: will not jump to the search box ![image](https://github.com/go-gitea/gitea/assets/18380374/9aab382c-8ebe-4d18-b990-4adbb6c341ad) - incorrect display of overview tab before: ![image](https://github.com/go-gitea/gitea/assets/18380374/b24c79e8-9b79-4576-9276-43bd19172043) after: ![image](https://github.com/go-gitea/gitea/assets/18380374/7aab5827-f086-4874-bd84-39bd81b872f3) - improve the permission check to the private profile repo In #26295, we simply added access control to the private profile. But if user have access to the private profile repo , we should also display the profile. - add a button which can jump to the repo list? I agree @wxiaoguang 's opinion here: https://github.com/go-gitea/gitea/pull/27955#issuecomment-1803178239 But it seems that this feature is sponsored. So can we add a button which can quickly jump to the repo list or just move profile to the `overview` page? --------- Co-authored-by: silverwind <me@silverwind.io>
* Add Profile Readme for Organisations (#27955)65432023-11-091-0/+26
| | | | | | | | | | | | | | | | | https://blog.gitea.com/release-of-1.20.0/#-user-profile-readme-23260 (#23260) did introduce Profile Readme for Users. This makes it usable for Organisations: ![image](https://github.com/go-gitea/gitea/assets/24977596/464ab58b-a952-414b-8a34-6deaeb4f7d35) --- *Sponsored by Kithara Software GmbH* --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix the missing repo count in new team page and edit team page (#27743)8532023-10-251-0/+8
| | | | | | | | | | | | | | | | | Follow #26942 Before: ![image](https://github.com/go-gitea/gitea/assets/8389962/ffe3e914-c71c-493f-965b-369f27c70b4b) ![image](https://github.com/go-gitea/gitea/assets/8389962/eaad4f07-b8ce-4564-b883-97938de5ed79) After: ![image](https://github.com/go-gitea/gitea/assets/8389962/353aeabe-caf4-4449-8330-d3a29f9bd326) ![image](https://github.com/go-gitea/gitea/assets/8389962/baf59bb6-2c74-4a56-a28c-1519bc3d2594)
* Delete repos of org when purge delete user (#27273)JakobDev2023-10-191-2/+2
| | | | | | | Fixes https://codeberg.org/forgejo/forgejo/issues/1514 I had to remove `RenameOrganization` to avoid circular import. We should really add some foreign keys to the database.
* Replace more db.DefaultContext (#27628)Lunny Xiao2023-10-152-4/+4
| | | Target #27065
* Final round of `db.DefaultContext` refactor (#27587)JakobDev2023-10-141-1/+1
| | | Last part of #27065
* Penultimate round of `db.DefaultContext` refactor (#27414)JakobDev2023-10-113-3/+3
| | | | | | | Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Even more `db.DefaultContext` refactor (#27352)JakobDev2023-10-033-7/+7
| | | | | | | | Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* More `db.DefaultContext` refactor (#27265)JakobDev2023-09-291-8/+8
| | | | | | | Part of #27065 This PR touches functions used in templates. As templates are not static typed, errors are harder to find, but I hope I catch it all. I think some tests from other persons do not hurt.
* make writing main test easier (#27270)Lunny Xiao2023-09-281-4/+1
| | | | | | | | | This PR removed `unittest.MainTest` the second parameter `TestOptions.GiteaRoot`. Now it detects the root directory by current working directory. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Another round of `db.DefaultContext` refactor (#27103)JakobDev2023-09-251-1/+1
| | | | | | | Part of #27065 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Next round of `db.DefaultContext` refactor (#27089)JakobDev2023-09-162-3/+3
| | | Part of #27065
* More refactoring of `db.DefaultContext` (#27083)JakobDev2023-09-151-1/+1
| | | Next step of #27065
* Reduce usage of `db.DefaultContext` (#27073)JakobDev2023-09-143-13/+13
| | | | | | | | | | | | | | Part of #27065 This reduces the usage of `db.DefaultContext`. I think I've got enough files for the first PR. When this is merged, I will continue working on this. Considering how many files this PR affect, I hope it won't take to long to merge, so I don't end up in the merge conflict hell. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* move repository deletion to service layer (#26948)Lunny Xiao2023-09-081-1/+2
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix the missing repo count (#26942)Nanguan Lin2023-09-071-0/+12
| | | | | | | | The commit (https://github.com/go-gitea/gitea/commit/958d148043a6ace08776b1fd5ec0a5859144dea0) forgot two pages :stuck_out_tongue_closed_eyes: ![ksnip_20230906-182626](https://github.com/go-gitea/gitea/assets/70063547/6da529e9-3028-46fb-8065-abfd804a078b) BTW, the `leave` button is in a weird position
* Show always repo count in header (#26842)JakobDev2023-09-065-0/+74
| | | | | | | | | | | | | | | | | A few pages don't load the repo count of an user/org, so it is not shown in the header. This happens mostly on org pages, but the package settings applies to the user page as well. Before: ![Screenshot 2023-08-31 at 12-45-36 Gitea Git with a cup of tea](https://github.com/go-gitea/gitea/assets/15185051/14a59998-2cf9-4771-82f4-5d1d6fcb31f4) After: ![grafik](https://github.com/go-gitea/gitea/assets/15185051/ff055aa0-7cde-49be-9522-437bf970be1d) Seen on #26826 Regression of #25928
* Fix the display of org level badges (#26504)yp053272023-09-064-4/+0
| | | | | | | | | | | Follow #24654 #22705 #24232 In some pages we still have missing badges, for example: ![image](https://github.com/go-gitea/gitea/assets/18380374/f57fae6d-95ad-4996-8881-160c9cd27768) ![image](https://github.com/go-gitea/gitea/assets/18380374/11e86d43-b715-4d14-bdf0-51bf8b5c7b01) ![image](https://github.com/go-gitea/gitea/assets/18380374/61c514e7-d8f6-4c93-a61f-60604619e3a7)
* Move web/api context related testing function into a separate package (#26859)wxiaoguang2023-09-011-3/+3
| | | | | | | | | Just like `models/unittest`, the testing helper functions should be in a separate package: `contexttest` And complete the TODO: > // TODO: move this function to other packages, because it depends on "models" package
* Make "link-action" backend code respond correct JSON content (#26680)wxiaoguang2023-08-231-1/+1
| | | | | Otherwise the `link-action` JS code couldn't parse the response. Co-authored-by: Giteabot <teabot@gitea.io>
* Fix display problems of members and teams unit (#26363)yp053272023-08-151-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix: - display member count and team count in the menu bar ![image](https://github.com/go-gitea/gitea/assets/18380374/7f03ced4-67e2-41ce-b19f-a992823726bb) - Also display member unit in the menu bar if there are no hidden members in public org ![image](https://github.com/go-gitea/gitea/assets/18380374/31422ad6-7190-438d-8e99-8a4af9cce908) - hidden member board when there's no seeable members. In this org, we only have hidden members: ![image](https://github.com/go-gitea/gitea/assets/18380374/d749420b-554a-4483-8cd2-221df61b5ca7) We will hidden the member board when doer is not the member of this org ![image](https://github.com/go-gitea/gitea/assets/18380374/93bb782e-7d4d-4ad3-a096-133afbc51f8a) Before: ![image](https://github.com/go-gitea/gitea/assets/18380374/eafc0b3e-6218-42ab-a892-39645d08a5eb) If you click the number in the members board, you will access the members page, which is not expected. ![image](https://github.com/go-gitea/gitea/assets/18380374/73d6dadc-0ef2-4ca9-8485-c5f4211bffb2) --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Allow to archive labels (#26478)puni98692023-08-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ## Archived labels This adds the structure to allow for archived labels. Archived labels are, just like closed milestones or projects, a medium to hide information without deleting it. It is especially useful if there are outdated labels that should no longer be used without deleting the label entirely. ## Changes 1. UI and API have been equipped with the support to mark a label as archived 2. The time when a label has been archived will be stored in the DB ## Outsourced for the future There's no special handling for archived labels at the moment. This will be done in the future. ## Screenshots ![image](https://github.com/go-gitea/gitea/assets/80308335/208f95cd-42e4-4ed7-9a1f-cd2050a645d4) ![image](https://github.com/go-gitea/gitea/assets/80308335/746428e0-40bb-45b3-b992-85602feb371d) Part of https://github.com/go-gitea/gitea/issues/25237 --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor project templates (#26448)Denys Konovalov2023-08-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR refactors a bunch of projects-related code, mostly the templates. The following things were done: - rename boards to columns in frontend code - use the new `ctx.Locale.Tr` method - cleanup template, remove useless newlines, classes, comments - merge org-/user and repo level project template together - move "new column" button into project toolbar - move issue card (shared by projects and pinned issues) to shared template, remove useless duplicated styles - add search function to projects (to make the layout more similar to milestones list where it is inherited from :laughing:) - maybe more changes I forgot I've done :laughing: Closes #24893 After: ![Bildschirmfoto vom 2023-08-10 23-02-00](https://github.com/go-gitea/gitea/assets/47871822/cab61456-1d23-4373-8163-e567f1b3b5f9) ![Bildschirmfoto vom 2023-08-10 23-02-26](https://github.com/go-gitea/gitea/assets/47871822/94b55d60-5572-48eb-8111-538a52d8bcc6) ![Bildschirmfoto vom 2023-08-10 23-02-46](https://github.com/go-gitea/gitea/assets/47871822/a0358f4b-4e05-4194-a7bc-6e0ecba5a9b6) --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix 404 error when remove self from an organization (#26362)yp053272023-08-121-16/+16
| | | | | | Same to #24322 Not only `leave` action but also `remove` action should check whether user still belongs to the org.
* Count only visible repos on profile (#25928)JakobDev2023-08-112-0/+32
| | | Fixes #25914
* Move web JSON functions to web context and simplify code (#26132)wxiaoguang2023-07-265-45/+15
| | | | | | | | | The JSONRedirect/JSONOK/JSONError functions were put into "Base" context incorrectly, it would cause abuse. Actually, they are for "web context" only, so, move them to the correct place. And by the way, use them to simplify old code: +75 -196
* Allow Organisations to have a E-Mail (#25082)JakobDev2023-07-251-0/+1
| | | | | | | | | | | | | | | | | | | | Resolves #25057 This adds a E-Mail field to Organisations. The E-Mail is just shown on the Profile when it is visited by a logged in User. The E-mail is not used for something else. **Screenshots:** ![grafik](https://github.com/go-gitea/gitea/assets/15185051/a8d622b3-7278-4c08-984b-9c5ebfdb5471) ![grafik](https://github.com/go-gitea/gitea/assets/15185051/6dcb1dd7-d04b-49eb-bc96-6582cfe9757b) --------- Co-authored-by: Denys Konovalov <kontakt@denyskon.de> Co-authored-by: Denys Konovalov <privat@denyskon.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>