aboutsummaryrefslogtreecommitdiffstats
path: root/models
Commit message (Collapse)AuthorAgeFilesLines
* Restricted users (#6274)Manush Dodunekov2020-01-1319-97/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Restricted users (#4334): initial implementation * Add User.IsRestricted & UI to edit it * Pass user object instead of user id to places where IsRestricted flag matters * Restricted users: maintain access rows for all referenced repos (incl public) * Take logged in user & IsRestricted flag into account in org/repo listings, searches and accesses * Add basic repo access tests for restricted users Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Mention restricted users in the faq Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert unnecessary change `.isUserPartOfOrg` -> `.IsUserPartOfOrg` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Remove unnecessary `org.IsOrganization()` call Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert to an `int64` keyed `accessMap` * Add type `userAccess` * Add convenience func updateUserAccess() * Turn accessMap into a `map[int64]userAccess` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * or even better: `map[int64]*userAccess` * updateUserAccess(): use tighter syntax as suggested by lafriks * even tighter * Avoid extra loop * Don't disclose limited orgs to unauthenticated users * Don't assume block only applies to orgs * Use an array of `VisibleType` for filtering * fix yet another thinko * Ok - no need for u * Revert "Ok - no need for u" This reverts commit 5c3e886aabd5acd997a3b35687d322439732c200. Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] Add "before" query to ListIssueComments and ListRepoIssue… (#9685)65432020-01-132-1/+7
| | | | | | | | | * add "before" query to ListIssueComments and ListRepoIssueComments * Add TEST Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* [API] add GET /orgs endpoint (#9560)65432020-01-121-3/+4
| | | | | | | | | | | | | | * introduce `GET /orgs` * add TEST * show also other VisibleType's * update description * refactor a lot * SearchUserOptions by default return only public
* Move create/fork repository from models to modules/repository (#9489)Lunny Xiao2020-01-126-778/+48
| | | | | | | | | | | | | | | | | | | | * Move create/fork repository from models to modules/repository * fix wrong reference * fix test * fix test * fix lint * Fix DBContext * remove duplicated TestMain * fix lint * fix conflicts
* Add owner_name column for table repository for maintaince reason (#9717)Lunny Xiao2020-01-1212-89/+119
| | | | | | | | | | | | | | * Add owner_name column for table repository for maintaince reason * refactor * Fix tests * fix test * fix bug when fork repository Co-authored-by: zeripath <art27@cantab.net>
* Restore IsPasswordSet previous value (#9682)zeripath2020-01-111-1/+1
|
* Allow repo admin to merge PR regardless of review status (#9611)David Svantesson2020-01-113-49/+3
| | | | * Allow repo admin to merge even if review is not ok.
* Move tracked time api convert to convert package (#9665)Lunny Xiao2020-01-101-29/+0
|
* Load milestone in API PR list (#9671)John Olheiser2020-01-101-1/+2
| | | | | | | | | | | | | | * Load milestone for Issue API format Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move further down Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <matti@mdranta.net>
* Fix wrong original git service type on a migrated repository (#9693)Lunny Xiao2020-01-104-17/+38
|
* Move push commits from models to modules/repository (#9370)Lunny Xiao2020-01-104-400/+10
| | | | | | | | | | | | | | | | * Move push commits from models to modules/repository * fix test * fix test * fix test * fix test * fix test Co-authored-by: zeripath <art27@cantab.net>
* Move pull request api convert to convert package (#9664)Lunny Xiao2020-01-102-144/+0
| | | | | | * Move pull request api convert to convert package * Rename ToPullRequest to ToAPIPullRequest
* Fix lint (#9688)Lunny Xiao2020-01-101-1/+1
|
* Move Errored PRs out of StatusChecking (#9675)zeripath2020-01-101-1/+2
| | | | | | | | | | | | * Set Errored PRs out of StatusChecking * Ensure that api status is correctly set too * Update models/pull.go Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com>
* [API] orgEditTeam make Fields optional (#9556)65432020-01-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * API: orgEditTeam make Fields optional * add TestCase * Update integrations/api_team_test.go * suggestions from lafriks use len() to check if string is empty Co-Authored-By: Lauris BH <lauris@nix.lv> * change ... * use Where not ID to get mssql * add return and code format * fix test * fix test ... null pointer exept * update specific colums * only specific colums too Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [API] Add notification endpoint (#9488)65432020-01-095-26/+258
| | | | | | | | | | | | | | | | | | | | | | | | | * [API] Add notification endpoints * add func GetNotifications(opts FindNotificationOptions) * add func (n *Notification) APIFormat() * add func (nl NotificationList) APIFormat() * add func (n *Notification) APIURL() * add func (nl NotificationList) APIFormat() * add LoadAttributes functions (loadRepo, loadIssue, loadComment, loadUser) * add func (c *Comment) APIURL() * add func (issue *Issue) GetLastComment() * add endpoint GET /notifications * add endpoint PUT /notifications * add endpoint GET /repos/{owner}/{repo}/notifications * add endpoint PUT /repos/{owner}/{repo}/notifications * add endpoint GET /notifications/threads/{id} * add endpoint PATCH /notifications/threads/{id} * Add TEST * code format * code format
* Fix nil reference in repo generation (#9660)John Olheiser2020-01-091-29/+31
| | | | | | | | | | * Fix nil reference Signed-off-by: jolheiser <john.olheiser@gmail.com> * Tighten Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532)David Svantesson2020-01-094-21/+78
| | | | | | | Fix #5997. If a push causes the patch/diff of a PR towards target branch to change, all existing reviews for the PR will be set and shown as stale. New branch protection option to dismiss stale approvals are added. To show that a review is not based on the latest PR changes, an hourglass is shown
* Add HTML URL to API Issues (#9654)John Olheiser2020-01-081-0/+1
| | | | | | | | | | | | * Add HTML URL to API Issues Signed-off-by: jolheiser <john.olheiser@gmail.com> * Swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* times Add filters (#9373)65432020-01-081-4/+12
| | | | | | | | | (extend #9200) * add query param for GET functions (created Bevore & after) * add test * generalize func GetQueryBeforeSince Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix #9552: Merge commits generated by pull request capture pull request ↵Shashvat Kedia2020-01-081-1/+5
| | | | | | details (#9635)
* Move wiki related funtions from models to services/wiki (#9355)Lunny Xiao2020-01-072-506/+0
| | | | * Move wiki related funtions from models to services/wiki
* Branches not at ref commit ID should not be listed as Merged (#9614)zeripath2020-01-071-1/+1
| | | | | | | | | | | Once a branch has been merged if the commit ID no longer equals that of the pulls ref commit id don't offer to delete the branch on the pull screen and don't list it as merged on branches. Fix #9201 When looking at the pull page we should also get the commits from the refs/pulls/x/head Fix #9158
* Fix Issue Unsubscription (#9634)65432020-01-072-5/+9
|
* [BugFix] Hide public repos owned by private orgs (#9609)65432020-01-052-4/+9
| | | | | * Restrict AllPublic to actually public repos. * Add new parameter to add in AllLimited Repos
* Fix access issues on milestone and issue overview pages. (#9603)David Svantesson2020-01-042-7/+28
| | | | | | * Fix access issues on milestone and issue overview pages. * Fix filter algorithm
* Only serve attachments when linked to issue/release and if accessible by ↵Antoine GIRARD2020-01-055-5/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user (#9340) * test: add current attachement responses * refactor: check if attachement is linked and accessible by user * chore: clean TODO * fix: typo attachement -> attachment * revert un-needed go.sum change * refactor: move models logic to models * fix TestCreateIssueAttachment which was wrongly successful * fix unit tests with unittype added * fix unit tests with changes * use a valid uuid format for pgsql int. test * test: add unit test TestLinkedRepository * refactor: allow uploader to access unlinked attachement * add missing blank line * refactor: move to a separate function repo.GetAttachment * typo * test: remove err test return * refactor: use repo perm for access checking generally + 404 for all reject
* Add branch protection option to block merge on requested changes. (#9592)David Svantesson2020-01-033-1/+38
| | | | | | | | | | | | | | | | | | | * Add branch protection option to block merge on requested changes. * Add migration step * Fix check to correct negation * Apply suggestions from code review Language improvement. Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Copyright year. Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* make sure Poster is loaded (#9583)65432020-01-021-0/+5
|
* Fix #9189 - API Allow only specific Colums to be updated on Issue (#9539)65432020-01-015-24/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dont insert "-1" in any case to issue.poster_id * Make sure API cant override importand fields * code format * fix lint * WIP test * add missing poster_id * fix test * user.IsGhost handle nil * CI.restart() * make sure no -1 is realy added * CI.restart() * @lunny suggestion remove some not allowed fields * seperate issue.LoadMilestone * load milestone and return it on IssueEdit via API * extend Test for TestAPIEditIssue * fix fixtures * declare allowedColumnsUpdateIssueByAPI only once * Update Year * no var just write id drecty into func cal Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] Fix 9544 | return 200 when reaction already exist (#9550)65432019-12-313-12/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add ErrReactionAlreadyExist * extend CreateReaction * reaction already exist = 200 * extend FindReactionsOptions * refactor swagger options/definitions * fix swagger-validate * Update models/error.go Co-Authored-By: zeripath <art27@cantab.net> * fix test PART1 * extend FindReactionsOptions with UserID option * catch error on test * fix test PART2 * format ... Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <matti@mdranta.net>
* Provide Default messages for merges (#9393)zeripath2019-12-302-3/+208
| | | | Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Ignore empty avatars in v115.go (#9520)zeripath2019-12-281-1/+4
| | | | | | * Ignore empty avatars * fixup! Ignore empty avatars
* Properly enforce gitea environment for pushes (#9501)zeripath2019-12-274-4/+15
| | | #8982 attempted to enforce the gitea environment for pushes - unfortunately it tested the settings before they were actually read in - and therefore does not do that!
* [API] Extend times API (#9200)65432019-12-2711-47/+323
| | | | | Extensively extend the times API. close #8833; close #8513; close #8559
* Fix deleted branch isn't removed when push the branch again (#9516)Lunny Xiao2019-12-271-0/+6
|
* Fix user avatar name (#8547)Masudur Rahman2019-12-273-1/+119
| | | Migrate avatar names to include user ID and the md5 hash.
* Remove and recreate the hooks to set them executable with the umask (#9502)zeripath2019-12-271-0/+7
| | | Fix #9091
* Fix SetExpr failed (#9506)Lunny Xiao2019-12-271-4/+4
|
* Batch hook pre- and post-receive calls (#8602)zeripath2019-12-262-43/+265
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * make notifyWatchers work on multiple actions * more efficient multiple notifyWatchers * Make CommitRepoAction take advantage of multiple actions * Batch post and pre-receive results * Set batch to 30 * Auto adjust timeout & add logging * adjust processing message * Add some messages to pre-receive * Make any non-200 status code from pre-receive an error * Add missing hookPrintResults * Remove shortcut for single action * mistaken merge fix * oops * Move master branch to the front * If repo was empty and the master branch is pushed ensure that that is set as the default branch * fixup * fixup * Missed HookOptions in setdefaultbranch * Batch PushUpdateAddTag and PushUpdateDelTag Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add ActionCommentPull action (#9456)mrsdizzie2019-12-222-1/+2
| | | | | | | | | | | * Add ActionCommentPull action Adds ActionCommentPull action to distinguish between a comment on an issue and on a pull request * Update modules/notification/action/action.go Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Issue with Migration rule v111 (#9449)Marge Bouvier2019-12-211-0/+3
| | | | | | | | | | | | * Issue with Migration rule v111 I was facing some issues with migration rule v111 * Update v111.go Fix pgsql test cases Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* Add migration to sanitize repository original_url (#9423)mrsdizzie2019-12-192-0/+54
| | | | | | | | | | | | | | | | | | | | * Add migration to sanitize repository original_url During a large code move in #6200 the OriginalURL field was accidentially changed to be populated with the CloneAddr field which will contain the username and/or password provided during a migration. This behavior was fixed in previous PR #9097 and this migration will remove any authentication details that were stored in the database between those two. * use net/url to rebuild URL instead of strings.Replace * Update models/migrations/migrations.go * changes per lunny * make fmt
* Hide not allowed Reactions (#9387)65432019-12-181-0/+1
| | | | | | | | | | | | * Hide not allowed Reactions * filter in query :D * use ` Co-Authored-By: Alexey 〒erentyev <axifnx@gmail.com> * update xorm v0.8.0 -> v0.8.1
* fix wrong migration (#9381)Lunny Xiao2019-12-171-1/+2
|
* Change target branch for pull request (#6488)Mario Lubenka2019-12-165-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Adds functionality to change target branch of created pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use const instead of var in JavaScript additions Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check if branches are equal and if PR already exists before changing target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Make sure to check all commits Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Print error messages for user as error flash message Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Disallow changing target branch of closed or merged pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Resolve conflicts after merge of upstream/master Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Change order of branch select fields Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes duplicate check Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use ctx.Tr for translations Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Recompile JS Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use correct translation namespace Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove redundant if condition Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves most change branch logic into pull service Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Completes comment Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Add Ref to ChangesPayload for logging changed target branches instead of creating a new struct Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Revert changes to go.mod Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Directly use createComment method Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return 404 if pull request is not found. Move written check up Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove variable declaration Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return client errors on change pull request target errors Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return error in commit.HasPreviousCommit Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds blank line Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Test patch before persisting new target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update patch before testing (not working) Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes patch calls when changeing pull request target Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes unneeded check for base name Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves ChangeTargetBranch completely to pull service. Update patch status. Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Set webhook mode after errors were validated Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update PR in one transaction Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Move logic for check if head is equal with branch to pull model Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds missing comment and simplify return Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adjust CreateComment method call Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Use ioutil.TmpDir for new created temp directory (#9368)Lunny Xiao2019-12-162-9/+6
| | | | | | * Use os.TmpDir for new created temp directory * fix error message
* remove unused method and rename createcommentWithNoAction (#9367)Lunny Xiao2019-12-168-88/+16
|
* Refactor comment (#9330)Lunny Xiao2019-12-156-34/+66
| | | | | | | | * Refactor comment * fix test * improve code
* Add /milestones endpoint (#8733)Brad Albright2019-12-152-2/+190
| | | | | Create a /milestones endpoint which basically serves as a dashboard view for milestones, very similar to the /issues or /pulls page. Closes #8232