aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue.go
Commit message (Collapse)AuthorAgeFilesLines
* Move repository model into models/repo (#17933)Lunny Xiao2021-12-101-35/+36
| | | | | | | | | | | | | | | * 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
* Support sorting for project board issuses (#17152)Anbraten2021-12-081-0/+2
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor various strings (#17784)mscherer2021-12-021-2/+3
| | | | | | | | Fixes #16478 Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Move accessmode into models/perm (#17828)Lunny Xiao2021-11-281-1/+2
|
* Move user related model into models/user (#17781)Lunny Xiao2021-11-241-41/+42
| | | | | | | | | | | | | * Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
* Improvements to content history (#17746)Jimmy Praet2021-11-221-7/+13
| | | | | | | | | | | * Improvements to content history * initialize content history when making an edit to an old item created before the introduction of content history * show edit history for code comments on pull request files tab * Fix a flaw in keepLimitedContentHistory Fix a flaw in keepLimitedContentHistory, the first and the last should never be deleted * Remove obsolete eager initialization of content history
* Remove NewSession method from db.Engine interface (#17577)Lunny Xiao2021-11-211-13/+8
| | | | | | | | | | | | | * Remove NewSession method from db.Engine interface * Fix bug * Some improvements * Fix bug * Fix test * Use XXXBean instead of XXXExample
* Move attachment into models/repo/ (#17650)Lunny Xiao2021-11-191-55/+61
| | | | | | | * Move attachment into models/repo/ * Fix test * Fix bug
* Added comment for changing issue ref (#17672)Gusted2021-11-191-0/+18
| | | | | * Added comment for changing issue ref - Add a comment when someone changes the ref(erence?) of a issue.
* Prevent NPE due to missing repo in regression in #17551 (#17697)zeripath2021-11-181-2/+14
|
* Multiple Escaping Improvements (#17551)zeripath2021-11-161-0/+11
| | | | | | | | | | | | | | There are multiple places where Gitea does not properly escape URLs that it is building and there are multiple places where it builds urls when there is already a simpler function available to use this. This is an extensive PR attempting to fix these issues. 1. The first commit in this PR looks through all href, src and links in the Gitea codebase and has attempted to catch all the places where there is potentially incomplete escaping. 2. Whilst doing this we will prefer to use functions that create URLs over recreating them by hand. 3. All uses of strings should be directly escaped - even if they are not currently expected to contain escaping characters. The main benefit to doing this will be that we can consider relaxing the constraints on user names and reponames in future. 4. The next commit looks at escaping in the wiki and re-considers the urls that are used there. Using the improved escaping here wiki files containing '/'. (This implementation will currently still place all of the wiki files the root directory of the repo but this would not be difficult to change.) 5. The title generation in feeds is now properly escaped. 6. EscapePound is no longer needed - urls should be PathEscaped / QueryEscaped as necessary but then re-escaped with Escape when creating html with locales Signed-off-by: Andrew Thornton <art27@cantab.net> Signed-off-by: Andrew Thornton <art27@cantab.net>
* Refactor commentTags functionality (#17558)Gusted2021-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * feat: Allow multiple tags on comments - Allow for multiples tags(Currently Poster + {Owner, Writer}). - Utilize the Poster tag within the commentTag function and remove the checking from templates. - Use bitwise on CommentTags to enable specific tags. - Don't show poster tag(view_content.tmpl) on the initial issue comment. * Change parameters naming * Change function name * refactor variable wording * Merge 'master' branch into 'tags-comments' branch * Change naming * `tag` -> `role` Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Move unit into models/unit/ (#17576)Lunny Xiao2021-11-091-2/+3
| | | | | * Move unit into models/unit/ * Rename unit.UnitType as unit.Type
* Fix stats upon searching issues (#17566)Gusted2021-11-081-5/+5
| | | | | | | | | | | * Fix stat chunks searching - Fixes a issue whereby the given chunk of issueIDs wasn't respected and thus the returned results where not the correct results. * Add tests Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Avoid double imports (#17569)Gusted2021-11-081-3/+2
| | | | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix issue content history problems, improve UI (#17404)wxiaoguang2021-10-231-2/+2
| | | | | * Improve: make diff result better, make the HTML element fit the full height in the content history diff dialog * Bug fix: when edit the main issue, the poster is wrongly set to the issue poster
* Save and view issue/comment content history (#16909)wxiaoguang2021-10-101-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * issue content history * Use timeutil.TimeStampNow() for content history time instead of issue/comment.UpdatedUnix (which are not updated in time) * i18n for frontend * refactor * clean up * fix refactor * re-format * temp refactor * follow db refactor * rename IssueContentHistory to ContentHistory, remove empty model tags * fix html * use avatar refactor to generate avatar url * add unit test, keep at most 20 history revisions. * re-format * syntax nit * Add issue content history table * Update models/migrations/v197.go Co-authored-by: 6543 <6543@obermui.de> * fix merge Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix problem when database ID is not incremented as expected (#17229)finga2021-10-061-1/+1
| | | | | | Although #17124 fixed the same issue for the feed, some other parts with the same issue were found. Co-authored-by: finga <finga@onders.org>
* Always set a unique Message-ID header. (#17206)KN4CK3R2021-10-011-13/+0
|
* Move login related structs and functions to models/login (#17093)Lunny Xiao2021-09-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move login related structs and functions to models/login * Fix test * Fix lint * Fix lint * Fix lint of windows * Fix lint * Fix test * Fix test * Only load necessary fixtures when preparing unit tests envs * Fix lint * Fix test * Fix test * Fix error log * Fix error log * Fix error log * remove unnecessary change * fix error log * merge main branch
* DBContext is just a Context (#17100)zeripath2021-09-231-73/+74
| | | | | | | | | | | | | | | | | | | | | | | | | * DBContext is just a Context This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net> * fix unit tests Signed-off-by: Andrew Thornton <art27@cantab.net> * another place that needs to set the initial context Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid race Signed-off-by: Andrew Thornton <art27@cantab.net> * change attachment error Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-191-145/+156
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Alter issue/comment table TEXT fields to LONGTEXT (#16765)wxiaoguang2021-08-221-1/+1
| | | | | | | * Alter issue/comment table TEXT fields to LONGTEXT * Use If not Switch Co-authored-by: zeripath <art27@cantab.net>
* Update issue_index to finish migration (#16685)65432021-08-131-0/+25
| | | | | * update issue_index to finish migration * One Func to RecalculateIssueIndexForRepo
* [API] generalize list header (#16551)65432021-08-121-2/+2
| | | | | | | | | | | | | * Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
* Validate Issue Index before querying DB (#16406)Norwin2021-07-121-0/+3
|
* Update milestone counters on new issue. (#16183)KN4CK3R2021-06-211-3/+5
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* [API] Issue Search Add filter for MilestoneNames (#16173)65432021-06-171-0/+8
|
* Use milestone deadline when sorting issues (#14551)koalp2021-06-141-2/+11
| | | | | | | | | | When sorting issues by deadline, the deadline of the milestone the issue is attached to wasn't taken into account. It have been changed and the nearest deadline is taken into account for sorting. Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add a new table issue_index to store the max issue index so that issue could ↵Lunny Xiao2021-06-141-29/+13
| | | | | | | | | | | | | | | | | | | | | | be deleted with no duplicated index (#15599) * Add a new table issue_index to store the max issue index so that issue could be deleted with no duplicated index * Fix pull index * Add tests for concurrent creating issues * Fix lint * Fix tests * Fix postgres test * Add test for migration v180 * Rename wrong test file name Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix bug on getIssueIDsByRepoID (#16119)Lunny Xiao2021-06-101-1/+1
| | | | | * Fix bug on getIssueIDsByRepoID * Add test
* chore(models): rewrite code format. (#14754)Bo-Yi Wu2021-03-141-17/+18
| | | | | | | | | | | | | | | * chore: rewrite format. * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: Adjacent parameters with the same type should be grouped together * chore: update format.
* Never add labels not from this repository or organisation and remove org ↵zeripath2021-03-121-1/+13
| | | | | | | | | | | | | | | | | | labels on transfer (#14928) * Never add labels not from this repository or organisation and remove org labels on transfer Prevent the addition of labels from outside of the repository or organisation and remove organisation labels on transfer. Related #14908 * switch to use sql * subquery alias * once more around the merry go round * fix api problem
* Fix overdue marking of closed issues and milestones (#14923)zeripath2021-03-081-0/+3
| | | | | | | | Closed milestones and issues should only be marked overdue if they were closed after their deadline. Fix: #14536 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix issue search with db indexer because of mysql 5.7 sqlmode (#14907)Lunny Xiao2021-03-061-1/+10
| | | | | * Fix sqlmode bug * distinct is necessary
* Make searching issues by keyword case insensitive on DB (#14848)zeripath2021-03-021-3/+4
| | | | | | | | | | | | Most DBs apart from SQLite will use a default Collation that is not case insensitive. This means that SearchIssuesByKeyword becomes case sensitive for db indexing - in contrast to the bleve and elastic indexers. This PR simply uses UPPER(...) to do the LIKE - and although it may be more efficient to change collations this would be a non-trivial task. Fix #13663 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Repository transfer has to be confirmed, if user can not create repo for new ↵65432021-03-011-1/+1
| | | | | | | owner (#14792) * make repo as "pending transfer" if on transfer start doer has no right to create repo in new destination * if new pending transfer ocured, create UI & Mail notifications
* Use OldRef instead of CommitSHA for DeleteBranch comments (#14604)zeripath2021-02-081-5/+5
| | | | | | | | Fix #14545 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix bug because of duplicated join (#14454)Lunny Xiao2021-01-261-2/+7
| | | | | | | | | | | | * Fix bug because of duplicated join * Move join into setupsession * Fix bug * Fix bug Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* exclude authored PRs from Review Requested filter (#14368)Jimmy Praet2021-01-181-0/+1
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Add review requested filter on pull request overview (#13701)Jimmy Praet2021-01-171-62/+97
| | | | | | | | | | | | | * Add review requested filter on pull request overview #13682 fix formatting * add review_requested filter to /repos/issues/search API endpoint * only Approve and Reject status should supersede Request status * add support for team reviews * refactor: remove duplication of issue filtering conditions
* Sort issue search results by revelance (#14353)Lauris BH2021-01-161-1/+1
|
* Issues overview should not show issues from archived repos (#13220)Elena Neuschild2021-01-121-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add lots of comments to user.Issues() * Answered some questions from comments * fix typo in comment * Refac user.Issues(): add func repoIDs * Refac user.Issues(): add func userRepoIDs * Refac user.Issues(): add func issueIDsFromSearch * Refac user.Issues(): improve error handling * Refac user.Issues(): add inline documentation and move variable declarations closer to their usages * Refac user.Issues(): add func repoIDMap * Refac user.Issues(): cleanup * Refac: Separate Issues from Pulls during routing * fix typo in comment * Adapt Unittests to Refactoring * Issue13171: Issue and PR Overviews now ignore archived Repositories * changed some verbatim SQL conditions to builder.Eq * models/issue.go: use OptionalBool properly Co-authored-by: 6543 <6543@obermui.de> * Use IsArchived rather than ExcludeArchivedRepos * fixed broken test after merge * added nil check * Added Unit Test securing Issue 13171 fix * Improved IsArchived filtering in issue.GetUserIssueStats * Removed unused func * Added grouping to avoid returning duplicate repo IDs Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Gitea <gitea@fake.local> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Send notifications for mentions in pulls, issues, (code-)comments (#14218)Jimmy Praet2021-01-021-0/+14
| | | | | Fixes #14187: mention handling extracted from email notification code Fixes #14013: add notification for mentions in pull request code comments Fixes #13450: Not receiving any emails with setting "Only Email on Mention"
* Fix dashboard issues labels filter bug (#14210)Lunny Xiao2021-01-011-12/+22
| | | Co-authored-by: zeripath <art27@cantab.net>
* migrate from com.* to alternatives (#14103)65432020-12-251-3/+3
| | | | | | | | | | | | | | | * remove github.com/unknwon/com from models * dont use "com.ToStr()" * replace "com.ToStr" with "fmt.Sprint" where its easy to do * more refactor * fix test * just "proxy" Copy func for now * as per @lunny
* Add mentionable teams to tributeValues and change team mention rules to gh's ↵a10121127962020-12-211-26/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | style (#13198) * Add mentionable teams to tributeValues Signed-off-by: a1012112796 <1012112796@qq.com> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Change team mention rules to gh's style * use org's avator as team avator in ui Signed-off-by: a1012112796 <1012112796@qq.com> * Update modules/markup/html.go * Update models/issue.go Co-authored-by: Lauris BH <lauris@nix.lv> * Update models/issue.go * fix a small nit and update test code Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* [API] Add more filters to issues search (#13514)65432020-11-231-0/+9
| | | | | | | | | | | * Add time filter for issue search * Add limit option for paggination * Add Filter for: Created by User, Assigned to User, Mentioning User * update swagger * Add Tests for limit, before & since
* (Re)Load issue labels when changing them (#13007)zeripath2020-10-051-0/+5
| | | | | | | | | | (Re)Load issue labels when labels are added or removed This means that the label state that the webhooks produce accurately matches the changes that they are reporting. Fix #10660 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fixed count of filtered issues when api request. (#12275)ひのしば / hinoshiba2020-09-241-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improved total count of issue when filtered. * Fixed size of slice when selected 1 repository. * Improved function of error check. * improved comment * Added parameter of return header. Co-authored-by: 6543 <6543@obermui.de> * Updated corresponded to the current vendored of "xorm.io/xorm". * Dedublicated it by store the Options Struct into a variable. * format code * Update routers/api/v1/repo/issue.go Co-authored-by: 6543 <6543@obermui.de> * Update routers/api/v1/repo/issue.go Co-authored-by: 6543 <6543@obermui.de> * Updated number of range. Co-authored-by: 6543 <6543@obermui.de> * Updated number of range. Co-authored-by: 6543 <6543@obermui.de> * Removed total value. * make fmt * Improved value of sql. Co-authored-by: zeripath <art27@cantab.net> * Improved value of sql. * improved message * improved message * improved message * fixed message Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>