summaryrefslogtreecommitdiffstats
path: root/routers/web/repo
Commit message (Collapse)AuthorAgeFilesLines
* Fix various typos (#18219)luzpaz2022-01-101-1/+1
| | | | | Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby,te,unknwon` Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add warning for BIDI characters in page renders and in diffs (#17562)zeripath2022-01-074-16/+40
| | | | | | | | | | | | Fix #17514 Given the comments I've adjusted this somewhat. The numbers of characters detected are increased and include things like the use of U+300 to make à instead of à and non-breaking spaces. There is a button which can be used to escape the content to show it. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Gwyneth Morgan <gwymor@tilde.club> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add replay of webhooks. (#18191)KN4CK3R2022-01-051-1/+23
|
* Load EasyMDE/CodeMirror dynamically, remove RequireEasyMDE (#18069)wxiaoguang2022-01-057-19/+0
| | | This PR makes frontend load EasyMDE/CodeMirror dynamically, and removes `RequireEasyMDE`.
* Don't delete branch if other PRs with this branch are open (#18164)a10121127962022-01-032-1/+35
| | | | | fix #18149 Signed-off-by: a1012112796 <1012112796@qq.com>
* Remove unused route "/tasks/trigger" (#18160)Gusted2022-01-032-64/+0
| | | ref: https://github.com/go-gitea/gitea/pull/18160#issuecomment-1004091325
* Refactor auth package (#17962)Lunny Xiao2022-01-021-3/+3
|
* Unify and simplify TrN for i18n (#18141)wxiaoguang2022-01-023-17/+4
| | | | | Refer: https://github.com/go-gitea/gitea/pull/18135#issuecomment-1003246099 Now we have a unique and simple `TrN`, and make the fix of PR #18135 also use the better `TrN` logic.
* Use correct user when determining max repo limits for error messages (#18153)Gusted2022-01-023-3/+3
| | | - Use the correct user(`owner` instead of `ctx.User`) to get the maxCreationLimit.
* Allow admin to associate missing LFS objects for repositories (#18143)wxiaoguang2022-01-011-10/+18
| | | | | | | This PR reworked the Find pointer files feature in Settings -> LFS page. When a LFS object is missing from database but exists in LFS content store, admin can associate it to the repository by clicking the Associate button. This PR is not perfect (because the LFS module itself should be improved too), it's just a nice-to-have feature to help users recover their LFS repositories (eg: database was lost / table was truncated)
* Use correct translation key (#18135)Gusted2021-12-313-3/+22
| | | | | - Resolves #18122 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Removed unused method. (#18129)KN4CK3R2021-12-301-36/+0
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* When the git repository on storage is changed, the repository modal should ↵wxiaoguang2021-12-241-2/+24
| | | | | | | | | | also be updated (#18088) User would keep seeing an empty repo if: * An error occurs during the first git pushing/receiving * A user replaces the Gitea's empty repository manually Fix: when a user is viewing the repository web page, if the repoModal.IsEmpty is true, we check the git repository again to detect whether it is really empty. However: the IsEmpty flag is deeply broken and should be removed. For example it's possible for a repository to be non-empty by that flag but still 500 because there are no branches - only tags -or the default branch is non-extant as it has been 0-pushed.
* Improve interface when comparing a branch which has created a pull request ↵Lunny Xiao2021-12-241-0/+4
| | | | | | | | (#17911) * Improve interface when comparing a branch which has created a pull request * Take the note back
* Do not read or write git reference files directly (#18079)zeripath2021-12-231-2/+2
| | | | | | | | | | Git will and can pack references into packfiles and therefore if you write/read the files directly you will get false results. Instead you should use update-ref and show-ref. To that end I have created three new functions in git/repo_commit.go that will do this correctly. Related #17191 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Migrated Repository will show modifications when possible (#17191)99rgosse2021-12-231-1/+39
| | | | * Read patches to get history
* Ensure that git repository is closed before transfer (#18049)zeripath2021-12-211-0/+5
| | | | | | | | | | Repository Transfer requires that the repository directory is renamed - which is not possible on Windows if the git repository is open. Fix #17885 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Simplify parameter types (#18006)Gusted2021-12-203-5/+5
| | | Remove repeated type declarations in function definitions.
* Abort merge if head has been updated before pressing merge (#18032)zeripath2021-12-201-1/+6
| | | | | | | | | | | | | | | | | | | | | | | * Abort merge if head has been updated before pressing merge It is possible that a PR head may be pushed to between the merge page being shown and the merge button being pressed. Pass the current expected head in as a parameter and cancel the merge if it has changed. Fix #18028 Signed-off-by: Andrew Thornton <art27@cantab.net> * adjust swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net>
* Support open compare page directly (#17975)Lunny Xiao2021-12-171-14/+12
| | | | | | | | | * Support open compare page directly * simple code * Some improvements Co-authored-by: 6543 <6543@obermui.de>
* Add option to define refs in issue templates (#17842)qwerty2872021-12-171-0/+3
| | | | Adds a markdown header option `ref` that allows you to set the ref the issue should belong.
* Use JSON module instead of stdlib json (#18003)Gusted2021-12-171-1/+1
|
* Prevent hang in git cat-file if repository is not a valid repository and ↵zeripath2021-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | other fixes (#17991) This PR contains multiple fixes. The most important of which is: * Prevent hang in git cat-file if the repository is not a valid repository Unfortunately it appears that if git cat-file is run in an invalid repository it will hang until stdin is closed. This will result in deadlocked /pulls pages and dangling git cat-file calls if a broken repository is tried to be reviewed or pulls exists for a broken repository. Fix #14734 Fix #9271 Fix #16113 Otherwise there are a few small other fixes included which this PR was initially intending to fix: * Fix panic on partial compares due to missing PullRequestWorkInProgressPrefixes * Fix links on pulls pages due to regression from #17551 - by making most /issues routes match /pulls too - Fix #17983 * Fix links on feeds pages due to another regression from #17551 but also fix issue with syncing tags - Fix #17943 * Add missing locale entries for oauth group claims * Prevent NPEs if ColorFormat is called on nil users, repos or teams.
* Add Reindex buttons to repository settings page (#17494)zeripath2021-12-161-0/+47
| | | | | | | | | | This PR adds reindexing request buttons to the repository settings page. Fix #3796 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Shorten page title in file view (#17987)silverwind2021-12-151-1/+5
| | | | | | | | Move the more relevant sections of the page title earlier which make it possible to distinguish multiple tabs from each other when tab width is limited. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor HTTP request context (#17979)wxiaoguang2021-12-155-30/+30
|
* Add missing `X-Total-Count` and fix some related bugs (#17968)qwerty2872021-12-153-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add missing `X-Total-Count` and fix some related bugs Adds `X-Total-Count` header to APIs that return a list but doesn't have it yet. Fixed bugs: * not returned after reporting error (https://github.com/qwerty287/gitea/blob/39eb82446c6fe5da3d79124e1f701f3795625b69/routers/api/v1/user/star.go#L70) * crash with index out of bounds, API issue/issueSubscriptions I also found various endpoints that return lists but do not apply/support pagination yet: ``` /repos/{owner}/{repo}/issues/{index}/labels /repos/{owner}/{repo}/issues/comments/{id}/reactions /repos/{owner}/{repo}/branch_protections /repos/{owner}/{repo}/contents /repos/{owner}/{repo}/hooks/git /repos/{owner}/{repo}/issue_templates /repos/{owner}/{repo}/releases/{id}/assets /repos/{owner}/{repo}/reviewers /repos/{owner}/{repo}/teams /user/emails /users/{username}/heatmap ``` If this is not expected, an new issue should be opened. Closes #13043 * fmt * Update routers/api/v1/repo/issue_subscription.go Co-authored-by: KN4CK3R <admin@oldschoolhack.me> * Use FindAndCount Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de>
* Return nicer error for ForcePrivate (#17971)zeripath2021-12-141-1/+1
|
* Some repository refactors (#17950)Lunny Xiao2021-12-1210-37/+38
| | | | | | | | | * some repository refactors * remove unnecessary code * Fix test * Remove unnecessary banner
* Move keys to models/asymkey (#17917)Lunny Xiao2021-12-105-23/+32
| | | | | | | | | | | | | | | | | | | * Move keys to models/keys * Rename models/keys -> models/asymkey * change the missed package name * Fix package alias * Fix test * Fix docs * Fix test * Fix test * merge
* Clean legacy SimpleMDE code (#17926)wxiaoguang2021-12-107-19/+19
| | | | | | | | | | | Since we are using EasyMDE now, we do not need to keep the SimpleMDE code anymore. This PR removes all legacy SimpleMDE code, and makes some related changes: * `createCommentEasyMDE` can accept native DOM element, and it doesn't need `jQuery.data` to store EasyMDE editor object (as discussed about the frontend guideline). * introduce `getAttachedEasyMDE` to get the attached EasyMDE editor object, it's easier to find all the usage of EasyMDE. * rename variable names from `$simplemde` to `easyMDE`, the `$` was incorrect because it is a EasyMDE editor, not a jQuery object. With this PR, it will be easier to do more refactoring or replacing EasyMDE with other editors.
* Move repository model into models/repo (#17933)Lunny Xiao2021-12-1016-137/+163
| | | | | | | | | | | | | | | * Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
* Improve checkBranchName (#17901)zeripath2021-12-083-5/+5
| | | | | | | | | | | | The current implementation of checkBranchName is highly inefficient involving opening the repository, the listing all of the branch names checking them individually before then using using opened repo to get the tags. This PR avoids this by simply walking the references from show-ref instead of opening the repository (in the nogogit case). Signed-off-by: Andrew Thornton <art27@cantab.net>
* Support sorting for project board issuses (#17152)Anbraten2021-12-081-18/+38
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Allow default branch to be inferred on compare page (#17908)John Olheiser2021-12-061-3/+9
| | | | | | | | | | | * Allow default branch to be inferred Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add test for inferred default branch Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Move repo archiver to models/repo (#17913)Lunny Xiao2021-12-061-9/+9
| | | | | | | | | | | * Move repo archiver to models/repo * Move archiver service into services/repository/ * Fix imports * Fix test * Fix test
* Fix the bug: no wiki page can be created if the repo didn't have any page ↵wxiaoguang2021-12-031-6/+6
| | | | yet. (#17894)
* Add hints for special Wiki pages (#17283)n2021-12-031-0/+3
| | | * Add UI hints to create a Wiki sidebar and footer
* Refactor various strings (#17784)mscherer2021-12-021-1/+1
| | | | | | | | Fixes #16478 Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Make Requests Processes and create process hierarchy. Associate ↵zeripath2021-11-305-10/+8
| | | | | | | | | OpenRepository with context. (#17125) This PR registers requests with the process manager and manages hierarchy within the processes. Git repos are then associated with a context, (usually the request's context) - with sub commands using this context as their base context. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move accessmode into models/perm (#17828)Lunny Xiao2021-11-287-18/+24
|
* Disable ref selection dropdown if you don't have permissions to use it (#17837)qwerty2872021-11-281-2/+0
| | | | Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Allow forks to org if you can create repos (#17783)qwerty2872021-11-251-6/+6
|
* Move user related model into models/user (#17781)Lunny Xiao2021-11-2415-95/+113
| | | | | | | | | | | | | * Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
* Move repofiles from modules/repofiles to services/repository/files (#17774)Lunny Xiao2021-11-242-12/+12
| | | | | | | | | * Move repofiles from modules to services * rename services/repository/repofiles -> services/repository/files * Fix test Co-authored-by: 6543 <6543@obermui.de>
* Remove unnecessary attributes of User struct (#17745)Lunny Xiao2021-11-227-18/+24
| | | | | | | | | | | | | | | * Remove unnecessary functions of User struct * Move more database methods out of user struct * Move more database methods out of user struct * Fix template failure * Fix bug * Remove finished FIXME * remove unnecessary code
* Fix navbar on project view (#17749)Gusted2021-11-221-1/+1
| | | - Shows that the project nav item is active when you're viewing a project.
* Allow Loading of Diffs that are too large (#17739)zeripath2021-11-223-19/+51
| | | | | | | | | | | * Allow Loading of Diffs that are too large This PR allows the loading of diffs that are suppressed because the file is too large. It does not handle diffs of files which have lines which are too long. Fix #17738 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use `hostmatcher` to replace `matchlist`, improve security (#17605)wxiaoguang2021-11-202-6/+2
| | | | | Use hostmacher to replace matchlist. And we introduce a better DialContext to do a full host/IP check, otherwise the attackers can still bypass the allow/block list by a 302 redirection.
* Move attachment into models/repo/ (#17650)Lunny Xiao2021-11-193-12/+15
| | | | | | | * Move attachment into models/repo/ * Fix test * Fix bug