summaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Add "Update Branch" button to Pull Requests (#9784)65432020-01-172-45/+180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add Divergence * add Update Button * first working version * re-use code * split raw merge commands and db-change functions (notify, cache, ...) * use rawMerge (remove redundant code) * own function to get Diverging of PRs * use FlashError * correct Error Msg * hook is triggerd ... so remove comment * add "branch2" to "user2/repo1" because it unit-test "TestPullView_ReviewerMissed" use it but dont exist jet :/ * move GetPerm to IsUserAllowedToUpdate * add Flash Success MSG * imprufe code - remove useless js chage * fix-lint * TEST: add PullRequest ID:5 Repo: user2/repo1 Base: branch1 Head: pr-to-update * correct comments * make PR5 outdated * fix Tests * WIP: add pull update test * update revs * update locales * working TEST * update UI * misspell * change style * add 1s delay so rev exist * move row up (before merge row) * fix lint nit * UI remove divider * Update style * nits * do it right * introduce IsSameRepo * remove useless check Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix admin handling at merge of PR (#9749)David Svantesson2020-01-161-3/+0
| | | | | | | | | | | | | | | | * Admin shall be able to bypass merge checks. * Repository admin should not bypass if merge whitelist is set. * Add code comment about checks that PR are ready * notAllOverrideableChecksOk->notAllOverridableChecksOk * Fix merge, require signed currently not overridable. * fix Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* Move mailer to use a queue (#9789)zeripath2020-01-163-46/+75
| | | | | | | | * Move mailer to use a queue * Make sectionMap map[string]bool * Ensure that Message is json encodable
* [refactor] notify remove unused praram (#9804)65432020-01-162-8/+2
|
* Add require signed commit for protected branch (#9708)zeripath2020-01-153-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add require signed commit for protected branch * Fix fmt * Make editor show if they will be signed * bugfix * Add basic merge check and better information for CRUD * linting comment * Add descriptors to merge signing * Slight refactor * Slight improvement to appearances * Handle Merge API * manage CRUD API * Move error to error.go * Remove fix to delete.go * prep for merge * need to tolerate \r\n in message * check protected branch before trying to load it * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * fix commit-reader Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Move RepoWorkingPool to services/repository package (#9754)Lunny Xiao2020-01-151-6/+10
| | | | | | | | * Move RepoWorkingPool to services/repository package * Make repoWorkingPool private Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
* Move newbranch to standalone package (#9627)Lunny Xiao2020-01-141-6/+5
| | | | | | | | | | | | * Move newbranch to standalone package * move branch functions to modules to avoid dependencies cycles * fix tests * fix lint * fix lint
* Move create/fork repository from models to modules/repository (#9489)Lunny Xiao2020-01-124-6/+8
| | | | | | | | | | | | | | | | | | | | * 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-123-7/+6
| | | | | | | | | | | | | | * 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>
* Allow repo admin to merge PR regardless of review status (#9611)David Svantesson2020-01-111-5/+62
| | | | * Allow repo admin to merge even if review is not ok.
* Don't attempt to close issue if already closed (#9696)guillep2k2020-01-111-2/+4
| | | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Move push commits from models to modules/repository (#9370)Lunny Xiao2020-01-102-2/+3
| | | | | | | | | | | | | | | | * 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>
* Fix lint (#9688)Lunny Xiao2020-01-101-1/+3
|
* Move Errored PRs out of StatusChecking (#9675)zeripath2020-01-101-0/+4
| | | | | | | | | | | | * 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>
* Mark PR reviews as stale at push and allow to dismiss stale approvals (#9532)David Svantesson2020-01-093-7/+122
| | | | | | | 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
* Move wiki related funtions from models to services/wiki (#9355)Lunny Xiao2020-01-072-0/+532
| | | | * Move wiki related funtions from models to services/wiki
* Remove stray printf (#9631)zeripath2020-01-071-1/+0
|
* Some more e-mail notification fixes (#9596)mrsdizzie2020-01-031-4/+6
| | | | | | | | | | | | | | | | | | | | | * Some more e-mail notification fixes A few more small e-mail notification fixes/changes * Style footer of notification email to be smaller * Include text for when pull request is merged * Don't include original body of issue or PR when merging/closing by setting issue.Content to "" in these cases * Set Re: prefix and meessage-ID headers based on actName instead of checking for a comment. This fixes a bug where certain actions that didn't have a comment were setting Message-ID instead of In-Reply-To which caused some mail programs not to show those messages as they would have had the same Message-ID as a previous message. Also fixes the case where a final comment and closing message would have been displayed out of order if you didn't have a copy of the original issue/pr cretion message. * Update other template footers for consistency
* Use limited commits (#9572)John Olheiser2020-01-011-1/+1
| | | Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Properly enforce gitea environment for pushes (#9501)zeripath2019-12-271-0/+9
| | | #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!
* Add ActionCommentPull action (#9456)mrsdizzie2019-12-222-2/+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>
* Change target branch for pull request (#6488)Mario Lubenka2019-12-161-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-161-6/+6
| | | | | | * Use os.TmpDir for new created temp directory * fix error message
* remove unused method and rename createcommentWithNoAction (#9367)Lunny Xiao2019-12-161-1/+1
|
* Refactor comment (#9330)Lunny Xiao2019-12-152-2/+12
| | | | | | | | * Refactor comment * fix test * improve code
* Sign protected branches (#8993)zeripath2019-12-151-1/+1
| | | | | | | | * Move SignMerge to PullRequest * Add approved signing mode * As per @guillep2k comment
* Graceful: Xorm, RepoIndexer, Cron and Others (#9282)zeripath2019-12-153-87/+98
| | | | | | | | | | | | * Change graceful to use a singleton obtained through GetManager instead of a global. * Graceful: Make TestPullRequests shutdownable * Graceful: Make the cron tasks graceful * Graceful: AddTestPullRequest run in graceful ctx * Graceful: SyncMirrors shutdown * Graceful: SetDefaultContext for Xorm to be HammerContext * Avoid starting graceful for migrate commands and checkout * Graceful: DeliverHooks now can be shutdown * Fix multiple syncing errors in modules/sync/UniqueQueue & Make UniqueQueue closable * Begin the process of making the repo indexer shutdown gracefully
* Move PushToBaseRepo from models to services/pull (#9352)Lunny Xiao2019-12-152-1/+57
|
* Push to create repo (#8419)John Olheiser2019-12-151-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add push-create to SSH serv Signed-off-by: jolheiser <john.olheiser@gmail.com> * Cannot push for another user unless admin Signed-off-by: jolheiser <john.olheiser@gmail.com> * Get owner in case admin pushes for another user Signed-off-by: jolheiser <john.olheiser@gmail.com> * Set new repo ID in result Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update to service and use new org perms Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move pushCreateRepo to services Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix import order Signed-off-by: jolheiser <john.olheiser@gmail.com> * Changes for @guillep2k * Check owner (not user) in SSH * Add basic tests for created repos (private, not empty) Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Move some repository methods from models to modules/repository (#9353)Lunny Xiao2019-12-142-2/+4
| | | | | | * Move some repository methods from models to modules/repository * fix test
* Remove SavePatch and generate patches on the fly (#9302)zeripath2019-12-135-83/+386
| | | | | | | | | | | | | | | | | | | | | | | | | | * Save patches to temporary files * Remove SavePatch and generate patches on the fly * Use ioutil.TempDir * fixup! Use ioutil.TempDir * fixup! fixup! Use ioutil.TempDir * RemoveAll LocalCopyPath() in initIntergrationTest * Default to status checking on PR creation * Remove unnecessary set to StatusChecking * Protect against unable to load repo * Handle conflicts * Restore original conflict setting * In TestPullRequests update status to StatusChecking before running TestPatch
* Move some pull request functions from models to services (#9266)Lunny Xiao2019-12-064-2/+262
| | | | | | * Move some pull request functions from models to services * Fix test
* Move repoWorkPool outside rename/transfer repository (#9086)Lunny Xiao2019-12-061-14/+12
| | | | | | | | * Move repoWorkPool outside rename/transfer repository * fix import * Fix test
* Branch protection: Possibility to not use whitelist but allow anyone with ↵David Svantesson2019-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | write access (#9055) * Possibility to not use whitelist but allow anyone with write access * fix existing test * rename migration function * Try to give a better name for migration step * Clear settings if higher level setting is not set * Move official reviews to db instead of counting approvals each time * migration * fix * fix migration * fix migration * Remove NOT NULL from EnableWhitelist as migration isn't possible * Fix migration, reviews are connected to issues. * Fix SQL query issues in GetReviewersByPullID. * Simplify function GetReviewersByIssueID * Handle reviewers that has been deleted * Ensure reviews for test is in a well defined order * Only clear and set official reviews when it is an approve or reject.
* Extract createComment (#9125)Lunny Xiao2019-11-301-2/+1
| | | | | | | | * Extract createComment * fix lint * fix lint
* Graceful: Cancel Process on monitor pages & HammerTime (#9213)zeripath2019-11-303-32/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Graceful: Create callbacks to with contexts * Graceful: Say when Gitea is completely finished * Graceful: Git and Process within HammerTime Force all git commands to terminate at HammerTime Force all process commands to terminate at HammerTime Move almost all git processes to run as git Commands * Graceful: Always Hammer after Shutdown * ProcessManager: Add cancel functionality * Fix tests * Make sure that process.Manager.Kill() cancels * Make threadsafe access to Processes and remove own unused Kill * Remove cmd from the process manager as it is no longer used * the default context is the correct context * get rid of double till
* Fix panic when diff (#9187)Lunny Xiao2019-11-2826-8/+688
| | | | | | * fix panic when diff * improve code
* Add avatar and issue labels to template repositories (#9149)John Olheiser2019-11-251-0/+14
| | | | | | | | | | * Add avatar and issue labels Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix redundant if-err Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add git hooks and webhooks to template repositories; move to services (#8926)John Olheiser2019-11-242-15/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add git hooks and webhooks to template options Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update models/repo.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Add tooltip if the user can't edit git hooks Signed-off-by: jolheiser <john.olheiser@gmail.com> * Close repositories after copying git hooks Signed-off-by: jolheiser <john.olheiser@gmail.com> * Wording Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Restructure for services Signed-off-by: jolheiser <john.olheiser@gmail.com> * Return errors Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move GenerateRepository to using a DBContext Signed-off-by: jolheiser <john.olheiser@gmail.com> * Wrap with models.WithTx Signed-off-by: jolheiser <john.olheiser@gmail.com> * Remove debug print Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move if-error-delete-repo outside WithTx Signed-off-by: jolheiser <john.olheiser@gmail.com> * Return nil if no repo generated Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix show single review comments in the PR page (#9143)guillep2k2019-11-241-3/+29
|
* Move mirror sync actions to notification (#9022)Lunny Xiao2019-11-242-81/+13
| | | | | | * Move mirror sync actions to notification * fix lint
* Send tag create and push webhook when release created on UI (#8671)Benno2019-11-221-0/+9
| | | | | | | | | | | | | | | | | | * 'update' * Send push tag event when release created * send tag create event while release created in UI * update to go v1.13 * fix gofmt error * update #8671 move release tag created hook to modules/notification/webhook due to #8802 refactoring * use NotifyCreateRef and NotifyPushCommits instead of NotifyNewReleaseTag * move tag notification to correct place
* Move merge actions to notification (#9024)Lunny Xiao2019-11-211-19/+1
| | | | | | * Move merge actions to notification * Add missing mail notification
* Close/reopen issues by keywords in titles and comments (#8866)guillep2k2019-11-181-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | * Add close/reopen from comment functionality * Fix comment * Rewrite closing/reopening template * Check xref permissions, move action to services/pull * Fix RefIsPull field * Add xref tests * Fix xref unique filter * Only highlight keywords for actionable xrefs * Fix xref neuter filter * Fix check return status * Restart CI
* Rewrite delivery of issue and comment mails (#9009)guillep2k2019-11-185-144/+187
| | | | | | | | | | | | | | | | * Mail issue subscribers, rework the function * Simplify a little more * Fix unused variable * Refactor mail delivery to avoid heavy load on server * Avoid splitting into too many goroutines * Fix comments and optimize GetMaileableUsersByIDs() * Fix return on errors
* Add review comments to mail notifications (#8996)guillep2k2019-11-151-4/+28
|
* Move transfer repository and rename repository on a service package and ↵Lunny Xiao2019-11-154-2/+130
| | | | | | | | | | | | | | | | | | | | | | start action notification (#8573) * move transfer repository and rename repository on a service package and start action notification * remove unused codes * fix lint * fix bugs * fix test * fix test * fix test * fix lint * update go mod and sum
* services/mirror: fix dropped test errors (#9007)Lars Lehtonen2019-11-151-0/+2
|
* Expand/Collapse Files and Blob Excerpt while Reviewing/Comparing code (#8924)Benno2019-11-151-17/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * update #8659 fold/unfold code diffs * add fold button style * update #8659 implement expand up/down codes (blob excerpt) * fix golint errors * fix expand direction * remove debug message * update css style for blob exceprt * fix typo in comment * update style sheet with less * update expect diff (add SectionInfo) * update #8942 accept suggested change (fix typo) * close reader and check file type before get tail section * adjust button position and check file type before insert fold button * move index js to web_src * merge index.js with master * generate index.js * update js coding style
* Refactor pull request review (#8954)Lunny Xiao2019-11-142-73/+124
| | | | | | | | | | | | | | | | | | * refactor submit review * remove unnecessary code * remove unused comment * fix lint * remove duplicated actions * remove duplicated actions * fix typo * fix comment content