You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

error.go 65 kB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
Adopt repositories (#12920) * Don't automatically delete repository files if they are present Prior to this PR Gitea would delete any repository files if they are present during creation or migration. This can in certain circumstances lead to data-loss and is slightly unpleasant. This PR provides a mechanism for Gitea to adopt repositories on creation and otherwise requires an explicit flag for deletion. PushCreate is slightly different - the create will cause adoption if that is allowed otherwise it will delete the data if that is allowed. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix tests and migrate overwrite Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @lunny Only offer to adopt or overwrite if the user can do that. Allow the site administrator to adopt or overwrite in all circumstances Signed-off-by: Andrew Thornton <art27@cantab.net> * Use setting.Repository.DefaultBranch for the default branch Signed-off-by: Andrew Thornton <art27@cantab.net> * Always set setting.Repository.DefaultBranch Signed-off-by: Andrew Thornton <art27@cantab.net> * update swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * update templates Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure repo closed Signed-off-by: Andrew Thornton <art27@cantab.net> * Rewrite of adoption as per @6543 and @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review * update swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * missing not Signed-off-by: Andrew Thornton <art27@cantab.net> * add modals and flash reporting Signed-off-by: Andrew Thornton <art27@cantab.net> * Make the unadopted page searchable Signed-off-by: Andrew Thornton <art27@cantab.net> * Add API Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * fix swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle empty and non-master branched repositories Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * remove commented out code Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Change target branch for pull request (#6488) * 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>
5 years ago
Change target branch for pull request (#6488) * 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>
5 years ago
9 years ago
9 years ago
Change target branch for pull request (#6488) * 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>
5 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
7 years ago
Add Organization Wide Labels (#10814) * Add organization wide labels Implement organization wide labels similar to organization wide webhooks. This lets you create individual labels for organizations that can be used for all repos under that organization (so being able to reuse the same label across multiple repos). This makes it possible for small organizations with many repos to use labels effectively. Fixes #7406 * Add migration * remove comments * fix tests * Update options/locale/locale_en-US.ini Removed unused translation string * show org labels in issue search label filter * Use more clear var name * rename migration after merge from master * comment typo * update migration again after rebase with master * check for orgID <=0 per guillep2k review * fmt * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * remove unused code * Make sure RepoID is 0 when searching orgID per code review * more changes/code review requests * More descriptive translation var per code review * func description/delete comment when issue label deleted instead of hiding it * remove comment * only use issues in that repo when calculating number of open issues for org label on repo label page * Add integration test for IssuesSearch API with labels * remove unused function * Update models/issue_label.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Use subquery in GetLabelIDsInReposByNames * Fix tests to use correct orgID * fix more tests * IssuesSearch api now uses new BuildLabelNamesIssueIDsCondition. Add a few more tests as well * update comment for clarity * Revert previous code change now that we can use the new BuildLabelNamesIssueIDsCondition * Don't sort repos by date in IssuesSearch API After much debugging I've found a strange issue where in some cases MySQL will return a different result than other enigines if a query is sorted by a null collumn. For example with our integration test data where we don't set updated_unix in repository fixtures: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 45 Returns different results for MySQL than other engines. However, the similar query: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 30 Returns the same results. This causes integration tests to fail on MySQL in certain cases but would never show up in a real installation. Since this API call always returns issues based on the optionally provided repo_priority_id or the issueID itself, there is no change to results by changing the repo sorting method used to get ids earlier in the function. * linter is back! * code review * remove now unused option * Fix newline at end of files * more unused code * update to master * check for matching ids before query * Update models/issue_label.go Co-Authored-By: 6543 <6543@obermui.de> * Update models/issue_label.go * update comments * Update routers/org/setting.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
5 years ago
Add Organization Wide Labels (#10814) * Add organization wide labels Implement organization wide labels similar to organization wide webhooks. This lets you create individual labels for organizations that can be used for all repos under that organization (so being able to reuse the same label across multiple repos). This makes it possible for small organizations with many repos to use labels effectively. Fixes #7406 * Add migration * remove comments * fix tests * Update options/locale/locale_en-US.ini Removed unused translation string * show org labels in issue search label filter * Use more clear var name * rename migration after merge from master * comment typo * update migration again after rebase with master * check for orgID <=0 per guillep2k review * fmt * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * remove unused code * Make sure RepoID is 0 when searching orgID per code review * more changes/code review requests * More descriptive translation var per code review * func description/delete comment when issue label deleted instead of hiding it * remove comment * only use issues in that repo when calculating number of open issues for org label on repo label page * Add integration test for IssuesSearch API with labels * remove unused function * Update models/issue_label.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Use subquery in GetLabelIDsInReposByNames * Fix tests to use correct orgID * fix more tests * IssuesSearch api now uses new BuildLabelNamesIssueIDsCondition. Add a few more tests as well * update comment for clarity * Revert previous code change now that we can use the new BuildLabelNamesIssueIDsCondition * Don't sort repos by date in IssuesSearch API After much debugging I've found a strange issue where in some cases MySQL will return a different result than other enigines if a query is sorted by a null collumn. For example with our integration test data where we don't set updated_unix in repository fixtures: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 45 Returns different results for MySQL than other engines. However, the similar query: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 30 Returns the same results. This causes integration tests to fail on MySQL in certain cases but would never show up in a real installation. Since this API call always returns issues based on the optionally provided repo_priority_id or the issueID itself, there is no change to results by changing the repo sorting method used to get ids earlier in the function. * linter is back! * code review * remove now unused option * Fix newline at end of files * more unused code * update to master * check for matching ids before query * Update models/issue_label.go Co-Authored-By: 6543 <6543@obermui.de> * Update models/issue_label.go * update comments * Update routers/org/setting.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
5 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
8 years ago
Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
Pull request review/approval and comment on code (#3748) * Initial ui components for pull request review * Add Review Add IssueComment types Signed-off-by: Jonas Franz <info@jonasfranz.software> (cherry picked from commit 2b4daab) Signed-off-by: Jonas Franz <info@jonasfranz.software> * Replace ReviewComment with Content Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add load functions Add ReviewID to findComments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add create review comment implementation Add migration for review Other small changes Signed-off-by: Jonas Franz <info@jonasfranz.software> * Simplified create and find functions for review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Moved "Pending" to first position Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add GetCurrentReview to simplify fetching current review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Preview for listing comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Move new comment form to its own file Signed-off-by: Jonas Franz <info@jonasfranz.software> * Implement Review form Show Review comments on comment stream Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for single comments Showing buttons in context Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add pending tag to pending review comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add unit tests for Review Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fetch all review ids at once Add unit tests Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Improved comment rendering in "Files" view by adding Comments to DiffLine Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for invalidating comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Switched back to code.gitea.io/git Signed-off-by: Jonas Franz <info@jonasfranz.software> * Moved review migration from v64 to v65 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Rebuild css Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Improve translations Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests by updating fixtures and updating outdated test Signed-off-by: Jonas Franz <info@jonasfranz.software> * Comments will be shown at the right place now Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for deleting CodeComments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix problems caused by files in subdirectories Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for showing code comments of reviews in conversation Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for "Show/Hide outdated" Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update code.gitea.io/git Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add support for new webhooks Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update comparison Signed-off-by: Jonas Franz <info@jonasfranz.software> * Resolve conflicts Signed-off-by: Jonas Franz <info@jonasfranz.software> * Minor UI improvements * update code.gitea.io/git * Fix ui bug reported by @lunny causing wrong position of add button Add functionality to "Cancel" button Add scale effects to add button Hide "Cancel" button for existing comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Prepare solving conflicts Signed-off-by: Jonas Franz <info@jonasfranz.software> * Show add button only if no comments already exist for the line Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add missing vendor files Signed-off-by: Jonas Franz <info@jonasfranz.software> * Check if reviewer is nil Signed-off-by: Jonas Franz <info@jonasfranz.software> * Show forms only to users who are logged in Signed-off-by: Jonas Franz <info@jonasfranz.software> * Revert "Show forms only to users who are logged in" This reverts commit c083682 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Save patch in comment Render patch for code comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add link to comment in code Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add reply form to comment list Show forms only to signed in users Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add 'Reply' as translatable Add CODE_COMMENT_LINES setting Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix problems introduced by checking for singed in user Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add v70 Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update generated stylesheet Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix preview Beginn with new review comment patch system Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add new algo to generate diff for line range Remove old algo used for cutting big diffs (it was very buggy) * Add documentation and example for CutDiffAroundLine * Fix example of CutDiffAroundLine * Fix some comment UI rendering bugs * Add code comment edit mode * Send notifications / actions to users until review gets published Fix diff generation bug Fix wrong hashtag * Fix vet errors * Send notifications also for single comments * Fix some notification bugs, fix link * Fix: add comment icon is only shown on code lines * Add lint comment * Add unit tests for git diff * Add more error messages * Regenerated css Signed-off-by: Jonas Franz <info@jonasfranz.software> * fmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Regenerated CSS with latest less version Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix test by updating comment type to new ID Signed-off-by: Jonas Franz <info@jonasfranz.software> * Introducing CodeComments as type for map[string]map[int64][]*Comment Other minor code improvements Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix data-tab issues Signed-off-by: Jonas Franz <info@jonasfranz.software> * Remove unnecessary change Signed-off-by: Jonas Franz <info@jonasfranz.software> * refactored checkForInvalidation Signed-off-by: Jonas Franz <info@jonasfranz.software> * Append comments instead of setting Signed-off-by: Jonas Franz <info@jonasfranz.software> * Use HeadRepo instead of BaseRepo Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update migration Signed-off-by: Jonas Franz <info@jonasfranz.de> * Regenerated CSS Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add copyright Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update index.css Signed-off-by: Jonas Franz <info@jonasfranz.software>
6 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package models
  6. import (
  7. "fmt"
  8. "code.gitea.io/gitea/modules/git"
  9. )
  10. // ErrNotExist represents a non-exist error.
  11. type ErrNotExist struct {
  12. ID int64
  13. }
  14. // IsErrNotExist checks if an error is an ErrNotExist
  15. func IsErrNotExist(err error) bool {
  16. _, ok := err.(ErrNotExist)
  17. return ok
  18. }
  19. func (err ErrNotExist) Error() string {
  20. return fmt.Sprintf("record does not exist [id: %d]", err.ID)
  21. }
  22. // ErrNameReserved represents a "reserved name" error.
  23. type ErrNameReserved struct {
  24. Name string
  25. }
  26. // IsErrNameReserved checks if an error is a ErrNameReserved.
  27. func IsErrNameReserved(err error) bool {
  28. _, ok := err.(ErrNameReserved)
  29. return ok
  30. }
  31. func (err ErrNameReserved) Error() string {
  32. return fmt.Sprintf("name is reserved [name: %s]", err.Name)
  33. }
  34. // ErrNamePatternNotAllowed represents a "pattern not allowed" error.
  35. type ErrNamePatternNotAllowed struct {
  36. Pattern string
  37. }
  38. // IsErrNamePatternNotAllowed checks if an error is an ErrNamePatternNotAllowed.
  39. func IsErrNamePatternNotAllowed(err error) bool {
  40. _, ok := err.(ErrNamePatternNotAllowed)
  41. return ok
  42. }
  43. func (err ErrNamePatternNotAllowed) Error() string {
  44. return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern)
  45. }
  46. // ErrNameCharsNotAllowed represents a "character not allowed in name" error.
  47. type ErrNameCharsNotAllowed struct {
  48. Name string
  49. }
  50. // IsErrNameCharsNotAllowed checks if an error is an ErrNameCharsNotAllowed.
  51. func IsErrNameCharsNotAllowed(err error) bool {
  52. _, ok := err.(ErrNameCharsNotAllowed)
  53. return ok
  54. }
  55. func (err ErrNameCharsNotAllowed) Error() string {
  56. return fmt.Sprintf("User name is invalid [%s]: must be valid alpha or numeric or dash(-_) or dot characters", err.Name)
  57. }
  58. // ErrSSHDisabled represents an "SSH disabled" error.
  59. type ErrSSHDisabled struct {
  60. }
  61. // IsErrSSHDisabled checks if an error is a ErrSSHDisabled.
  62. func IsErrSSHDisabled(err error) bool {
  63. _, ok := err.(ErrSSHDisabled)
  64. return ok
  65. }
  66. func (err ErrSSHDisabled) Error() string {
  67. return "SSH is disabled"
  68. }
  69. // ErrCancelled represents an error due to context cancellation
  70. type ErrCancelled struct {
  71. Message string
  72. }
  73. // IsErrCancelled checks if an error is a ErrCancelled.
  74. func IsErrCancelled(err error) bool {
  75. _, ok := err.(ErrCancelled)
  76. return ok
  77. }
  78. func (err ErrCancelled) Error() string {
  79. return "Cancelled: " + err.Message
  80. }
  81. // ErrCancelledf returns an ErrCancelled for the provided format and args
  82. func ErrCancelledf(format string, args ...interface{}) error {
  83. return ErrCancelled{
  84. fmt.Sprintf(format, args...),
  85. }
  86. }
  87. // ____ ___
  88. // | | \______ ___________
  89. // | | / ___// __ \_ __ \
  90. // | | /\___ \\ ___/| | \/
  91. // |______//____ >\___ >__|
  92. // \/ \/
  93. // ErrUserAlreadyExist represents a "user already exists" error.
  94. type ErrUserAlreadyExist struct {
  95. Name string
  96. }
  97. // IsErrUserAlreadyExist checks if an error is a ErrUserAlreadyExists.
  98. func IsErrUserAlreadyExist(err error) bool {
  99. _, ok := err.(ErrUserAlreadyExist)
  100. return ok
  101. }
  102. func (err ErrUserAlreadyExist) Error() string {
  103. return fmt.Sprintf("user already exists [name: %s]", err.Name)
  104. }
  105. // ErrUserNotExist represents a "UserNotExist" kind of error.
  106. type ErrUserNotExist struct {
  107. UID int64
  108. Name string
  109. KeyID int64
  110. }
  111. // IsErrUserNotExist checks if an error is a ErrUserNotExist.
  112. func IsErrUserNotExist(err error) bool {
  113. _, ok := err.(ErrUserNotExist)
  114. return ok
  115. }
  116. func (err ErrUserNotExist) Error() string {
  117. return fmt.Sprintf("user does not exist [uid: %d, name: %s, keyid: %d]", err.UID, err.Name, err.KeyID)
  118. }
  119. // ErrUserRedirectNotExist represents a "UserRedirectNotExist" kind of error.
  120. type ErrUserRedirectNotExist struct {
  121. Name string
  122. }
  123. // IsErrUserRedirectNotExist check if an error is an ErrUserRedirectNotExist.
  124. func IsErrUserRedirectNotExist(err error) bool {
  125. _, ok := err.(ErrUserRedirectNotExist)
  126. return ok
  127. }
  128. func (err ErrUserRedirectNotExist) Error() string {
  129. return fmt.Sprintf("user redirect does not exist [name: %s]", err.Name)
  130. }
  131. // ErrUserProhibitLogin represents a "ErrUserProhibitLogin" kind of error.
  132. type ErrUserProhibitLogin struct {
  133. UID int64
  134. Name string
  135. }
  136. // IsErrUserProhibitLogin checks if an error is a ErrUserProhibitLogin
  137. func IsErrUserProhibitLogin(err error) bool {
  138. _, ok := err.(ErrUserProhibitLogin)
  139. return ok
  140. }
  141. func (err ErrUserProhibitLogin) Error() string {
  142. return fmt.Sprintf("user is not allowed login [uid: %d, name: %s]", err.UID, err.Name)
  143. }
  144. // ErrUserInactive represents a "ErrUserInactive" kind of error.
  145. type ErrUserInactive struct {
  146. UID int64
  147. Name string
  148. }
  149. // IsErrUserInactive checks if an error is a ErrUserInactive
  150. func IsErrUserInactive(err error) bool {
  151. _, ok := err.(ErrUserInactive)
  152. return ok
  153. }
  154. func (err ErrUserInactive) Error() string {
  155. return fmt.Sprintf("user is inactive [uid: %d, name: %s]", err.UID, err.Name)
  156. }
  157. // ErrEmailAlreadyUsed represents a "EmailAlreadyUsed" kind of error.
  158. type ErrEmailAlreadyUsed struct {
  159. Email string
  160. }
  161. // IsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed.
  162. func IsErrEmailAlreadyUsed(err error) bool {
  163. _, ok := err.(ErrEmailAlreadyUsed)
  164. return ok
  165. }
  166. func (err ErrEmailAlreadyUsed) Error() string {
  167. return fmt.Sprintf("e-mail already in use [email: %s]", err.Email)
  168. }
  169. // ErrEmailInvalid represents an error where the email address does not comply with RFC 5322
  170. type ErrEmailInvalid struct {
  171. Email string
  172. }
  173. // IsErrEmailInvalid checks if an error is an ErrEmailInvalid
  174. func IsErrEmailInvalid(err error) bool {
  175. _, ok := err.(ErrEmailInvalid)
  176. return ok
  177. }
  178. func (err ErrEmailInvalid) Error() string {
  179. return fmt.Sprintf("e-mail invalid [email: %s]", err.Email)
  180. }
  181. // ErrOpenIDAlreadyUsed represents a "OpenIDAlreadyUsed" kind of error.
  182. type ErrOpenIDAlreadyUsed struct {
  183. OpenID string
  184. }
  185. // IsErrOpenIDAlreadyUsed checks if an error is a ErrOpenIDAlreadyUsed.
  186. func IsErrOpenIDAlreadyUsed(err error) bool {
  187. _, ok := err.(ErrOpenIDAlreadyUsed)
  188. return ok
  189. }
  190. func (err ErrOpenIDAlreadyUsed) Error() string {
  191. return fmt.Sprintf("OpenID already in use [oid: %s]", err.OpenID)
  192. }
  193. // ErrUserOwnRepos represents a "UserOwnRepos" kind of error.
  194. type ErrUserOwnRepos struct {
  195. UID int64
  196. }
  197. // IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.
  198. func IsErrUserOwnRepos(err error) bool {
  199. _, ok := err.(ErrUserOwnRepos)
  200. return ok
  201. }
  202. func (err ErrUserOwnRepos) Error() string {
  203. return fmt.Sprintf("user still has ownership of repositories [uid: %d]", err.UID)
  204. }
  205. // ErrUserHasOrgs represents a "UserHasOrgs" kind of error.
  206. type ErrUserHasOrgs struct {
  207. UID int64
  208. }
  209. // IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.
  210. func IsErrUserHasOrgs(err error) bool {
  211. _, ok := err.(ErrUserHasOrgs)
  212. return ok
  213. }
  214. func (err ErrUserHasOrgs) Error() string {
  215. return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
  216. }
  217. // ErrUserNotAllowedCreateOrg represents a "UserNotAllowedCreateOrg" kind of error.
  218. type ErrUserNotAllowedCreateOrg struct {
  219. }
  220. // IsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.
  221. func IsErrUserNotAllowedCreateOrg(err error) bool {
  222. _, ok := err.(ErrUserNotAllowedCreateOrg)
  223. return ok
  224. }
  225. func (err ErrUserNotAllowedCreateOrg) Error() string {
  226. return "user is not allowed to create organizations"
  227. }
  228. // ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
  229. type ErrReachLimitOfRepo struct {
  230. Limit int
  231. }
  232. // IsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.
  233. func IsErrReachLimitOfRepo(err error) bool {
  234. _, ok := err.(ErrReachLimitOfRepo)
  235. return ok
  236. }
  237. func (err ErrReachLimitOfRepo) Error() string {
  238. return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
  239. }
  240. // __ __.__ __ .__
  241. // / \ / \__| | _|__|
  242. // \ \/\/ / | |/ / |
  243. // \ /| | <| |
  244. // \__/\ / |__|__|_ \__|
  245. // \/ \/
  246. // ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.
  247. type ErrWikiAlreadyExist struct {
  248. Title string
  249. }
  250. // IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
  251. func IsErrWikiAlreadyExist(err error) bool {
  252. _, ok := err.(ErrWikiAlreadyExist)
  253. return ok
  254. }
  255. func (err ErrWikiAlreadyExist) Error() string {
  256. return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
  257. }
  258. // ErrWikiReservedName represents a reserved name error.
  259. type ErrWikiReservedName struct {
  260. Title string
  261. }
  262. // IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
  263. func IsErrWikiReservedName(err error) bool {
  264. _, ok := err.(ErrWikiReservedName)
  265. return ok
  266. }
  267. func (err ErrWikiReservedName) Error() string {
  268. return fmt.Sprintf("wiki title is reserved: %s", err.Title)
  269. }
  270. // ErrWikiInvalidFileName represents an invalid wiki file name.
  271. type ErrWikiInvalidFileName struct {
  272. FileName string
  273. }
  274. // IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
  275. func IsErrWikiInvalidFileName(err error) bool {
  276. _, ok := err.(ErrWikiInvalidFileName)
  277. return ok
  278. }
  279. func (err ErrWikiInvalidFileName) Error() string {
  280. return fmt.Sprintf("Invalid wiki filename: %s", err.FileName)
  281. }
  282. // __________ ___. .__ .__ ____ __.
  283. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__.
  284. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | |
  285. // | | | | / \_\ \ |_| \ \___ | | \ ___/\___ |
  286. // |____| |____/|___ /____/__|\___ > |____|__ \___ > ____|
  287. // \/ \/ \/ \/\/
  288. // ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error.
  289. type ErrKeyUnableVerify struct {
  290. Result string
  291. }
  292. // IsErrKeyUnableVerify checks if an error is a ErrKeyUnableVerify.
  293. func IsErrKeyUnableVerify(err error) bool {
  294. _, ok := err.(ErrKeyUnableVerify)
  295. return ok
  296. }
  297. func (err ErrKeyUnableVerify) Error() string {
  298. return fmt.Sprintf("Unable to verify key content [result: %s]", err.Result)
  299. }
  300. // ErrKeyNotExist represents a "KeyNotExist" kind of error.
  301. type ErrKeyNotExist struct {
  302. ID int64
  303. }
  304. // IsErrKeyNotExist checks if an error is a ErrKeyNotExist.
  305. func IsErrKeyNotExist(err error) bool {
  306. _, ok := err.(ErrKeyNotExist)
  307. return ok
  308. }
  309. func (err ErrKeyNotExist) Error() string {
  310. return fmt.Sprintf("public key does not exist [id: %d]", err.ID)
  311. }
  312. // ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error.
  313. type ErrKeyAlreadyExist struct {
  314. OwnerID int64
  315. Fingerprint string
  316. Content string
  317. }
  318. // IsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist.
  319. func IsErrKeyAlreadyExist(err error) bool {
  320. _, ok := err.(ErrKeyAlreadyExist)
  321. return ok
  322. }
  323. func (err ErrKeyAlreadyExist) Error() string {
  324. return fmt.Sprintf("public key already exists [owner_id: %d, finger_print: %s, content: %s]",
  325. err.OwnerID, err.Fingerprint, err.Content)
  326. }
  327. // ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error.
  328. type ErrKeyNameAlreadyUsed struct {
  329. OwnerID int64
  330. Name string
  331. }
  332. // IsErrKeyNameAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  333. func IsErrKeyNameAlreadyUsed(err error) bool {
  334. _, ok := err.(ErrKeyNameAlreadyUsed)
  335. return ok
  336. }
  337. func (err ErrKeyNameAlreadyUsed) Error() string {
  338. return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name)
  339. }
  340. // ErrGPGNoEmailFound represents a "ErrGPGNoEmailFound" kind of error.
  341. type ErrGPGNoEmailFound struct {
  342. FailedEmails []string
  343. }
  344. // IsErrGPGNoEmailFound checks if an error is a ErrGPGNoEmailFound.
  345. func IsErrGPGNoEmailFound(err error) bool {
  346. _, ok := err.(ErrGPGNoEmailFound)
  347. return ok
  348. }
  349. func (err ErrGPGNoEmailFound) Error() string {
  350. return fmt.Sprintf("none of the emails attached to the GPG key could be found: %v", err.FailedEmails)
  351. }
  352. // ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error.
  353. type ErrGPGKeyParsing struct {
  354. ParseError error
  355. }
  356. // IsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing.
  357. func IsErrGPGKeyParsing(err error) bool {
  358. _, ok := err.(ErrGPGKeyParsing)
  359. return ok
  360. }
  361. func (err ErrGPGKeyParsing) Error() string {
  362. return fmt.Sprintf("failed to parse gpg key %s", err.ParseError.Error())
  363. }
  364. // ErrGPGKeyNotExist represents a "GPGKeyNotExist" kind of error.
  365. type ErrGPGKeyNotExist struct {
  366. ID int64
  367. }
  368. // IsErrGPGKeyNotExist checks if an error is a ErrGPGKeyNotExist.
  369. func IsErrGPGKeyNotExist(err error) bool {
  370. _, ok := err.(ErrGPGKeyNotExist)
  371. return ok
  372. }
  373. func (err ErrGPGKeyNotExist) Error() string {
  374. return fmt.Sprintf("public gpg key does not exist [id: %d]", err.ID)
  375. }
  376. // ErrGPGKeyImportNotExist represents a "GPGKeyImportNotExist" kind of error.
  377. type ErrGPGKeyImportNotExist struct {
  378. ID string
  379. }
  380. // IsErrGPGKeyImportNotExist checks if an error is a ErrGPGKeyImportNotExist.
  381. func IsErrGPGKeyImportNotExist(err error) bool {
  382. _, ok := err.(ErrGPGKeyImportNotExist)
  383. return ok
  384. }
  385. func (err ErrGPGKeyImportNotExist) Error() string {
  386. return fmt.Sprintf("public gpg key import does not exist [id: %s]", err.ID)
  387. }
  388. // ErrGPGKeyIDAlreadyUsed represents a "GPGKeyIDAlreadyUsed" kind of error.
  389. type ErrGPGKeyIDAlreadyUsed struct {
  390. KeyID string
  391. }
  392. // IsErrGPGKeyIDAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  393. func IsErrGPGKeyIDAlreadyUsed(err error) bool {
  394. _, ok := err.(ErrGPGKeyIDAlreadyUsed)
  395. return ok
  396. }
  397. func (err ErrGPGKeyIDAlreadyUsed) Error() string {
  398. return fmt.Sprintf("public key already exists [key_id: %s]", err.KeyID)
  399. }
  400. // ErrGPGKeyAccessDenied represents a "GPGKeyAccessDenied" kind of Error.
  401. type ErrGPGKeyAccessDenied struct {
  402. UserID int64
  403. KeyID int64
  404. }
  405. // IsErrGPGKeyAccessDenied checks if an error is a ErrGPGKeyAccessDenied.
  406. func IsErrGPGKeyAccessDenied(err error) bool {
  407. _, ok := err.(ErrGPGKeyAccessDenied)
  408. return ok
  409. }
  410. // Error pretty-prints an error of type ErrGPGKeyAccessDenied.
  411. func (err ErrGPGKeyAccessDenied) Error() string {
  412. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d]",
  413. err.UserID, err.KeyID)
  414. }
  415. // ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error.
  416. type ErrKeyAccessDenied struct {
  417. UserID int64
  418. KeyID int64
  419. Note string
  420. }
  421. // IsErrKeyAccessDenied checks if an error is a ErrKeyAccessDenied.
  422. func IsErrKeyAccessDenied(err error) bool {
  423. _, ok := err.(ErrKeyAccessDenied)
  424. return ok
  425. }
  426. func (err ErrKeyAccessDenied) Error() string {
  427. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
  428. err.UserID, err.KeyID, err.Note)
  429. }
  430. // ErrDeployKeyNotExist represents a "DeployKeyNotExist" kind of error.
  431. type ErrDeployKeyNotExist struct {
  432. ID int64
  433. KeyID int64
  434. RepoID int64
  435. }
  436. // IsErrDeployKeyNotExist checks if an error is a ErrDeployKeyNotExist.
  437. func IsErrDeployKeyNotExist(err error) bool {
  438. _, ok := err.(ErrDeployKeyNotExist)
  439. return ok
  440. }
  441. func (err ErrDeployKeyNotExist) Error() string {
  442. return fmt.Sprintf("Deploy key does not exist [id: %d, key_id: %d, repo_id: %d]", err.ID, err.KeyID, err.RepoID)
  443. }
  444. // ErrDeployKeyAlreadyExist represents a "DeployKeyAlreadyExist" kind of error.
  445. type ErrDeployKeyAlreadyExist struct {
  446. KeyID int64
  447. RepoID int64
  448. }
  449. // IsErrDeployKeyAlreadyExist checks if an error is a ErrDeployKeyAlreadyExist.
  450. func IsErrDeployKeyAlreadyExist(err error) bool {
  451. _, ok := err.(ErrDeployKeyAlreadyExist)
  452. return ok
  453. }
  454. func (err ErrDeployKeyAlreadyExist) Error() string {
  455. return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID)
  456. }
  457. // ErrDeployKeyNameAlreadyUsed represents a "DeployKeyNameAlreadyUsed" kind of error.
  458. type ErrDeployKeyNameAlreadyUsed struct {
  459. RepoID int64
  460. Name string
  461. }
  462. // IsErrDeployKeyNameAlreadyUsed checks if an error is a ErrDeployKeyNameAlreadyUsed.
  463. func IsErrDeployKeyNameAlreadyUsed(err error) bool {
  464. _, ok := err.(ErrDeployKeyNameAlreadyUsed)
  465. return ok
  466. }
  467. func (err ErrDeployKeyNameAlreadyUsed) Error() string {
  468. return fmt.Sprintf("public key with name already exists [repo_id: %d, name: %s]", err.RepoID, err.Name)
  469. }
  470. // _____ ___________ __
  471. // / _ \ ____ ____ ____ ______ _____\__ ___/___ | | __ ____ ____
  472. // / /_\ \_/ ___\/ ___\/ __ \ / ___// ___/ | | / _ \| |/ // __ \ / \
  473. // / | \ \__\ \__\ ___/ \___ \ \___ \ | |( <_> ) <\ ___/| | \
  474. // \____|__ /\___ >___ >___ >____ >____ > |____| \____/|__|_ \\___ >___| /
  475. // \/ \/ \/ \/ \/ \/ \/ \/ \/
  476. // ErrAccessTokenNotExist represents a "AccessTokenNotExist" kind of error.
  477. type ErrAccessTokenNotExist struct {
  478. Token string
  479. }
  480. // IsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.
  481. func IsErrAccessTokenNotExist(err error) bool {
  482. _, ok := err.(ErrAccessTokenNotExist)
  483. return ok
  484. }
  485. func (err ErrAccessTokenNotExist) Error() string {
  486. return fmt.Sprintf("access token does not exist [sha: %s]", err.Token)
  487. }
  488. // ErrAccessTokenEmpty represents a "AccessTokenEmpty" kind of error.
  489. type ErrAccessTokenEmpty struct {
  490. }
  491. // IsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.
  492. func IsErrAccessTokenEmpty(err error) bool {
  493. _, ok := err.(ErrAccessTokenEmpty)
  494. return ok
  495. }
  496. func (err ErrAccessTokenEmpty) Error() string {
  497. return "access token is empty"
  498. }
  499. // ________ .__ __ .__
  500. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  501. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  502. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  503. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  504. // \/ /_____/ \/ \/ \/ \/ \/
  505. // ErrOrgNotExist represents a "OrgNotExist" kind of error.
  506. type ErrOrgNotExist struct {
  507. ID int64
  508. Name string
  509. }
  510. // IsErrOrgNotExist checks if an error is a ErrOrgNotExist.
  511. func IsErrOrgNotExist(err error) bool {
  512. _, ok := err.(ErrOrgNotExist)
  513. return ok
  514. }
  515. func (err ErrOrgNotExist) Error() string {
  516. return fmt.Sprintf("org does not exist [id: %d, name: %s]", err.ID, err.Name)
  517. }
  518. // ErrLastOrgOwner represents a "LastOrgOwner" kind of error.
  519. type ErrLastOrgOwner struct {
  520. UID int64
  521. }
  522. // IsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.
  523. func IsErrLastOrgOwner(err error) bool {
  524. _, ok := err.(ErrLastOrgOwner)
  525. return ok
  526. }
  527. func (err ErrLastOrgOwner) Error() string {
  528. return fmt.Sprintf("user is the last member of owner team [uid: %d]", err.UID)
  529. }
  530. //.____ ____________________
  531. //| | \_ _____/ _____/
  532. //| | | __) \_____ \
  533. //| |___| \ / \
  534. //|_______ \___ / /_______ /
  535. // \/ \/ \/
  536. // ErrLFSLockNotExist represents a "LFSLockNotExist" kind of error.
  537. type ErrLFSLockNotExist struct {
  538. ID int64
  539. RepoID int64
  540. Path string
  541. }
  542. // IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
  543. func IsErrLFSLockNotExist(err error) bool {
  544. _, ok := err.(ErrLFSLockNotExist)
  545. return ok
  546. }
  547. func (err ErrLFSLockNotExist) Error() string {
  548. return fmt.Sprintf("lfs lock does not exist [id: %d, rid: %d, path: %s]", err.ID, err.RepoID, err.Path)
  549. }
  550. // ErrLFSUnauthorizedAction represents a "LFSUnauthorizedAction" kind of error.
  551. type ErrLFSUnauthorizedAction struct {
  552. RepoID int64
  553. UserName string
  554. Mode AccessMode
  555. }
  556. // IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
  557. func IsErrLFSUnauthorizedAction(err error) bool {
  558. _, ok := err.(ErrLFSUnauthorizedAction)
  559. return ok
  560. }
  561. func (err ErrLFSUnauthorizedAction) Error() string {
  562. if err.Mode == AccessModeWrite {
  563. return fmt.Sprintf("User %s doesn't have write access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  564. }
  565. return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  566. }
  567. // ErrLFSLockAlreadyExist represents a "LFSLockAlreadyExist" kind of error.
  568. type ErrLFSLockAlreadyExist struct {
  569. RepoID int64
  570. Path string
  571. }
  572. // IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
  573. func IsErrLFSLockAlreadyExist(err error) bool {
  574. _, ok := err.(ErrLFSLockAlreadyExist)
  575. return ok
  576. }
  577. func (err ErrLFSLockAlreadyExist) Error() string {
  578. return fmt.Sprintf("lfs lock already exists [rid: %d, path: %s]", err.RepoID, err.Path)
  579. }
  580. // ErrLFSFileLocked represents a "LFSFileLocked" kind of error.
  581. type ErrLFSFileLocked struct {
  582. RepoID int64
  583. Path string
  584. UserName string
  585. }
  586. // IsErrLFSFileLocked checks if an error is a ErrLFSFileLocked.
  587. func IsErrLFSFileLocked(err error) bool {
  588. _, ok := err.(ErrLFSFileLocked)
  589. return ok
  590. }
  591. func (err ErrLFSFileLocked) Error() string {
  592. return fmt.Sprintf("File is lfs locked [repo: %d, locked by: %s, path: %s]", err.RepoID, err.UserName, err.Path)
  593. }
  594. // __________ .__ __
  595. // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
  596. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
  597. // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
  598. // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
  599. // \/ \/|__| \/ \/
  600. // ErrRepoNotExist represents a "RepoNotExist" kind of error.
  601. type ErrRepoNotExist struct {
  602. ID int64
  603. UID int64
  604. OwnerName string
  605. Name string
  606. }
  607. // IsErrRepoNotExist checks if an error is a ErrRepoNotExist.
  608. func IsErrRepoNotExist(err error) bool {
  609. _, ok := err.(ErrRepoNotExist)
  610. return ok
  611. }
  612. func (err ErrRepoNotExist) Error() string {
  613. return fmt.Sprintf("repository does not exist [id: %d, uid: %d, owner_name: %s, name: %s]",
  614. err.ID, err.UID, err.OwnerName, err.Name)
  615. }
  616. // ErrNoPendingRepoTransfer is an error type for repositories without a pending
  617. // transfer request
  618. type ErrNoPendingRepoTransfer struct {
  619. RepoID int64
  620. }
  621. func (e ErrNoPendingRepoTransfer) Error() string {
  622. return fmt.Sprintf("repository doesn't have a pending transfer [repo_id: %d]", e.RepoID)
  623. }
  624. // IsErrNoPendingTransfer is an error type when a repository has no pending
  625. // transfers
  626. func IsErrNoPendingTransfer(err error) bool {
  627. _, ok := err.(ErrNoPendingRepoTransfer)
  628. return ok
  629. }
  630. // ErrRepoTransferInProgress represents the state of a repository that has an
  631. // ongoing transfer
  632. type ErrRepoTransferInProgress struct {
  633. Uname string
  634. Name string
  635. }
  636. // IsErrRepoTransferInProgress checks if an error is a ErrRepoTransferInProgress.
  637. func IsErrRepoTransferInProgress(err error) bool {
  638. _, ok := err.(ErrRepoTransferInProgress)
  639. return ok
  640. }
  641. func (err ErrRepoTransferInProgress) Error() string {
  642. return fmt.Sprintf("repository is already being transferred [uname: %s, name: %s]", err.Uname, err.Name)
  643. }
  644. // ErrRepoAlreadyExist represents a "RepoAlreadyExist" kind of error.
  645. type ErrRepoAlreadyExist struct {
  646. Uname string
  647. Name string
  648. }
  649. // IsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.
  650. func IsErrRepoAlreadyExist(err error) bool {
  651. _, ok := err.(ErrRepoAlreadyExist)
  652. return ok
  653. }
  654. func (err ErrRepoAlreadyExist) Error() string {
  655. return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
  656. }
  657. // ErrRepoFilesAlreadyExist represents a "RepoFilesAlreadyExist" kind of error.
  658. type ErrRepoFilesAlreadyExist struct {
  659. Uname string
  660. Name string
  661. }
  662. // IsErrRepoFilesAlreadyExist checks if an error is a ErrRepoAlreadyExist.
  663. func IsErrRepoFilesAlreadyExist(err error) bool {
  664. _, ok := err.(ErrRepoFilesAlreadyExist)
  665. return ok
  666. }
  667. func (err ErrRepoFilesAlreadyExist) Error() string {
  668. return fmt.Sprintf("repository files already exist [uname: %s, name: %s]", err.Uname, err.Name)
  669. }
  670. // ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error.
  671. type ErrForkAlreadyExist struct {
  672. Uname string
  673. RepoName string
  674. ForkName string
  675. }
  676. // IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist.
  677. func IsErrForkAlreadyExist(err error) bool {
  678. _, ok := err.(ErrForkAlreadyExist)
  679. return ok
  680. }
  681. func (err ErrForkAlreadyExist) Error() string {
  682. return fmt.Sprintf("repository is already forked by user [uname: %s, repo path: %s, fork path: %s]", err.Uname, err.RepoName, err.ForkName)
  683. }
  684. // ErrRepoRedirectNotExist represents a "RepoRedirectNotExist" kind of error.
  685. type ErrRepoRedirectNotExist struct {
  686. OwnerID int64
  687. RepoName string
  688. }
  689. // IsErrRepoRedirectNotExist check if an error is an ErrRepoRedirectNotExist.
  690. func IsErrRepoRedirectNotExist(err error) bool {
  691. _, ok := err.(ErrRepoRedirectNotExist)
  692. return ok
  693. }
  694. func (err ErrRepoRedirectNotExist) Error() string {
  695. return fmt.Sprintf("repository redirect does not exist [uid: %d, name: %s]", err.OwnerID, err.RepoName)
  696. }
  697. // ErrInvalidCloneAddr represents a "InvalidCloneAddr" kind of error.
  698. type ErrInvalidCloneAddr struct {
  699. IsURLError bool
  700. IsInvalidPath bool
  701. IsPermissionDenied bool
  702. }
  703. // IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.
  704. func IsErrInvalidCloneAddr(err error) bool {
  705. _, ok := err.(ErrInvalidCloneAddr)
  706. return ok
  707. }
  708. func (err ErrInvalidCloneAddr) Error() string {
  709. return fmt.Sprintf("invalid clone address [is_url_error: %v, is_invalid_path: %v, is_permission_denied: %v]",
  710. err.IsURLError, err.IsInvalidPath, err.IsPermissionDenied)
  711. }
  712. // ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error.
  713. type ErrUpdateTaskNotExist struct {
  714. UUID string
  715. }
  716. // IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.
  717. func IsErrUpdateTaskNotExist(err error) bool {
  718. _, ok := err.(ErrUpdateTaskNotExist)
  719. return ok
  720. }
  721. func (err ErrUpdateTaskNotExist) Error() string {
  722. return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
  723. }
  724. // ErrReleaseAlreadyExist represents a "ReleaseAlreadyExist" kind of error.
  725. type ErrReleaseAlreadyExist struct {
  726. TagName string
  727. }
  728. // IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.
  729. func IsErrReleaseAlreadyExist(err error) bool {
  730. _, ok := err.(ErrReleaseAlreadyExist)
  731. return ok
  732. }
  733. func (err ErrReleaseAlreadyExist) Error() string {
  734. return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
  735. }
  736. // ErrReleaseNotExist represents a "ReleaseNotExist" kind of error.
  737. type ErrReleaseNotExist struct {
  738. ID int64
  739. TagName string
  740. }
  741. // IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.
  742. func IsErrReleaseNotExist(err error) bool {
  743. _, ok := err.(ErrReleaseNotExist)
  744. return ok
  745. }
  746. func (err ErrReleaseNotExist) Error() string {
  747. return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
  748. }
  749. // ErrInvalidTagName represents a "InvalidTagName" kind of error.
  750. type ErrInvalidTagName struct {
  751. TagName string
  752. }
  753. // IsErrInvalidTagName checks if an error is a ErrInvalidTagName.
  754. func IsErrInvalidTagName(err error) bool {
  755. _, ok := err.(ErrInvalidTagName)
  756. return ok
  757. }
  758. func (err ErrInvalidTagName) Error() string {
  759. return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
  760. }
  761. // ErrRepoFileAlreadyExists represents a "RepoFileAlreadyExist" kind of error.
  762. type ErrRepoFileAlreadyExists struct {
  763. Path string
  764. }
  765. // IsErrRepoFileAlreadyExists checks if an error is a ErrRepoFileAlreadyExists.
  766. func IsErrRepoFileAlreadyExists(err error) bool {
  767. _, ok := err.(ErrRepoFileAlreadyExists)
  768. return ok
  769. }
  770. func (err ErrRepoFileAlreadyExists) Error() string {
  771. return fmt.Sprintf("repository file already exists [path: %s]", err.Path)
  772. }
  773. // ErrRepoFileDoesNotExist represents a "RepoFileDoesNotExist" kind of error.
  774. type ErrRepoFileDoesNotExist struct {
  775. Path string
  776. Name string
  777. }
  778. // IsErrRepoFileDoesNotExist checks if an error is a ErrRepoDoesNotExist.
  779. func IsErrRepoFileDoesNotExist(err error) bool {
  780. _, ok := err.(ErrRepoFileDoesNotExist)
  781. return ok
  782. }
  783. func (err ErrRepoFileDoesNotExist) Error() string {
  784. return fmt.Sprintf("repository file does not exist [path: %s]", err.Path)
  785. }
  786. // ErrFilenameInvalid represents a "FilenameInvalid" kind of error.
  787. type ErrFilenameInvalid struct {
  788. Path string
  789. }
  790. // IsErrFilenameInvalid checks if an error is an ErrFilenameInvalid.
  791. func IsErrFilenameInvalid(err error) bool {
  792. _, ok := err.(ErrFilenameInvalid)
  793. return ok
  794. }
  795. func (err ErrFilenameInvalid) Error() string {
  796. return fmt.Sprintf("path contains a malformed path component [path: %s]", err.Path)
  797. }
  798. // ErrUserCannotCommit represents "UserCannotCommit" kind of error.
  799. type ErrUserCannotCommit struct {
  800. UserName string
  801. }
  802. // IsErrUserCannotCommit checks if an error is an ErrUserCannotCommit.
  803. func IsErrUserCannotCommit(err error) bool {
  804. _, ok := err.(ErrUserCannotCommit)
  805. return ok
  806. }
  807. func (err ErrUserCannotCommit) Error() string {
  808. return fmt.Sprintf("user cannot commit to repo [user: %s]", err.UserName)
  809. }
  810. // ErrFilePathInvalid represents a "FilePathInvalid" kind of error.
  811. type ErrFilePathInvalid struct {
  812. Message string
  813. Path string
  814. Name string
  815. Type git.EntryMode
  816. }
  817. // IsErrFilePathInvalid checks if an error is an ErrFilePathInvalid.
  818. func IsErrFilePathInvalid(err error) bool {
  819. _, ok := err.(ErrFilePathInvalid)
  820. return ok
  821. }
  822. func (err ErrFilePathInvalid) Error() string {
  823. if err.Message != "" {
  824. return err.Message
  825. }
  826. return fmt.Sprintf("path is invalid [path: %s]", err.Path)
  827. }
  828. // ErrFilePathProtected represents a "FilePathProtected" kind of error.
  829. type ErrFilePathProtected struct {
  830. Message string
  831. Path string
  832. }
  833. // IsErrFilePathProtected checks if an error is an ErrFilePathProtected.
  834. func IsErrFilePathProtected(err error) bool {
  835. _, ok := err.(ErrFilePathProtected)
  836. return ok
  837. }
  838. func (err ErrFilePathProtected) Error() string {
  839. if err.Message != "" {
  840. return err.Message
  841. }
  842. return fmt.Sprintf("path is protected and can not be changed [path: %s]", err.Path)
  843. }
  844. // ErrUserDoesNotHaveAccessToRepo represets an error where the user doesn't has access to a given repo.
  845. type ErrUserDoesNotHaveAccessToRepo struct {
  846. UserID int64
  847. RepoName string
  848. }
  849. // IsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrRepoFileAlreadyExists.
  850. func IsErrUserDoesNotHaveAccessToRepo(err error) bool {
  851. _, ok := err.(ErrUserDoesNotHaveAccessToRepo)
  852. return ok
  853. }
  854. func (err ErrUserDoesNotHaveAccessToRepo) Error() string {
  855. return fmt.Sprintf("user doesn't have acces to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName)
  856. }
  857. // ErrWontSign explains the first reason why a commit would not be signed
  858. // There may be other reasons - this is just the first reason found
  859. type ErrWontSign struct {
  860. Reason signingMode
  861. }
  862. func (e *ErrWontSign) Error() string {
  863. return fmt.Sprintf("wont sign: %s", e.Reason)
  864. }
  865. // IsErrWontSign checks if an error is a ErrWontSign
  866. func IsErrWontSign(err error) bool {
  867. _, ok := err.(*ErrWontSign)
  868. return ok
  869. }
  870. // ErrMigrationNotAllowed explains why a migration from an url is not allowed
  871. type ErrMigrationNotAllowed struct {
  872. Host string
  873. NotResolvedIP bool
  874. PrivateNet string
  875. }
  876. func (e *ErrMigrationNotAllowed) Error() string {
  877. if e.NotResolvedIP {
  878. return fmt.Sprintf("migrate from '%s' is not allowed: unknown hostname", e.Host)
  879. }
  880. if len(e.PrivateNet) != 0 {
  881. return fmt.Sprintf("migrate from '%s' is not allowed: the host resolve to a private ip address '%s'", e.Host, e.PrivateNet)
  882. }
  883. return fmt.Sprintf("migrate from '%s is not allowed'", e.Host)
  884. }
  885. // IsErrMigrationNotAllowed checks if an error is a ErrMigrationNotAllowed
  886. func IsErrMigrationNotAllowed(err error) bool {
  887. _, ok := err.(*ErrMigrationNotAllowed)
  888. return ok
  889. }
  890. // __________ .__
  891. // \______ \____________ ____ ____ | |__
  892. // | | _/\_ __ \__ \ / \_/ ___\| | \
  893. // | | \ | | \// __ \| | \ \___| Y \
  894. // |______ / |__| (____ /___| /\___ >___| /
  895. // \/ \/ \/ \/ \/
  896. // ErrBranchDoesNotExist represents an error that branch with such name does not exist.
  897. type ErrBranchDoesNotExist struct {
  898. BranchName string
  899. }
  900. // IsErrBranchDoesNotExist checks if an error is an ErrBranchDoesNotExist.
  901. func IsErrBranchDoesNotExist(err error) bool {
  902. _, ok := err.(ErrBranchDoesNotExist)
  903. return ok
  904. }
  905. func (err ErrBranchDoesNotExist) Error() string {
  906. return fmt.Sprintf("branch does not exist [name: %s]", err.BranchName)
  907. }
  908. // ErrBranchAlreadyExists represents an error that branch with such name already exists.
  909. type ErrBranchAlreadyExists struct {
  910. BranchName string
  911. }
  912. // IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.
  913. func IsErrBranchAlreadyExists(err error) bool {
  914. _, ok := err.(ErrBranchAlreadyExists)
  915. return ok
  916. }
  917. func (err ErrBranchAlreadyExists) Error() string {
  918. return fmt.Sprintf("branch already exists [name: %s]", err.BranchName)
  919. }
  920. // ErrBranchNameConflict represents an error that branch name conflicts with other branch.
  921. type ErrBranchNameConflict struct {
  922. BranchName string
  923. }
  924. // IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.
  925. func IsErrBranchNameConflict(err error) bool {
  926. _, ok := err.(ErrBranchNameConflict)
  927. return ok
  928. }
  929. func (err ErrBranchNameConflict) Error() string {
  930. return fmt.Sprintf("branch conflicts with existing branch [name: %s]", err.BranchName)
  931. }
  932. // ErrBranchesEqual represents an error that branch name conflicts with other branch.
  933. type ErrBranchesEqual struct {
  934. BaseBranchName string
  935. HeadBranchName string
  936. }
  937. // IsErrBranchesEqual checks if an error is an ErrBranchesEqual.
  938. func IsErrBranchesEqual(err error) bool {
  939. _, ok := err.(ErrBranchesEqual)
  940. return ok
  941. }
  942. func (err ErrBranchesEqual) Error() string {
  943. return fmt.Sprintf("branches are equal [head: %sm base: %s]", err.HeadBranchName, err.BaseBranchName)
  944. }
  945. // ErrNotAllowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it.
  946. type ErrNotAllowedToMerge struct {
  947. Reason string
  948. }
  949. // IsErrNotAllowedToMerge checks if an error is an ErrNotAllowedToMerge.
  950. func IsErrNotAllowedToMerge(err error) bool {
  951. _, ok := err.(ErrNotAllowedToMerge)
  952. return ok
  953. }
  954. func (err ErrNotAllowedToMerge) Error() string {
  955. return fmt.Sprintf("not allowed to merge [reason: %s]", err.Reason)
  956. }
  957. // ErrTagAlreadyExists represents an error that tag with such name already exists.
  958. type ErrTagAlreadyExists struct {
  959. TagName string
  960. }
  961. // IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.
  962. func IsErrTagAlreadyExists(err error) bool {
  963. _, ok := err.(ErrTagAlreadyExists)
  964. return ok
  965. }
  966. func (err ErrTagAlreadyExists) Error() string {
  967. return fmt.Sprintf("tag already exists [name: %s]", err.TagName)
  968. }
  969. // ErrSHADoesNotMatch represents a "SHADoesNotMatch" kind of error.
  970. type ErrSHADoesNotMatch struct {
  971. Path string
  972. GivenSHA string
  973. CurrentSHA string
  974. }
  975. // IsErrSHADoesNotMatch checks if an error is a ErrSHADoesNotMatch.
  976. func IsErrSHADoesNotMatch(err error) bool {
  977. _, ok := err.(ErrSHADoesNotMatch)
  978. return ok
  979. }
  980. func (err ErrSHADoesNotMatch) Error() string {
  981. return fmt.Sprintf("sha does not match [given: %s, expected: %s]", err.GivenSHA, err.CurrentSHA)
  982. }
  983. // ErrSHANotFound represents a "SHADoesNotMatch" kind of error.
  984. type ErrSHANotFound struct {
  985. SHA string
  986. }
  987. // IsErrSHANotFound checks if an error is a ErrSHANotFound.
  988. func IsErrSHANotFound(err error) bool {
  989. _, ok := err.(ErrSHANotFound)
  990. return ok
  991. }
  992. func (err ErrSHANotFound) Error() string {
  993. return fmt.Sprintf("sha not found [%s]", err.SHA)
  994. }
  995. // ErrCommitIDDoesNotMatch represents a "CommitIDDoesNotMatch" kind of error.
  996. type ErrCommitIDDoesNotMatch struct {
  997. GivenCommitID string
  998. CurrentCommitID string
  999. }
  1000. // IsErrCommitIDDoesNotMatch checks if an error is a ErrCommitIDDoesNotMatch.
  1001. func IsErrCommitIDDoesNotMatch(err error) bool {
  1002. _, ok := err.(ErrCommitIDDoesNotMatch)
  1003. return ok
  1004. }
  1005. func (err ErrCommitIDDoesNotMatch) Error() string {
  1006. return fmt.Sprintf("file CommitID does not match [given: %s, expected: %s]", err.GivenCommitID, err.CurrentCommitID)
  1007. }
  1008. // ErrSHAOrCommitIDNotProvided represents a "SHAOrCommitIDNotProvided" kind of error.
  1009. type ErrSHAOrCommitIDNotProvided struct{}
  1010. // IsErrSHAOrCommitIDNotProvided checks if an error is a ErrSHAOrCommitIDNotProvided.
  1011. func IsErrSHAOrCommitIDNotProvided(err error) bool {
  1012. _, ok := err.(ErrSHAOrCommitIDNotProvided)
  1013. return ok
  1014. }
  1015. func (err ErrSHAOrCommitIDNotProvided) Error() string {
  1016. return "a SHA or commmit ID must be proved when updating a file"
  1017. }
  1018. // __ __ ___. .__ __
  1019. // / \ / \ ____\_ |__ | |__ ____ ____ | | __
  1020. // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
  1021. // \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
  1022. // \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
  1023. // \/ \/ \/ \/ \/
  1024. // ErrWebhookNotExist represents a "WebhookNotExist" kind of error.
  1025. type ErrWebhookNotExist struct {
  1026. ID int64
  1027. }
  1028. // IsErrWebhookNotExist checks if an error is a ErrWebhookNotExist.
  1029. func IsErrWebhookNotExist(err error) bool {
  1030. _, ok := err.(ErrWebhookNotExist)
  1031. return ok
  1032. }
  1033. func (err ErrWebhookNotExist) Error() string {
  1034. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  1035. }
  1036. // .___
  1037. // | | ______ ________ __ ____
  1038. // | |/ ___// ___/ | \_/ __ \
  1039. // | |\___ \ \___ \| | /\ ___/
  1040. // |___/____ >____ >____/ \___ >
  1041. // \/ \/ \/
  1042. // ErrIssueNotExist represents a "IssueNotExist" kind of error.
  1043. type ErrIssueNotExist struct {
  1044. ID int64
  1045. RepoID int64
  1046. Index int64
  1047. }
  1048. // IsErrIssueNotExist checks if an error is a ErrIssueNotExist.
  1049. func IsErrIssueNotExist(err error) bool {
  1050. _, ok := err.(ErrIssueNotExist)
  1051. return ok
  1052. }
  1053. func (err ErrIssueNotExist) Error() string {
  1054. return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  1055. }
  1056. // ErrIssueIsClosed represents a "IssueIsClosed" kind of error.
  1057. type ErrIssueIsClosed struct {
  1058. ID int64
  1059. RepoID int64
  1060. Index int64
  1061. }
  1062. // IsErrIssueIsClosed checks if an error is a ErrIssueNotExist.
  1063. func IsErrIssueIsClosed(err error) bool {
  1064. _, ok := err.(ErrIssueIsClosed)
  1065. return ok
  1066. }
  1067. func (err ErrIssueIsClosed) Error() string {
  1068. return fmt.Sprintf("issue is closed [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  1069. }
  1070. // ErrIssueLabelTemplateLoad represents a "ErrIssueLabelTemplateLoad" kind of error.
  1071. type ErrIssueLabelTemplateLoad struct {
  1072. TemplateFile string
  1073. OriginalError error
  1074. }
  1075. // IsErrIssueLabelTemplateLoad checks if an error is a ErrIssueLabelTemplateLoad.
  1076. func IsErrIssueLabelTemplateLoad(err error) bool {
  1077. _, ok := err.(ErrIssueLabelTemplateLoad)
  1078. return ok
  1079. }
  1080. func (err ErrIssueLabelTemplateLoad) Error() string {
  1081. return fmt.Sprintf("Failed to load label template file '%s': %v", err.TemplateFile, err.OriginalError)
  1082. }
  1083. // ErrNewIssueInsert is used when the INSERT statement in newIssue fails
  1084. type ErrNewIssueInsert struct {
  1085. OriginalError error
  1086. }
  1087. // IsErrNewIssueInsert checks if an error is a ErrNewIssueInsert.
  1088. func IsErrNewIssueInsert(err error) bool {
  1089. _, ok := err.(ErrNewIssueInsert)
  1090. return ok
  1091. }
  1092. func (err ErrNewIssueInsert) Error() string {
  1093. return err.OriginalError.Error()
  1094. }
  1095. // ErrIssueWasClosed is used when close a closed issue
  1096. type ErrIssueWasClosed struct {
  1097. ID int64
  1098. Index int64
  1099. }
  1100. // IsErrIssueWasClosed checks if an error is a ErrIssueWasClosed.
  1101. func IsErrIssueWasClosed(err error) bool {
  1102. _, ok := err.(ErrIssueWasClosed)
  1103. return ok
  1104. }
  1105. func (err ErrIssueWasClosed) Error() string {
  1106. return fmt.Sprintf("Issue [%d] %d was already closed", err.ID, err.Index)
  1107. }
  1108. // ErrPullWasClosed is used close a closed pull request
  1109. type ErrPullWasClosed struct {
  1110. ID int64
  1111. Index int64
  1112. }
  1113. // IsErrPullWasClosed checks if an error is a ErrErrPullWasClosed.
  1114. func IsErrPullWasClosed(err error) bool {
  1115. _, ok := err.(ErrPullWasClosed)
  1116. return ok
  1117. }
  1118. func (err ErrPullWasClosed) Error() string {
  1119. return fmt.Sprintf("Pull request [%d] %d was already closed", err.ID, err.Index)
  1120. }
  1121. // ErrForbiddenIssueReaction is used when a forbidden reaction was try to created
  1122. type ErrForbiddenIssueReaction struct {
  1123. Reaction string
  1124. }
  1125. // IsErrForbiddenIssueReaction checks if an error is a ErrForbiddenIssueReaction.
  1126. func IsErrForbiddenIssueReaction(err error) bool {
  1127. _, ok := err.(ErrForbiddenIssueReaction)
  1128. return ok
  1129. }
  1130. func (err ErrForbiddenIssueReaction) Error() string {
  1131. return fmt.Sprintf("'%s' is not an allowed reaction", err.Reaction)
  1132. }
  1133. // ErrReactionAlreadyExist is used when a existing reaction was try to created
  1134. type ErrReactionAlreadyExist struct {
  1135. Reaction string
  1136. }
  1137. // IsErrReactionAlreadyExist checks if an error is a ErrReactionAlreadyExist.
  1138. func IsErrReactionAlreadyExist(err error) bool {
  1139. _, ok := err.(ErrReactionAlreadyExist)
  1140. return ok
  1141. }
  1142. func (err ErrReactionAlreadyExist) Error() string {
  1143. return fmt.Sprintf("reaction '%s' already exists", err.Reaction)
  1144. }
  1145. // __________ .__ .__ __________ __
  1146. // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
  1147. // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
  1148. // | | | | / |_| |_| | \ ___< <_| | | /\ ___/ \___ \ | |
  1149. // |____| |____/|____/____/____|_ /\___ >__ |____/ \___ >____ > |__|
  1150. // \/ \/ |__| \/ \/
  1151. // ErrPullRequestNotExist represents a "PullRequestNotExist" kind of error.
  1152. type ErrPullRequestNotExist struct {
  1153. ID int64
  1154. IssueID int64
  1155. HeadRepoID int64
  1156. BaseRepoID int64
  1157. HeadBranch string
  1158. BaseBranch string
  1159. }
  1160. // IsErrPullRequestNotExist checks if an error is a ErrPullRequestNotExist.
  1161. func IsErrPullRequestNotExist(err error) bool {
  1162. _, ok := err.(ErrPullRequestNotExist)
  1163. return ok
  1164. }
  1165. func (err ErrPullRequestNotExist) Error() string {
  1166. return fmt.Sprintf("pull request does not exist [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
  1167. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1168. }
  1169. // ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
  1170. type ErrPullRequestAlreadyExists struct {
  1171. ID int64
  1172. IssueID int64
  1173. HeadRepoID int64
  1174. BaseRepoID int64
  1175. HeadBranch string
  1176. BaseBranch string
  1177. }
  1178. // IsErrPullRequestAlreadyExists checks if an error is a ErrPullRequestAlreadyExists.
  1179. func IsErrPullRequestAlreadyExists(err error) bool {
  1180. _, ok := err.(ErrPullRequestAlreadyExists)
  1181. return ok
  1182. }
  1183. // Error does pretty-printing :D
  1184. func (err ErrPullRequestAlreadyExists) Error() string {
  1185. return fmt.Sprintf("pull request already exists for these targets [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
  1186. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1187. }
  1188. // ErrPullRequestHeadRepoMissing represents a "ErrPullRequestHeadRepoMissing" error
  1189. type ErrPullRequestHeadRepoMissing struct {
  1190. ID int64
  1191. HeadRepoID int64
  1192. }
  1193. // IsErrErrPullRequestHeadRepoMissing checks if an error is a ErrPullRequestHeadRepoMissing.
  1194. func IsErrErrPullRequestHeadRepoMissing(err error) bool {
  1195. _, ok := err.(ErrPullRequestHeadRepoMissing)
  1196. return ok
  1197. }
  1198. // Error does pretty-printing :D
  1199. func (err ErrPullRequestHeadRepoMissing) Error() string {
  1200. return fmt.Sprintf("pull request head repo missing [id: %d, head_repo_id: %d]",
  1201. err.ID, err.HeadRepoID)
  1202. }
  1203. // ErrInvalidMergeStyle represents an error if merging with disabled merge strategy
  1204. type ErrInvalidMergeStyle struct {
  1205. ID int64
  1206. Style MergeStyle
  1207. }
  1208. // IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.
  1209. func IsErrInvalidMergeStyle(err error) bool {
  1210. _, ok := err.(ErrInvalidMergeStyle)
  1211. return ok
  1212. }
  1213. func (err ErrInvalidMergeStyle) Error() string {
  1214. return fmt.Sprintf("merge strategy is not allowed or is invalid [repo_id: %d, strategy: %s]",
  1215. err.ID, err.Style)
  1216. }
  1217. // ErrMergeConflicts represents an error if merging fails with a conflict
  1218. type ErrMergeConflicts struct {
  1219. Style MergeStyle
  1220. StdOut string
  1221. StdErr string
  1222. Err error
  1223. }
  1224. // IsErrMergeConflicts checks if an error is a ErrMergeConflicts.
  1225. func IsErrMergeConflicts(err error) bool {
  1226. _, ok := err.(ErrMergeConflicts)
  1227. return ok
  1228. }
  1229. func (err ErrMergeConflicts) Error() string {
  1230. return fmt.Sprintf("Merge Conflict Error: %v: %s\n%s", err.Err, err.StdErr, err.StdOut)
  1231. }
  1232. // ErrMergeUnrelatedHistories represents an error if merging fails due to unrelated histories
  1233. type ErrMergeUnrelatedHistories struct {
  1234. Style MergeStyle
  1235. StdOut string
  1236. StdErr string
  1237. Err error
  1238. }
  1239. // IsErrMergeUnrelatedHistories checks if an error is a ErrMergeUnrelatedHistories.
  1240. func IsErrMergeUnrelatedHistories(err error) bool {
  1241. _, ok := err.(ErrMergeUnrelatedHistories)
  1242. return ok
  1243. }
  1244. func (err ErrMergeUnrelatedHistories) Error() string {
  1245. return fmt.Sprintf("Merge UnrelatedHistories Error: %v: %s\n%s", err.Err, err.StdErr, err.StdOut)
  1246. }
  1247. // ErrRebaseConflicts represents an error if rebase fails with a conflict
  1248. type ErrRebaseConflicts struct {
  1249. Style MergeStyle
  1250. CommitSHA string
  1251. StdOut string
  1252. StdErr string
  1253. Err error
  1254. }
  1255. // IsErrRebaseConflicts checks if an error is a ErrRebaseConflicts.
  1256. func IsErrRebaseConflicts(err error) bool {
  1257. _, ok := err.(ErrRebaseConflicts)
  1258. return ok
  1259. }
  1260. func (err ErrRebaseConflicts) Error() string {
  1261. return fmt.Sprintf("Rebase Error: %v: Whilst Rebasing: %s\n%s\n%s", err.Err, err.CommitSHA, err.StdErr, err.StdOut)
  1262. }
  1263. // ErrPullRequestHasMerged represents a "PullRequestHasMerged"-error
  1264. type ErrPullRequestHasMerged struct {
  1265. ID int64
  1266. IssueID int64
  1267. HeadRepoID int64
  1268. BaseRepoID int64
  1269. HeadBranch string
  1270. BaseBranch string
  1271. }
  1272. // IsErrPullRequestHasMerged checks if an error is a ErrPullRequestHasMerged.
  1273. func IsErrPullRequestHasMerged(err error) bool {
  1274. _, ok := err.(ErrPullRequestHasMerged)
  1275. return ok
  1276. }
  1277. // Error does pretty-printing :D
  1278. func (err ErrPullRequestHasMerged) Error() string {
  1279. return fmt.Sprintf("pull request has merged [id: %d, issue_id: %d, head_repo_id: %d, base_repo_id: %d, head_branch: %s, base_branch: %s]",
  1280. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1281. }
  1282. // _________ __
  1283. // \_ ___ \ ____ _____ _____ ____ _____/ |_
  1284. // / \ \/ / _ \ / \ / \_/ __ \ / \ __\
  1285. // \ \___( <_> ) Y Y \ Y Y \ ___/| | \ |
  1286. // \______ /\____/|__|_| /__|_| /\___ >___| /__|
  1287. // \/ \/ \/ \/ \/
  1288. // ErrCommentNotExist represents a "CommentNotExist" kind of error.
  1289. type ErrCommentNotExist struct {
  1290. ID int64
  1291. IssueID int64
  1292. }
  1293. // IsErrCommentNotExist checks if an error is a ErrCommentNotExist.
  1294. func IsErrCommentNotExist(err error) bool {
  1295. _, ok := err.(ErrCommentNotExist)
  1296. return ok
  1297. }
  1298. func (err ErrCommentNotExist) Error() string {
  1299. return fmt.Sprintf("comment does not exist [id: %d, issue_id: %d]", err.ID, err.IssueID)
  1300. }
  1301. // _________ __ __ .__
  1302. // / _____// |_ ____ ________ _ _______ _/ |_ ____ | |__
  1303. // \_____ \\ __\/ _ \\____ \ \/ \/ /\__ \\ __\/ ___\| | \
  1304. // / \| | ( <_> ) |_> > / / __ \| | \ \___| Y \
  1305. // /_______ /|__| \____/| __/ \/\_/ (____ /__| \___ >___| /
  1306. // \/ |__| \/ \/ \/
  1307. // ErrStopwatchNotExist represents a "Stopwatch Not Exist" kind of error.
  1308. type ErrStopwatchNotExist struct {
  1309. ID int64
  1310. }
  1311. // IsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.
  1312. func IsErrStopwatchNotExist(err error) bool {
  1313. _, ok := err.(ErrStopwatchNotExist)
  1314. return ok
  1315. }
  1316. func (err ErrStopwatchNotExist) Error() string {
  1317. return fmt.Sprintf("stopwatch does not exist [id: %d]", err.ID)
  1318. }
  1319. // ___________ __ .______________.__
  1320. // \__ ___/___________ ____ | | __ ____ __| _/\__ ___/|__| _____ ____
  1321. // | | \_ __ \__ \ _/ ___\| |/ // __ \ / __ | | | | |/ \_/ __ \
  1322. // | | | | \// __ \\ \___| <\ ___// /_/ | | | | | Y Y \ ___/
  1323. // |____| |__| (____ /\___ >__|_ \\___ >____ | |____| |__|__|_| /\___ >
  1324. // \/ \/ \/ \/ \/ \/ \/
  1325. // ErrTrackedTimeNotExist represents a "TrackedTime Not Exist" kind of error.
  1326. type ErrTrackedTimeNotExist struct {
  1327. ID int64
  1328. }
  1329. // IsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.
  1330. func IsErrTrackedTimeNotExist(err error) bool {
  1331. _, ok := err.(ErrTrackedTimeNotExist)
  1332. return ok
  1333. }
  1334. func (err ErrTrackedTimeNotExist) Error() string {
  1335. return fmt.Sprintf("tracked time does not exist [id: %d]", err.ID)
  1336. }
  1337. // .____ ___. .__
  1338. // | | _____ \_ |__ ____ | |
  1339. // | | \__ \ | __ \_/ __ \| |
  1340. // | |___ / __ \| \_\ \ ___/| |__
  1341. // |_______ (____ /___ /\___ >____/
  1342. // \/ \/ \/ \/
  1343. // ErrRepoLabelNotExist represents a "RepoLabelNotExist" kind of error.
  1344. type ErrRepoLabelNotExist struct {
  1345. LabelID int64
  1346. RepoID int64
  1347. }
  1348. // IsErrRepoLabelNotExist checks if an error is a RepoErrLabelNotExist.
  1349. func IsErrRepoLabelNotExist(err error) bool {
  1350. _, ok := err.(ErrRepoLabelNotExist)
  1351. return ok
  1352. }
  1353. func (err ErrRepoLabelNotExist) Error() string {
  1354. return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID)
  1355. }
  1356. // ErrOrgLabelNotExist represents a "OrgLabelNotExist" kind of error.
  1357. type ErrOrgLabelNotExist struct {
  1358. LabelID int64
  1359. OrgID int64
  1360. }
  1361. // IsErrOrgLabelNotExist checks if an error is a OrgErrLabelNotExist.
  1362. func IsErrOrgLabelNotExist(err error) bool {
  1363. _, ok := err.(ErrOrgLabelNotExist)
  1364. return ok
  1365. }
  1366. func (err ErrOrgLabelNotExist) Error() string {
  1367. return fmt.Sprintf("label does not exist [label_id: %d, org_id: %d]", err.LabelID, err.OrgID)
  1368. }
  1369. // ErrLabelNotExist represents a "LabelNotExist" kind of error.
  1370. type ErrLabelNotExist struct {
  1371. LabelID int64
  1372. }
  1373. // IsErrLabelNotExist checks if an error is a ErrLabelNotExist.
  1374. func IsErrLabelNotExist(err error) bool {
  1375. _, ok := err.(ErrLabelNotExist)
  1376. return ok
  1377. }
  1378. func (err ErrLabelNotExist) Error() string {
  1379. return fmt.Sprintf("label does not exist [label_id: %d]", err.LabelID)
  1380. }
  1381. // __________ __ __
  1382. // \______ \_______ ____ |__| ____ _____/ |_ ______
  1383. // | ___/\_ __ \/ _ \ | |/ __ \_/ ___\ __\/ ___/
  1384. // | | | | \( <_> ) | \ ___/\ \___| | \___ \
  1385. // |____| |__| \____/\__| |\___ >\___ >__| /____ >
  1386. // \______| \/ \/ \/
  1387. // ErrProjectNotExist represents a "ProjectNotExist" kind of error.
  1388. type ErrProjectNotExist struct {
  1389. ID int64
  1390. RepoID int64
  1391. }
  1392. // IsErrProjectNotExist checks if an error is a ErrProjectNotExist
  1393. func IsErrProjectNotExist(err error) bool {
  1394. _, ok := err.(ErrProjectNotExist)
  1395. return ok
  1396. }
  1397. func (err ErrProjectNotExist) Error() string {
  1398. return fmt.Sprintf("projects does not exist [id: %d]", err.ID)
  1399. }
  1400. // ErrProjectBoardNotExist represents a "ProjectBoardNotExist" kind of error.
  1401. type ErrProjectBoardNotExist struct {
  1402. BoardID int64
  1403. }
  1404. // IsErrProjectBoardNotExist checks if an error is a ErrProjectBoardNotExist
  1405. func IsErrProjectBoardNotExist(err error) bool {
  1406. _, ok := err.(ErrProjectBoardNotExist)
  1407. return ok
  1408. }
  1409. func (err ErrProjectBoardNotExist) Error() string {
  1410. return fmt.Sprintf("project board does not exist [id: %d]", err.BoardID)
  1411. }
  1412. // _____ .__.__ __
  1413. // / \ |__| | ____ _______/ |_ ____ ____ ____
  1414. // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
  1415. // / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
  1416. // \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
  1417. // \/ \/ \/ \/ \/
  1418. // ErrMilestoneNotExist represents a "MilestoneNotExist" kind of error.
  1419. type ErrMilestoneNotExist struct {
  1420. ID int64
  1421. RepoID int64
  1422. Name string
  1423. }
  1424. // IsErrMilestoneNotExist checks if an error is a ErrMilestoneNotExist.
  1425. func IsErrMilestoneNotExist(err error) bool {
  1426. _, ok := err.(ErrMilestoneNotExist)
  1427. return ok
  1428. }
  1429. func (err ErrMilestoneNotExist) Error() string {
  1430. if len(err.Name) > 0 {
  1431. return fmt.Sprintf("milestone does not exist [name: %s, repo_id: %d]", err.Name, err.RepoID)
  1432. }
  1433. return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID)
  1434. }
  1435. // _____ __ __ .__ __
  1436. // / _ \_/ |__/ |______ ____ | |__ _____ ____ _____/ |_
  1437. // / /_\ \ __\ __\__ \ _/ ___\| | \ / \_/ __ \ / \ __\
  1438. // / | \ | | | / __ \\ \___| Y \ Y Y \ ___/| | \ |
  1439. // \____|__ /__| |__| (____ /\___ >___| /__|_| /\___ >___| /__|
  1440. // \/ \/ \/ \/ \/ \/ \/
  1441. // ErrAttachmentNotExist represents a "AttachmentNotExist" kind of error.
  1442. type ErrAttachmentNotExist struct {
  1443. ID int64
  1444. UUID string
  1445. }
  1446. // IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
  1447. func IsErrAttachmentNotExist(err error) bool {
  1448. _, ok := err.(ErrAttachmentNotExist)
  1449. return ok
  1450. }
  1451. func (err ErrAttachmentNotExist) Error() string {
  1452. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1453. }
  1454. // .____ .__ _________
  1455. // | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____
  1456. // | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \
  1457. // | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/
  1458. // |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ >
  1459. // \/ /_____/ \/ \/ \/ \/
  1460. // ErrLoginSourceNotExist represents a "LoginSourceNotExist" kind of error.
  1461. type ErrLoginSourceNotExist struct {
  1462. ID int64
  1463. }
  1464. // IsErrLoginSourceNotExist checks if an error is a ErrLoginSourceNotExist.
  1465. func IsErrLoginSourceNotExist(err error) bool {
  1466. _, ok := err.(ErrLoginSourceNotExist)
  1467. return ok
  1468. }
  1469. func (err ErrLoginSourceNotExist) Error() string {
  1470. return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
  1471. }
  1472. // ErrLoginSourceAlreadyExist represents a "LoginSourceAlreadyExist" kind of error.
  1473. type ErrLoginSourceAlreadyExist struct {
  1474. Name string
  1475. }
  1476. // IsErrLoginSourceAlreadyExist checks if an error is a ErrLoginSourceAlreadyExist.
  1477. func IsErrLoginSourceAlreadyExist(err error) bool {
  1478. _, ok := err.(ErrLoginSourceAlreadyExist)
  1479. return ok
  1480. }
  1481. func (err ErrLoginSourceAlreadyExist) Error() string {
  1482. return fmt.Sprintf("login source already exists [name: %s]", err.Name)
  1483. }
  1484. // ErrLoginSourceInUse represents a "LoginSourceInUse" kind of error.
  1485. type ErrLoginSourceInUse struct {
  1486. ID int64
  1487. }
  1488. // IsErrLoginSourceInUse checks if an error is a ErrLoginSourceInUse.
  1489. func IsErrLoginSourceInUse(err error) bool {
  1490. _, ok := err.(ErrLoginSourceInUse)
  1491. return ok
  1492. }
  1493. func (err ErrLoginSourceInUse) Error() string {
  1494. return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
  1495. }
  1496. // ___________
  1497. // \__ ___/___ _____ _____
  1498. // | |_/ __ \\__ \ / \
  1499. // | |\ ___/ / __ \| Y Y \
  1500. // |____| \___ >____ /__|_| /
  1501. // \/ \/ \/
  1502. // ErrTeamAlreadyExist represents a "TeamAlreadyExist" kind of error.
  1503. type ErrTeamAlreadyExist struct {
  1504. OrgID int64
  1505. Name string
  1506. }
  1507. // IsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.
  1508. func IsErrTeamAlreadyExist(err error) bool {
  1509. _, ok := err.(ErrTeamAlreadyExist)
  1510. return ok
  1511. }
  1512. func (err ErrTeamAlreadyExist) Error() string {
  1513. return fmt.Sprintf("team already exists [org_id: %d, name: %s]", err.OrgID, err.Name)
  1514. }
  1515. // ErrTeamNotExist represents a "TeamNotExist" error
  1516. type ErrTeamNotExist struct {
  1517. OrgID int64
  1518. TeamID int64
  1519. Name string
  1520. }
  1521. // IsErrTeamNotExist checks if an error is a ErrTeamNotExist.
  1522. func IsErrTeamNotExist(err error) bool {
  1523. _, ok := err.(ErrTeamNotExist)
  1524. return ok
  1525. }
  1526. func (err ErrTeamNotExist) Error() string {
  1527. return fmt.Sprintf("team does not exist [org_id %d, team_id %d, name: %s]", err.OrgID, err.TeamID, err.Name)
  1528. }
  1529. //
  1530. // Two-factor authentication
  1531. //
  1532. // ErrTwoFactorNotEnrolled indicates that a user is not enrolled in two-factor authentication.
  1533. type ErrTwoFactorNotEnrolled struct {
  1534. UID int64
  1535. }
  1536. // IsErrTwoFactorNotEnrolled checks if an error is a ErrTwoFactorNotEnrolled.
  1537. func IsErrTwoFactorNotEnrolled(err error) bool {
  1538. _, ok := err.(ErrTwoFactorNotEnrolled)
  1539. return ok
  1540. }
  1541. func (err ErrTwoFactorNotEnrolled) Error() string {
  1542. return fmt.Sprintf("user not enrolled in 2FA [uid: %d]", err.UID)
  1543. }
  1544. // ____ ___ .__ .___
  1545. // | | \______ | | _________ __| _/
  1546. // | | /\____ \| | / _ \__ \ / __ |
  1547. // | | / | |_> > |_( <_> ) __ \_/ /_/ |
  1548. // |______/ | __/|____/\____(____ /\____ |
  1549. // |__| \/ \/
  1550. //
  1551. // ErrUploadNotExist represents a "UploadNotExist" kind of error.
  1552. type ErrUploadNotExist struct {
  1553. ID int64
  1554. UUID string
  1555. }
  1556. // IsErrUploadNotExist checks if an error is a ErrUploadNotExist.
  1557. func IsErrUploadNotExist(err error) bool {
  1558. _, ok := err.(ErrAttachmentNotExist)
  1559. return ok
  1560. }
  1561. func (err ErrUploadNotExist) Error() string {
  1562. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1563. }
  1564. // ___________ __ .__ .____ .__ ____ ___
  1565. // \_ _____/__ ____/ |_ ___________ ____ _____ | | | | ____ ____ |__| ____ | | \______ ___________
  1566. // | __)_\ \/ /\ __\/ __ \_ __ \/ \\__ \ | | | | / _ \ / ___\| |/ \ | | / ___// __ \_ __ \
  1567. // | \> < | | \ ___/| | \/ | \/ __ \| |__ | |__( <_> ) /_/ > | | \ | | /\___ \\ ___/| | \/
  1568. // /_______ /__/\_ \ |__| \___ >__| |___| (____ /____/ |_______ \____/\___ /|__|___| / |______//____ >\___ >__|
  1569. // \/ \/ \/ \/ \/ \/ /_____/ \/ \/ \/
  1570. // ErrExternalLoginUserAlreadyExist represents a "ExternalLoginUserAlreadyExist" kind of error.
  1571. type ErrExternalLoginUserAlreadyExist struct {
  1572. ExternalID string
  1573. UserID int64
  1574. LoginSourceID int64
  1575. }
  1576. // IsErrExternalLoginUserAlreadyExist checks if an error is a ExternalLoginUserAlreadyExist.
  1577. func IsErrExternalLoginUserAlreadyExist(err error) bool {
  1578. _, ok := err.(ErrExternalLoginUserAlreadyExist)
  1579. return ok
  1580. }
  1581. func (err ErrExternalLoginUserAlreadyExist) Error() string {
  1582. return fmt.Sprintf("external login user already exists [externalID: %s, userID: %d, loginSourceID: %d]", err.ExternalID, err.UserID, err.LoginSourceID)
  1583. }
  1584. // ErrExternalLoginUserNotExist represents a "ExternalLoginUserNotExist" kind of error.
  1585. type ErrExternalLoginUserNotExist struct {
  1586. UserID int64
  1587. LoginSourceID int64
  1588. }
  1589. // IsErrExternalLoginUserNotExist checks if an error is a ExternalLoginUserNotExist.
  1590. func IsErrExternalLoginUserNotExist(err error) bool {
  1591. _, ok := err.(ErrExternalLoginUserNotExist)
  1592. return ok
  1593. }
  1594. func (err ErrExternalLoginUserNotExist) Error() string {
  1595. return fmt.Sprintf("external login user link does not exists [userID: %d, loginSourceID: %d]", err.UserID, err.LoginSourceID)
  1596. }
  1597. // ____ ________________________________ .__ __ __ .__
  1598. // | | \_____ \_ _____/\______ \ ____ ____ |__| _______/ |_____________ _/ |_|__| ____ ____
  1599. // | | // ____/| __) | _// __ \ / ___\| |/ ___/\ __\_ __ \__ \\ __\ |/ _ \ / \
  1600. // | | // \| \ | | \ ___// /_/ > |\___ \ | | | | \// __ \| | | ( <_> ) | \
  1601. // |______/ \_______ \___ / |____|_ /\___ >___ /|__/____ > |__| |__| (____ /__| |__|\____/|___| /
  1602. // \/ \/ \/ \/_____/ \/ \/ \/
  1603. // ErrU2FRegistrationNotExist represents a "ErrU2FRegistrationNotExist" kind of error.
  1604. type ErrU2FRegistrationNotExist struct {
  1605. ID int64
  1606. }
  1607. func (err ErrU2FRegistrationNotExist) Error() string {
  1608. return fmt.Sprintf("U2F registration does not exist [id: %d]", err.ID)
  1609. }
  1610. // IsErrU2FRegistrationNotExist checks if an error is a ErrU2FRegistrationNotExist.
  1611. func IsErrU2FRegistrationNotExist(err error) bool {
  1612. _, ok := err.(ErrU2FRegistrationNotExist)
  1613. return ok
  1614. }
  1615. // .___ ________ .___ .__
  1616. // | | ______ ________ __ ____ \______ \ ____ ______ ____ ____ __| _/____ ____ ____ |__| ____ ______
  1617. // | |/ ___// ___/ | \_/ __ \ | | \_/ __ \\____ \_/ __ \ / \ / __ |/ __ \ / \_/ ___\| |/ __ \ / ___/
  1618. // | |\___ \ \___ \| | /\ ___/ | ` \ ___/| |_> > ___/| | \/ /_/ \ ___/| | \ \___| \ ___/ \___ \
  1619. // |___/____ >____ >____/ \___ >_______ /\___ > __/ \___ >___| /\____ |\___ >___| /\___ >__|\___ >____ >
  1620. // \/ \/ \/ \/ \/|__| \/ \/ \/ \/ \/ \/ \/ \/
  1621. // ErrDependencyExists represents a "DependencyAlreadyExists" kind of error.
  1622. type ErrDependencyExists struct {
  1623. IssueID int64
  1624. DependencyID int64
  1625. }
  1626. // IsErrDependencyExists checks if an error is a ErrDependencyExists.
  1627. func IsErrDependencyExists(err error) bool {
  1628. _, ok := err.(ErrDependencyExists)
  1629. return ok
  1630. }
  1631. func (err ErrDependencyExists) Error() string {
  1632. return fmt.Sprintf("issue dependency does already exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1633. }
  1634. // ErrDependencyNotExists represents a "DependencyAlreadyExists" kind of error.
  1635. type ErrDependencyNotExists struct {
  1636. IssueID int64
  1637. DependencyID int64
  1638. }
  1639. // IsErrDependencyNotExists checks if an error is a ErrDependencyExists.
  1640. func IsErrDependencyNotExists(err error) bool {
  1641. _, ok := err.(ErrDependencyNotExists)
  1642. return ok
  1643. }
  1644. func (err ErrDependencyNotExists) Error() string {
  1645. return fmt.Sprintf("issue dependency does not exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1646. }
  1647. // ErrCircularDependency represents a "DependencyCircular" kind of error.
  1648. type ErrCircularDependency struct {
  1649. IssueID int64
  1650. DependencyID int64
  1651. }
  1652. // IsErrCircularDependency checks if an error is a ErrCircularDependency.
  1653. func IsErrCircularDependency(err error) bool {
  1654. _, ok := err.(ErrCircularDependency)
  1655. return ok
  1656. }
  1657. func (err ErrCircularDependency) Error() string {
  1658. return fmt.Sprintf("circular dependencies exists (two issues blocking each other) [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1659. }
  1660. // ErrDependenciesLeft represents an error where the issue you're trying to close still has dependencies left.
  1661. type ErrDependenciesLeft struct {
  1662. IssueID int64
  1663. }
  1664. // IsErrDependenciesLeft checks if an error is a ErrDependenciesLeft.
  1665. func IsErrDependenciesLeft(err error) bool {
  1666. _, ok := err.(ErrDependenciesLeft)
  1667. return ok
  1668. }
  1669. func (err ErrDependenciesLeft) Error() string {
  1670. return fmt.Sprintf("issue has open dependencies [issue id: %d]", err.IssueID)
  1671. }
  1672. // ErrUnknownDependencyType represents an error where an unknown dependency type was passed
  1673. type ErrUnknownDependencyType struct {
  1674. Type DependencyType
  1675. }
  1676. // IsErrUnknownDependencyType checks if an error is ErrUnknownDependencyType
  1677. func IsErrUnknownDependencyType(err error) bool {
  1678. _, ok := err.(ErrUnknownDependencyType)
  1679. return ok
  1680. }
  1681. func (err ErrUnknownDependencyType) Error() string {
  1682. return fmt.Sprintf("unknown dependency type [type: %d]", err.Type)
  1683. }
  1684. // __________ .__
  1685. // \______ \ _______ _|__| ______ _ __
  1686. // | _// __ \ \/ / |/ __ \ \/ \/ /
  1687. // | | \ ___/\ /| \ ___/\ /
  1688. // |____|_ /\___ >\_/ |__|\___ >\/\_/
  1689. // \/ \/ \/
  1690. // ErrReviewNotExist represents a "ReviewNotExist" kind of error.
  1691. type ErrReviewNotExist struct {
  1692. ID int64
  1693. }
  1694. // IsErrReviewNotExist checks if an error is a ErrReviewNotExist.
  1695. func IsErrReviewNotExist(err error) bool {
  1696. _, ok := err.(ErrReviewNotExist)
  1697. return ok
  1698. }
  1699. func (err ErrReviewNotExist) Error() string {
  1700. return fmt.Sprintf("review does not exist [id: %d]", err.ID)
  1701. }
  1702. // ErrNotValidReviewRequest an not allowed review request modify
  1703. type ErrNotValidReviewRequest struct {
  1704. Reason string
  1705. UserID int64
  1706. RepoID int64
  1707. }
  1708. // IsErrNotValidReviewRequest checks if an error is a ErrNotValidReviewRequest.
  1709. func IsErrNotValidReviewRequest(err error) bool {
  1710. _, ok := err.(ErrNotValidReviewRequest)
  1711. return ok
  1712. }
  1713. func (err ErrNotValidReviewRequest) Error() string {
  1714. return fmt.Sprintf("%s [user_id: %d, repo_id: %d]",
  1715. err.Reason,
  1716. err.UserID,
  1717. err.RepoID)
  1718. }
  1719. // ________ _____ __ .__
  1720. // \_____ \ / _ \ __ ___/ |_| |__
  1721. // / | \ / /_\ \| | \ __\ | \
  1722. // / | \/ | \ | /| | | Y \
  1723. // \_______ /\____|__ /____/ |__| |___| /
  1724. // \/ \/ \/
  1725. // ErrOAuthClientIDInvalid will be thrown if client id cannot be found
  1726. type ErrOAuthClientIDInvalid struct {
  1727. ClientID string
  1728. }
  1729. // IsErrOauthClientIDInvalid checks if an error is a ErrReviewNotExist.
  1730. func IsErrOauthClientIDInvalid(err error) bool {
  1731. _, ok := err.(ErrOAuthClientIDInvalid)
  1732. return ok
  1733. }
  1734. // Error returns the error message
  1735. func (err ErrOAuthClientIDInvalid) Error() string {
  1736. return fmt.Sprintf("Client ID invalid [Client ID: %s]", err.ClientID)
  1737. }
  1738. // ErrOAuthApplicationNotFound will be thrown if id cannot be found
  1739. type ErrOAuthApplicationNotFound struct {
  1740. ID int64
  1741. }
  1742. // IsErrOAuthApplicationNotFound checks if an error is a ErrReviewNotExist.
  1743. func IsErrOAuthApplicationNotFound(err error) bool {
  1744. _, ok := err.(ErrOAuthApplicationNotFound)
  1745. return ok
  1746. }
  1747. // Error returns the error message
  1748. func (err ErrOAuthApplicationNotFound) Error() string {
  1749. return fmt.Sprintf("OAuth application not found [ID: %d]", err.ID)
  1750. }