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

error.go 59KB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
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
7 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
7 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
7 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>
4 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>
4 years ago
8 years ago
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>
4 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>
6 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>
4 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>
4 years ago
8 years ago
8 years ago
8 years ago
8 years ago
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
7 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
7 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
7 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
7 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
7 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
7 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)
7 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>
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965
  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. // ErrUserProhibitLogin represents a "ErrUserProhibitLogin" kind of error.
  120. type ErrUserProhibitLogin struct {
  121. UID int64
  122. Name string
  123. }
  124. // IsErrUserProhibitLogin checks if an error is a ErrUserProhibitLogin
  125. func IsErrUserProhibitLogin(err error) bool {
  126. _, ok := err.(ErrUserProhibitLogin)
  127. return ok
  128. }
  129. func (err ErrUserProhibitLogin) Error() string {
  130. return fmt.Sprintf("user is not allowed login [uid: %d, name: %s]", err.UID, err.Name)
  131. }
  132. // ErrUserInactive represents a "ErrUserInactive" kind of error.
  133. type ErrUserInactive struct {
  134. UID int64
  135. Name string
  136. }
  137. // IsErrUserInactive checks if an error is a ErrUserInactive
  138. func IsErrUserInactive(err error) bool {
  139. _, ok := err.(ErrUserInactive)
  140. return ok
  141. }
  142. func (err ErrUserInactive) Error() string {
  143. return fmt.Sprintf("user is inactive [uid: %d, name: %s]", err.UID, err.Name)
  144. }
  145. // ErrEmailAlreadyUsed represents a "EmailAlreadyUsed" kind of error.
  146. type ErrEmailAlreadyUsed struct {
  147. Email string
  148. }
  149. // IsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed.
  150. func IsErrEmailAlreadyUsed(err error) bool {
  151. _, ok := err.(ErrEmailAlreadyUsed)
  152. return ok
  153. }
  154. func (err ErrEmailAlreadyUsed) Error() string {
  155. return fmt.Sprintf("e-mail already in use [email: %s]", err.Email)
  156. }
  157. // ErrOpenIDAlreadyUsed represents a "OpenIDAlreadyUsed" kind of error.
  158. type ErrOpenIDAlreadyUsed struct {
  159. OpenID string
  160. }
  161. // IsErrOpenIDAlreadyUsed checks if an error is a ErrOpenIDAlreadyUsed.
  162. func IsErrOpenIDAlreadyUsed(err error) bool {
  163. _, ok := err.(ErrOpenIDAlreadyUsed)
  164. return ok
  165. }
  166. func (err ErrOpenIDAlreadyUsed) Error() string {
  167. return fmt.Sprintf("OpenID already in use [oid: %s]", err.OpenID)
  168. }
  169. // ErrUserOwnRepos represents a "UserOwnRepos" kind of error.
  170. type ErrUserOwnRepos struct {
  171. UID int64
  172. }
  173. // IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.
  174. func IsErrUserOwnRepos(err error) bool {
  175. _, ok := err.(ErrUserOwnRepos)
  176. return ok
  177. }
  178. func (err ErrUserOwnRepos) Error() string {
  179. return fmt.Sprintf("user still has ownership of repositories [uid: %d]", err.UID)
  180. }
  181. // ErrUserHasOrgs represents a "UserHasOrgs" kind of error.
  182. type ErrUserHasOrgs struct {
  183. UID int64
  184. }
  185. // IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.
  186. func IsErrUserHasOrgs(err error) bool {
  187. _, ok := err.(ErrUserHasOrgs)
  188. return ok
  189. }
  190. func (err ErrUserHasOrgs) Error() string {
  191. return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
  192. }
  193. // ErrUserNotAllowedCreateOrg represents a "UserNotAllowedCreateOrg" kind of error.
  194. type ErrUserNotAllowedCreateOrg struct {
  195. }
  196. // IsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.
  197. func IsErrUserNotAllowedCreateOrg(err error) bool {
  198. _, ok := err.(ErrUserNotAllowedCreateOrg)
  199. return ok
  200. }
  201. func (err ErrUserNotAllowedCreateOrg) Error() string {
  202. return "user is not allowed to create organizations"
  203. }
  204. // ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
  205. type ErrReachLimitOfRepo struct {
  206. Limit int
  207. }
  208. // IsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.
  209. func IsErrReachLimitOfRepo(err error) bool {
  210. _, ok := err.(ErrReachLimitOfRepo)
  211. return ok
  212. }
  213. func (err ErrReachLimitOfRepo) Error() string {
  214. return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
  215. }
  216. // __ __.__ __ .__
  217. // / \ / \__| | _|__|
  218. // \ \/\/ / | |/ / |
  219. // \ /| | <| |
  220. // \__/\ / |__|__|_ \__|
  221. // \/ \/
  222. // ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.
  223. type ErrWikiAlreadyExist struct {
  224. Title string
  225. }
  226. // IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
  227. func IsErrWikiAlreadyExist(err error) bool {
  228. _, ok := err.(ErrWikiAlreadyExist)
  229. return ok
  230. }
  231. func (err ErrWikiAlreadyExist) Error() string {
  232. return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
  233. }
  234. // ErrWikiReservedName represents a reserved name error.
  235. type ErrWikiReservedName struct {
  236. Title string
  237. }
  238. // IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
  239. func IsErrWikiReservedName(err error) bool {
  240. _, ok := err.(ErrWikiReservedName)
  241. return ok
  242. }
  243. func (err ErrWikiReservedName) Error() string {
  244. return fmt.Sprintf("wiki title is reserved: %s", err.Title)
  245. }
  246. // ErrWikiInvalidFileName represents an invalid wiki file name.
  247. type ErrWikiInvalidFileName struct {
  248. FileName string
  249. }
  250. // IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
  251. func IsErrWikiInvalidFileName(err error) bool {
  252. _, ok := err.(ErrWikiInvalidFileName)
  253. return ok
  254. }
  255. func (err ErrWikiInvalidFileName) Error() string {
  256. return fmt.Sprintf("Invalid wiki filename: %s", err.FileName)
  257. }
  258. // __________ ___. .__ .__ ____ __.
  259. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__.
  260. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | |
  261. // | | | | / \_\ \ |_| \ \___ | | \ ___/\___ |
  262. // |____| |____/|___ /____/__|\___ > |____|__ \___ > ____|
  263. // \/ \/ \/ \/\/
  264. // ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error.
  265. type ErrKeyUnableVerify struct {
  266. Result string
  267. }
  268. // IsErrKeyUnableVerify checks if an error is a ErrKeyUnableVerify.
  269. func IsErrKeyUnableVerify(err error) bool {
  270. _, ok := err.(ErrKeyUnableVerify)
  271. return ok
  272. }
  273. func (err ErrKeyUnableVerify) Error() string {
  274. return fmt.Sprintf("Unable to verify key content [result: %s]", err.Result)
  275. }
  276. // ErrKeyNotExist represents a "KeyNotExist" kind of error.
  277. type ErrKeyNotExist struct {
  278. ID int64
  279. }
  280. // IsErrKeyNotExist checks if an error is a ErrKeyNotExist.
  281. func IsErrKeyNotExist(err error) bool {
  282. _, ok := err.(ErrKeyNotExist)
  283. return ok
  284. }
  285. func (err ErrKeyNotExist) Error() string {
  286. return fmt.Sprintf("public key does not exist [id: %d]", err.ID)
  287. }
  288. // ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error.
  289. type ErrKeyAlreadyExist struct {
  290. OwnerID int64
  291. Fingerprint string
  292. Content string
  293. }
  294. // IsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist.
  295. func IsErrKeyAlreadyExist(err error) bool {
  296. _, ok := err.(ErrKeyAlreadyExist)
  297. return ok
  298. }
  299. func (err ErrKeyAlreadyExist) Error() string {
  300. return fmt.Sprintf("public key already exists [owner_id: %d, finger_print: %s, content: %s]",
  301. err.OwnerID, err.Fingerprint, err.Content)
  302. }
  303. // ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error.
  304. type ErrKeyNameAlreadyUsed struct {
  305. OwnerID int64
  306. Name string
  307. }
  308. // IsErrKeyNameAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  309. func IsErrKeyNameAlreadyUsed(err error) bool {
  310. _, ok := err.(ErrKeyNameAlreadyUsed)
  311. return ok
  312. }
  313. func (err ErrKeyNameAlreadyUsed) Error() string {
  314. return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name)
  315. }
  316. // ErrGPGNoEmailFound represents a "ErrGPGNoEmailFound" kind of error.
  317. type ErrGPGNoEmailFound struct {
  318. FailedEmails []string
  319. }
  320. // IsErrGPGNoEmailFound checks if an error is a ErrGPGNoEmailFound.
  321. func IsErrGPGNoEmailFound(err error) bool {
  322. _, ok := err.(ErrGPGNoEmailFound)
  323. return ok
  324. }
  325. func (err ErrGPGNoEmailFound) Error() string {
  326. return fmt.Sprintf("none of the emails attached to the GPG key could be found: %v", err.FailedEmails)
  327. }
  328. // ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error.
  329. type ErrGPGKeyParsing struct {
  330. ParseError error
  331. }
  332. // IsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing.
  333. func IsErrGPGKeyParsing(err error) bool {
  334. _, ok := err.(ErrGPGKeyParsing)
  335. return ok
  336. }
  337. func (err ErrGPGKeyParsing) Error() string {
  338. return fmt.Sprintf("failed to parse gpg key %s", err.ParseError.Error())
  339. }
  340. // ErrGPGKeyNotExist represents a "GPGKeyNotExist" kind of error.
  341. type ErrGPGKeyNotExist struct {
  342. ID int64
  343. }
  344. // IsErrGPGKeyNotExist checks if an error is a ErrGPGKeyNotExist.
  345. func IsErrGPGKeyNotExist(err error) bool {
  346. _, ok := err.(ErrGPGKeyNotExist)
  347. return ok
  348. }
  349. func (err ErrGPGKeyNotExist) Error() string {
  350. return fmt.Sprintf("public gpg key does not exist [id: %d]", err.ID)
  351. }
  352. // ErrGPGKeyImportNotExist represents a "GPGKeyImportNotExist" kind of error.
  353. type ErrGPGKeyImportNotExist struct {
  354. ID string
  355. }
  356. // IsErrGPGKeyImportNotExist checks if an error is a ErrGPGKeyImportNotExist.
  357. func IsErrGPGKeyImportNotExist(err error) bool {
  358. _, ok := err.(ErrGPGKeyImportNotExist)
  359. return ok
  360. }
  361. func (err ErrGPGKeyImportNotExist) Error() string {
  362. return fmt.Sprintf("public gpg key import does not exist [id: %s]", err.ID)
  363. }
  364. // ErrGPGKeyIDAlreadyUsed represents a "GPGKeyIDAlreadyUsed" kind of error.
  365. type ErrGPGKeyIDAlreadyUsed struct {
  366. KeyID string
  367. }
  368. // IsErrGPGKeyIDAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  369. func IsErrGPGKeyIDAlreadyUsed(err error) bool {
  370. _, ok := err.(ErrGPGKeyIDAlreadyUsed)
  371. return ok
  372. }
  373. func (err ErrGPGKeyIDAlreadyUsed) Error() string {
  374. return fmt.Sprintf("public key already exists [key_id: %s]", err.KeyID)
  375. }
  376. // ErrGPGKeyAccessDenied represents a "GPGKeyAccessDenied" kind of Error.
  377. type ErrGPGKeyAccessDenied struct {
  378. UserID int64
  379. KeyID int64
  380. }
  381. // IsErrGPGKeyAccessDenied checks if an error is a ErrGPGKeyAccessDenied.
  382. func IsErrGPGKeyAccessDenied(err error) bool {
  383. _, ok := err.(ErrGPGKeyAccessDenied)
  384. return ok
  385. }
  386. // Error pretty-prints an error of type ErrGPGKeyAccessDenied.
  387. func (err ErrGPGKeyAccessDenied) Error() string {
  388. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d]",
  389. err.UserID, err.KeyID)
  390. }
  391. // ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error.
  392. type ErrKeyAccessDenied struct {
  393. UserID int64
  394. KeyID int64
  395. Note string
  396. }
  397. // IsErrKeyAccessDenied checks if an error is a ErrKeyAccessDenied.
  398. func IsErrKeyAccessDenied(err error) bool {
  399. _, ok := err.(ErrKeyAccessDenied)
  400. return ok
  401. }
  402. func (err ErrKeyAccessDenied) Error() string {
  403. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
  404. err.UserID, err.KeyID, err.Note)
  405. }
  406. // ErrDeployKeyNotExist represents a "DeployKeyNotExist" kind of error.
  407. type ErrDeployKeyNotExist struct {
  408. ID int64
  409. KeyID int64
  410. RepoID int64
  411. }
  412. // IsErrDeployKeyNotExist checks if an error is a ErrDeployKeyNotExist.
  413. func IsErrDeployKeyNotExist(err error) bool {
  414. _, ok := err.(ErrDeployKeyNotExist)
  415. return ok
  416. }
  417. func (err ErrDeployKeyNotExist) Error() string {
  418. return fmt.Sprintf("Deploy key does not exist [id: %d, key_id: %d, repo_id: %d]", err.ID, err.KeyID, err.RepoID)
  419. }
  420. // ErrDeployKeyAlreadyExist represents a "DeployKeyAlreadyExist" kind of error.
  421. type ErrDeployKeyAlreadyExist struct {
  422. KeyID int64
  423. RepoID int64
  424. }
  425. // IsErrDeployKeyAlreadyExist checks if an error is a ErrDeployKeyAlreadyExist.
  426. func IsErrDeployKeyAlreadyExist(err error) bool {
  427. _, ok := err.(ErrDeployKeyAlreadyExist)
  428. return ok
  429. }
  430. func (err ErrDeployKeyAlreadyExist) Error() string {
  431. return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID)
  432. }
  433. // ErrDeployKeyNameAlreadyUsed represents a "DeployKeyNameAlreadyUsed" kind of error.
  434. type ErrDeployKeyNameAlreadyUsed struct {
  435. RepoID int64
  436. Name string
  437. }
  438. // IsErrDeployKeyNameAlreadyUsed checks if an error is a ErrDeployKeyNameAlreadyUsed.
  439. func IsErrDeployKeyNameAlreadyUsed(err error) bool {
  440. _, ok := err.(ErrDeployKeyNameAlreadyUsed)
  441. return ok
  442. }
  443. func (err ErrDeployKeyNameAlreadyUsed) Error() string {
  444. return fmt.Sprintf("public key already exists [repo_id: %d, name: %s]", err.RepoID, err.Name)
  445. }
  446. // _____ ___________ __
  447. // / _ \ ____ ____ ____ ______ _____\__ ___/___ | | __ ____ ____
  448. // / /_\ \_/ ___\/ ___\/ __ \ / ___// ___/ | | / _ \| |/ // __ \ / \
  449. // / | \ \__\ \__\ ___/ \___ \ \___ \ | |( <_> ) <\ ___/| | \
  450. // \____|__ /\___ >___ >___ >____ >____ > |____| \____/|__|_ \\___ >___| /
  451. // \/ \/ \/ \/ \/ \/ \/ \/ \/
  452. // ErrAccessTokenNotExist represents a "AccessTokenNotExist" kind of error.
  453. type ErrAccessTokenNotExist struct {
  454. Token string
  455. }
  456. // IsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.
  457. func IsErrAccessTokenNotExist(err error) bool {
  458. _, ok := err.(ErrAccessTokenNotExist)
  459. return ok
  460. }
  461. func (err ErrAccessTokenNotExist) Error() string {
  462. return fmt.Sprintf("access token does not exist [sha: %s]", err.Token)
  463. }
  464. // ErrAccessTokenEmpty represents a "AccessTokenEmpty" kind of error.
  465. type ErrAccessTokenEmpty struct {
  466. }
  467. // IsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.
  468. func IsErrAccessTokenEmpty(err error) bool {
  469. _, ok := err.(ErrAccessTokenEmpty)
  470. return ok
  471. }
  472. func (err ErrAccessTokenEmpty) Error() string {
  473. return "access token is empty"
  474. }
  475. // ________ .__ __ .__
  476. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  477. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  478. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  479. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  480. // \/ /_____/ \/ \/ \/ \/ \/
  481. // ErrOrgNotExist represents a "OrgNotExist" kind of error.
  482. type ErrOrgNotExist struct {
  483. ID int64
  484. Name string
  485. }
  486. // IsErrOrgNotExist checks if an error is a ErrOrgNotExist.
  487. func IsErrOrgNotExist(err error) bool {
  488. _, ok := err.(ErrOrgNotExist)
  489. return ok
  490. }
  491. func (err ErrOrgNotExist) Error() string {
  492. return fmt.Sprintf("org does not exist [id: %d, name: %s]", err.ID, err.Name)
  493. }
  494. // ErrLastOrgOwner represents a "LastOrgOwner" kind of error.
  495. type ErrLastOrgOwner struct {
  496. UID int64
  497. }
  498. // IsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.
  499. func IsErrLastOrgOwner(err error) bool {
  500. _, ok := err.(ErrLastOrgOwner)
  501. return ok
  502. }
  503. func (err ErrLastOrgOwner) Error() string {
  504. return fmt.Sprintf("user is the last member of owner team [uid: %d]", err.UID)
  505. }
  506. //.____ ____________________
  507. //| | \_ _____/ _____/
  508. //| | | __) \_____ \
  509. //| |___| \ / \
  510. //|_______ \___ / /_______ /
  511. // \/ \/ \/
  512. // ErrLFSLockNotExist represents a "LFSLockNotExist" kind of error.
  513. type ErrLFSLockNotExist struct {
  514. ID int64
  515. RepoID int64
  516. Path string
  517. }
  518. // IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
  519. func IsErrLFSLockNotExist(err error) bool {
  520. _, ok := err.(ErrLFSLockNotExist)
  521. return ok
  522. }
  523. func (err ErrLFSLockNotExist) Error() string {
  524. return fmt.Sprintf("lfs lock does not exist [id: %d, rid: %d, path: %s]", err.ID, err.RepoID, err.Path)
  525. }
  526. // ErrLFSUnauthorizedAction represents a "LFSUnauthorizedAction" kind of error.
  527. type ErrLFSUnauthorizedAction struct {
  528. RepoID int64
  529. UserName string
  530. Mode AccessMode
  531. }
  532. // IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
  533. func IsErrLFSUnauthorizedAction(err error) bool {
  534. _, ok := err.(ErrLFSUnauthorizedAction)
  535. return ok
  536. }
  537. func (err ErrLFSUnauthorizedAction) Error() string {
  538. if err.Mode == AccessModeWrite {
  539. return fmt.Sprintf("User %s doesn't have write access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  540. }
  541. return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  542. }
  543. // ErrLFSLockAlreadyExist represents a "LFSLockAlreadyExist" kind of error.
  544. type ErrLFSLockAlreadyExist struct {
  545. RepoID int64
  546. Path string
  547. }
  548. // IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
  549. func IsErrLFSLockAlreadyExist(err error) bool {
  550. _, ok := err.(ErrLFSLockAlreadyExist)
  551. return ok
  552. }
  553. func (err ErrLFSLockAlreadyExist) Error() string {
  554. return fmt.Sprintf("lfs lock already exists [rid: %d, path: %s]", err.RepoID, err.Path)
  555. }
  556. // ErrLFSFileLocked represents a "LFSFileLocked" kind of error.
  557. type ErrLFSFileLocked struct {
  558. RepoID int64
  559. Path string
  560. UserName string
  561. }
  562. // IsErrLFSFileLocked checks if an error is a ErrLFSFileLocked.
  563. func IsErrLFSFileLocked(err error) bool {
  564. _, ok := err.(ErrLFSFileLocked)
  565. return ok
  566. }
  567. func (err ErrLFSFileLocked) Error() string {
  568. return fmt.Sprintf("File is lfs locked [repo: %d, locked by: %s, path: %s]", err.RepoID, err.UserName, err.Path)
  569. }
  570. // __________ .__ __
  571. // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
  572. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
  573. // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
  574. // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
  575. // \/ \/|__| \/ \/
  576. // ErrRepoNotExist represents a "RepoNotExist" kind of error.
  577. type ErrRepoNotExist struct {
  578. ID int64
  579. UID int64
  580. OwnerName string
  581. Name string
  582. }
  583. // IsErrRepoNotExist checks if an error is a ErrRepoNotExist.
  584. func IsErrRepoNotExist(err error) bool {
  585. _, ok := err.(ErrRepoNotExist)
  586. return ok
  587. }
  588. func (err ErrRepoNotExist) Error() string {
  589. return fmt.Sprintf("repository does not exist [id: %d, uid: %d, owner_name: %s, name: %s]",
  590. err.ID, err.UID, err.OwnerName, err.Name)
  591. }
  592. // ErrRepoAlreadyExist represents a "RepoAlreadyExist" kind of error.
  593. type ErrRepoAlreadyExist struct {
  594. Uname string
  595. Name string
  596. }
  597. // IsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.
  598. func IsErrRepoAlreadyExist(err error) bool {
  599. _, ok := err.(ErrRepoAlreadyExist)
  600. return ok
  601. }
  602. func (err ErrRepoAlreadyExist) Error() string {
  603. return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
  604. }
  605. // ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error.
  606. type ErrForkAlreadyExist struct {
  607. Uname string
  608. RepoName string
  609. ForkName string
  610. }
  611. // IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist.
  612. func IsErrForkAlreadyExist(err error) bool {
  613. _, ok := err.(ErrForkAlreadyExist)
  614. return ok
  615. }
  616. func (err ErrForkAlreadyExist) Error() string {
  617. return fmt.Sprintf("repository is already forked by user [uname: %s, repo path: %s, fork path: %s]", err.Uname, err.RepoName, err.ForkName)
  618. }
  619. // ErrRepoRedirectNotExist represents a "RepoRedirectNotExist" kind of error.
  620. type ErrRepoRedirectNotExist struct {
  621. OwnerID int64
  622. RepoName string
  623. }
  624. // IsErrRepoRedirectNotExist check if an error is an ErrRepoRedirectNotExist.
  625. func IsErrRepoRedirectNotExist(err error) bool {
  626. _, ok := err.(ErrRepoRedirectNotExist)
  627. return ok
  628. }
  629. func (err ErrRepoRedirectNotExist) Error() string {
  630. return fmt.Sprintf("repository redirect does not exist [uid: %d, name: %s]", err.OwnerID, err.RepoName)
  631. }
  632. // ErrInvalidCloneAddr represents a "InvalidCloneAddr" kind of error.
  633. type ErrInvalidCloneAddr struct {
  634. IsURLError bool
  635. IsInvalidPath bool
  636. IsPermissionDenied bool
  637. }
  638. // IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.
  639. func IsErrInvalidCloneAddr(err error) bool {
  640. _, ok := err.(ErrInvalidCloneAddr)
  641. return ok
  642. }
  643. func (err ErrInvalidCloneAddr) Error() string {
  644. return fmt.Sprintf("invalid clone address [is_url_error: %v, is_invalid_path: %v, is_permission_denied: %v]",
  645. err.IsURLError, err.IsInvalidPath, err.IsPermissionDenied)
  646. }
  647. // ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error.
  648. type ErrUpdateTaskNotExist struct {
  649. UUID string
  650. }
  651. // IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.
  652. func IsErrUpdateTaskNotExist(err error) bool {
  653. _, ok := err.(ErrUpdateTaskNotExist)
  654. return ok
  655. }
  656. func (err ErrUpdateTaskNotExist) Error() string {
  657. return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
  658. }
  659. // ErrReleaseAlreadyExist represents a "ReleaseAlreadyExist" kind of error.
  660. type ErrReleaseAlreadyExist struct {
  661. TagName string
  662. }
  663. // IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.
  664. func IsErrReleaseAlreadyExist(err error) bool {
  665. _, ok := err.(ErrReleaseAlreadyExist)
  666. return ok
  667. }
  668. func (err ErrReleaseAlreadyExist) Error() string {
  669. return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
  670. }
  671. // ErrReleaseNotExist represents a "ReleaseNotExist" kind of error.
  672. type ErrReleaseNotExist struct {
  673. ID int64
  674. TagName string
  675. }
  676. // IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.
  677. func IsErrReleaseNotExist(err error) bool {
  678. _, ok := err.(ErrReleaseNotExist)
  679. return ok
  680. }
  681. func (err ErrReleaseNotExist) Error() string {
  682. return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
  683. }
  684. // ErrInvalidTagName represents a "InvalidTagName" kind of error.
  685. type ErrInvalidTagName struct {
  686. TagName string
  687. }
  688. // IsErrInvalidTagName checks if an error is a ErrInvalidTagName.
  689. func IsErrInvalidTagName(err error) bool {
  690. _, ok := err.(ErrInvalidTagName)
  691. return ok
  692. }
  693. func (err ErrInvalidTagName) Error() string {
  694. return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
  695. }
  696. // ErrRepoFileAlreadyExists represents a "RepoFileAlreadyExist" kind of error.
  697. type ErrRepoFileAlreadyExists struct {
  698. Path string
  699. }
  700. // IsErrRepoFileAlreadyExists checks if an error is a ErrRepoFileAlreadyExists.
  701. func IsErrRepoFileAlreadyExists(err error) bool {
  702. _, ok := err.(ErrRepoFileAlreadyExists)
  703. return ok
  704. }
  705. func (err ErrRepoFileAlreadyExists) Error() string {
  706. return fmt.Sprintf("repository file already exists [path: %s]", err.Path)
  707. }
  708. // ErrRepoFileDoesNotExist represents a "RepoFileDoesNotExist" kind of error.
  709. type ErrRepoFileDoesNotExist struct {
  710. Path string
  711. Name string
  712. }
  713. // IsErrRepoFileDoesNotExist checks if an error is a ErrRepoDoesNotExist.
  714. func IsErrRepoFileDoesNotExist(err error) bool {
  715. _, ok := err.(ErrRepoFileDoesNotExist)
  716. return ok
  717. }
  718. func (err ErrRepoFileDoesNotExist) Error() string {
  719. return fmt.Sprintf("repository file does not exist [path: %s]", err.Path)
  720. }
  721. // ErrFilenameInvalid represents a "FilenameInvalid" kind of error.
  722. type ErrFilenameInvalid struct {
  723. Path string
  724. }
  725. // IsErrFilenameInvalid checks if an error is an ErrFilenameInvalid.
  726. func IsErrFilenameInvalid(err error) bool {
  727. _, ok := err.(ErrFilenameInvalid)
  728. return ok
  729. }
  730. func (err ErrFilenameInvalid) Error() string {
  731. return fmt.Sprintf("path contains a malformed path component [path: %s]", err.Path)
  732. }
  733. // ErrUserCannotCommit represents "UserCannotCommit" kind of error.
  734. type ErrUserCannotCommit struct {
  735. UserName string
  736. }
  737. // IsErrUserCannotCommit checks if an error is an ErrUserCannotCommit.
  738. func IsErrUserCannotCommit(err error) bool {
  739. _, ok := err.(ErrUserCannotCommit)
  740. return ok
  741. }
  742. func (err ErrUserCannotCommit) Error() string {
  743. return fmt.Sprintf("user cannot commit to repo [user: %s]", err.UserName)
  744. }
  745. // ErrFilePathInvalid represents a "FilePathInvalid" kind of error.
  746. type ErrFilePathInvalid struct {
  747. Message string
  748. Path string
  749. Name string
  750. Type git.EntryMode
  751. }
  752. // IsErrFilePathInvalid checks if an error is an ErrFilePathInvalid.
  753. func IsErrFilePathInvalid(err error) bool {
  754. _, ok := err.(ErrFilePathInvalid)
  755. return ok
  756. }
  757. func (err ErrFilePathInvalid) Error() string {
  758. if err.Message != "" {
  759. return err.Message
  760. }
  761. return fmt.Sprintf("path is invalid [path: %s]", err.Path)
  762. }
  763. // ErrFilePathProtected represents a "FilePathProtected" kind of error.
  764. type ErrFilePathProtected struct {
  765. Message string
  766. Path string
  767. }
  768. // IsErrFilePathProtected checks if an error is an ErrFilePathProtected.
  769. func IsErrFilePathProtected(err error) bool {
  770. _, ok := err.(ErrFilePathProtected)
  771. return ok
  772. }
  773. func (err ErrFilePathProtected) Error() string {
  774. if err.Message != "" {
  775. return err.Message
  776. }
  777. return fmt.Sprintf("path is protected and can not be changed [path: %s]", err.Path)
  778. }
  779. // ErrUserDoesNotHaveAccessToRepo represets an error where the user doesn't has access to a given repo.
  780. type ErrUserDoesNotHaveAccessToRepo struct {
  781. UserID int64
  782. RepoName string
  783. }
  784. // IsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrRepoFileAlreadyExists.
  785. func IsErrUserDoesNotHaveAccessToRepo(err error) bool {
  786. _, ok := err.(ErrUserDoesNotHaveAccessToRepo)
  787. return ok
  788. }
  789. func (err ErrUserDoesNotHaveAccessToRepo) Error() string {
  790. return fmt.Sprintf("user doesn't have acces to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName)
  791. }
  792. // ErrWontSign explains the first reason why a commit would not be signed
  793. // There may be other reasons - this is just the first reason found
  794. type ErrWontSign struct {
  795. Reason signingMode
  796. }
  797. func (e *ErrWontSign) Error() string {
  798. return fmt.Sprintf("wont sign: %s", e.Reason)
  799. }
  800. // IsErrWontSign checks if an error is a ErrWontSign
  801. func IsErrWontSign(err error) bool {
  802. _, ok := err.(*ErrWontSign)
  803. return ok
  804. }
  805. // __________ .__
  806. // \______ \____________ ____ ____ | |__
  807. // | | _/\_ __ \__ \ / \_/ ___\| | \
  808. // | | \ | | \// __ \| | \ \___| Y \
  809. // |______ / |__| (____ /___| /\___ >___| /
  810. // \/ \/ \/ \/ \/
  811. // ErrBranchAlreadyExists represents an error that branch with such name already exists.
  812. type ErrBranchAlreadyExists struct {
  813. BranchName string
  814. }
  815. // IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.
  816. func IsErrBranchAlreadyExists(err error) bool {
  817. _, ok := err.(ErrBranchAlreadyExists)
  818. return ok
  819. }
  820. func (err ErrBranchAlreadyExists) Error() string {
  821. return fmt.Sprintf("branch already exists [name: %s]", err.BranchName)
  822. }
  823. // ErrBranchNameConflict represents an error that branch name conflicts with other branch.
  824. type ErrBranchNameConflict struct {
  825. BranchName string
  826. }
  827. // IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.
  828. func IsErrBranchNameConflict(err error) bool {
  829. _, ok := err.(ErrBranchNameConflict)
  830. return ok
  831. }
  832. func (err ErrBranchNameConflict) Error() string {
  833. return fmt.Sprintf("branch conflicts with existing branch [name: %s]", err.BranchName)
  834. }
  835. // ErrBranchesEqual represents an error that branch name conflicts with other branch.
  836. type ErrBranchesEqual struct {
  837. BaseBranchName string
  838. HeadBranchName string
  839. }
  840. // IsErrBranchesEqual checks if an error is an ErrBranchesEqual.
  841. func IsErrBranchesEqual(err error) bool {
  842. _, ok := err.(ErrBranchesEqual)
  843. return ok
  844. }
  845. func (err ErrBranchesEqual) Error() string {
  846. return fmt.Sprintf("branches are equal [head: %sm base: %s]", err.HeadBranchName, err.BaseBranchName)
  847. }
  848. // ErrNotAllowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it.
  849. type ErrNotAllowedToMerge struct {
  850. Reason string
  851. }
  852. // IsErrNotAllowedToMerge checks if an error is an ErrNotAllowedToMerge.
  853. func IsErrNotAllowedToMerge(err error) bool {
  854. _, ok := err.(ErrNotAllowedToMerge)
  855. return ok
  856. }
  857. func (err ErrNotAllowedToMerge) Error() string {
  858. return fmt.Sprintf("not allowed to merge [reason: %s]", err.Reason)
  859. }
  860. // ErrTagAlreadyExists represents an error that tag with such name already exists.
  861. type ErrTagAlreadyExists struct {
  862. TagName string
  863. }
  864. // IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.
  865. func IsErrTagAlreadyExists(err error) bool {
  866. _, ok := err.(ErrTagAlreadyExists)
  867. return ok
  868. }
  869. func (err ErrTagAlreadyExists) Error() string {
  870. return fmt.Sprintf("tag already exists [name: %s]", err.TagName)
  871. }
  872. // ErrSHADoesNotMatch represents a "SHADoesNotMatch" kind of error.
  873. type ErrSHADoesNotMatch struct {
  874. Path string
  875. GivenSHA string
  876. CurrentSHA string
  877. }
  878. // IsErrSHADoesNotMatch checks if an error is a ErrSHADoesNotMatch.
  879. func IsErrSHADoesNotMatch(err error) bool {
  880. _, ok := err.(ErrSHADoesNotMatch)
  881. return ok
  882. }
  883. func (err ErrSHADoesNotMatch) Error() string {
  884. return fmt.Sprintf("sha does not match [given: %s, expected: %s]", err.GivenSHA, err.CurrentSHA)
  885. }
  886. // ErrSHANotFound represents a "SHADoesNotMatch" kind of error.
  887. type ErrSHANotFound struct {
  888. SHA string
  889. }
  890. // IsErrSHANotFound checks if an error is a ErrSHANotFound.
  891. func IsErrSHANotFound(err error) bool {
  892. _, ok := err.(ErrSHANotFound)
  893. return ok
  894. }
  895. func (err ErrSHANotFound) Error() string {
  896. return fmt.Sprintf("sha not found [%s]", err.SHA)
  897. }
  898. // ErrCommitIDDoesNotMatch represents a "CommitIDDoesNotMatch" kind of error.
  899. type ErrCommitIDDoesNotMatch struct {
  900. GivenCommitID string
  901. CurrentCommitID string
  902. }
  903. // IsErrCommitIDDoesNotMatch checks if an error is a ErrCommitIDDoesNotMatch.
  904. func IsErrCommitIDDoesNotMatch(err error) bool {
  905. _, ok := err.(ErrCommitIDDoesNotMatch)
  906. return ok
  907. }
  908. func (err ErrCommitIDDoesNotMatch) Error() string {
  909. return fmt.Sprintf("file CommitID does not match [given: %s, expected: %s]", err.GivenCommitID, err.CurrentCommitID)
  910. }
  911. // ErrSHAOrCommitIDNotProvided represents a "SHAOrCommitIDNotProvided" kind of error.
  912. type ErrSHAOrCommitIDNotProvided struct{}
  913. // IsErrSHAOrCommitIDNotProvided checks if an error is a ErrSHAOrCommitIDNotProvided.
  914. func IsErrSHAOrCommitIDNotProvided(err error) bool {
  915. _, ok := err.(ErrSHAOrCommitIDNotProvided)
  916. return ok
  917. }
  918. func (err ErrSHAOrCommitIDNotProvided) Error() string {
  919. return "a SHA or commmit ID must be proved when updating a file"
  920. }
  921. // __ __ ___. .__ __
  922. // / \ / \ ____\_ |__ | |__ ____ ____ | | __
  923. // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
  924. // \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
  925. // \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
  926. // \/ \/ \/ \/ \/
  927. // ErrWebhookNotExist represents a "WebhookNotExist" kind of error.
  928. type ErrWebhookNotExist struct {
  929. ID int64
  930. }
  931. // IsErrWebhookNotExist checks if an error is a ErrWebhookNotExist.
  932. func IsErrWebhookNotExist(err error) bool {
  933. _, ok := err.(ErrWebhookNotExist)
  934. return ok
  935. }
  936. func (err ErrWebhookNotExist) Error() string {
  937. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  938. }
  939. // .___
  940. // | | ______ ________ __ ____
  941. // | |/ ___// ___/ | \_/ __ \
  942. // | |\___ \ \___ \| | /\ ___/
  943. // |___/____ >____ >____/ \___ >
  944. // \/ \/ \/
  945. // ErrIssueNotExist represents a "IssueNotExist" kind of error.
  946. type ErrIssueNotExist struct {
  947. ID int64
  948. RepoID int64
  949. Index int64
  950. }
  951. // IsErrIssueNotExist checks if an error is a ErrIssueNotExist.
  952. func IsErrIssueNotExist(err error) bool {
  953. _, ok := err.(ErrIssueNotExist)
  954. return ok
  955. }
  956. func (err ErrIssueNotExist) Error() string {
  957. return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  958. }
  959. // ErrIssueIsClosed represents a "IssueIsClosed" kind of error.
  960. type ErrIssueIsClosed struct {
  961. ID int64
  962. RepoID int64
  963. Index int64
  964. }
  965. // IsErrIssueIsClosed checks if an error is a ErrIssueNotExist.
  966. func IsErrIssueIsClosed(err error) bool {
  967. _, ok := err.(ErrIssueIsClosed)
  968. return ok
  969. }
  970. func (err ErrIssueIsClosed) Error() string {
  971. return fmt.Sprintf("issue is closed [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  972. }
  973. // ErrIssueLabelTemplateLoad represents a "ErrIssueLabelTemplateLoad" kind of error.
  974. type ErrIssueLabelTemplateLoad struct {
  975. TemplateFile string
  976. OriginalError error
  977. }
  978. // IsErrIssueLabelTemplateLoad checks if an error is a ErrIssueLabelTemplateLoad.
  979. func IsErrIssueLabelTemplateLoad(err error) bool {
  980. _, ok := err.(ErrIssueLabelTemplateLoad)
  981. return ok
  982. }
  983. func (err ErrIssueLabelTemplateLoad) Error() string {
  984. return fmt.Sprintf("Failed to load label template file '%s': %v", err.TemplateFile, err.OriginalError)
  985. }
  986. // ErrNewIssueInsert is used when the INSERT statement in newIssue fails
  987. type ErrNewIssueInsert struct {
  988. OriginalError error
  989. }
  990. // IsErrNewIssueInsert checks if an error is a ErrNewIssueInsert.
  991. func IsErrNewIssueInsert(err error) bool {
  992. _, ok := err.(ErrNewIssueInsert)
  993. return ok
  994. }
  995. func (err ErrNewIssueInsert) Error() string {
  996. return err.OriginalError.Error()
  997. }
  998. // ErrIssueWasClosed is used when close a closed issue
  999. type ErrIssueWasClosed struct {
  1000. ID int64
  1001. Index int64
  1002. }
  1003. // IsErrIssueWasClosed checks if an error is a ErrIssueWasClosed.
  1004. func IsErrIssueWasClosed(err error) bool {
  1005. _, ok := err.(ErrIssueWasClosed)
  1006. return ok
  1007. }
  1008. func (err ErrIssueWasClosed) Error() string {
  1009. return fmt.Sprintf("Issue [%d] %d was already closed", err.ID, err.Index)
  1010. }
  1011. // ErrPullWasClosed is used close a closed pull request
  1012. type ErrPullWasClosed struct {
  1013. ID int64
  1014. Index int64
  1015. }
  1016. // IsErrPullWasClosed checks if an error is a ErrErrPullWasClosed.
  1017. func IsErrPullWasClosed(err error) bool {
  1018. _, ok := err.(ErrPullWasClosed)
  1019. return ok
  1020. }
  1021. func (err ErrPullWasClosed) Error() string {
  1022. return fmt.Sprintf("Pull request [%d] %d was already closed", err.ID, err.Index)
  1023. }
  1024. // ErrForbiddenIssueReaction is used when a forbidden reaction was try to created
  1025. type ErrForbiddenIssueReaction struct {
  1026. Reaction string
  1027. }
  1028. // IsErrForbiddenIssueReaction checks if an error is a ErrForbiddenIssueReaction.
  1029. func IsErrForbiddenIssueReaction(err error) bool {
  1030. _, ok := err.(ErrForbiddenIssueReaction)
  1031. return ok
  1032. }
  1033. func (err ErrForbiddenIssueReaction) Error() string {
  1034. return fmt.Sprintf("'%s' is not an allowed reaction", err.Reaction)
  1035. }
  1036. // ErrReactionAlreadyExist is used when a existing reaction was try to created
  1037. type ErrReactionAlreadyExist struct {
  1038. Reaction string
  1039. }
  1040. // IsErrReactionAlreadyExist checks if an error is a ErrReactionAlreadyExist.
  1041. func IsErrReactionAlreadyExist(err error) bool {
  1042. _, ok := err.(ErrReactionAlreadyExist)
  1043. return ok
  1044. }
  1045. func (err ErrReactionAlreadyExist) Error() string {
  1046. return fmt.Sprintf("reaction '%s' already exists", err.Reaction)
  1047. }
  1048. // __________ .__ .__ __________ __
  1049. // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
  1050. // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
  1051. // | | | | / |_| |_| | \ ___< <_| | | /\ ___/ \___ \ | |
  1052. // |____| |____/|____/____/____|_ /\___ >__ |____/ \___ >____ > |__|
  1053. // \/ \/ |__| \/ \/
  1054. // ErrPullRequestNotExist represents a "PullRequestNotExist" kind of error.
  1055. type ErrPullRequestNotExist struct {
  1056. ID int64
  1057. IssueID int64
  1058. HeadRepoID int64
  1059. BaseRepoID int64
  1060. HeadBranch string
  1061. BaseBranch string
  1062. }
  1063. // IsErrPullRequestNotExist checks if an error is a ErrPullRequestNotExist.
  1064. func IsErrPullRequestNotExist(err error) bool {
  1065. _, ok := err.(ErrPullRequestNotExist)
  1066. return ok
  1067. }
  1068. func (err ErrPullRequestNotExist) Error() string {
  1069. 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]",
  1070. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1071. }
  1072. // ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
  1073. type ErrPullRequestAlreadyExists struct {
  1074. ID int64
  1075. IssueID int64
  1076. HeadRepoID int64
  1077. BaseRepoID int64
  1078. HeadBranch string
  1079. BaseBranch string
  1080. }
  1081. // IsErrPullRequestAlreadyExists checks if an error is a ErrPullRequestAlreadyExists.
  1082. func IsErrPullRequestAlreadyExists(err error) bool {
  1083. _, ok := err.(ErrPullRequestAlreadyExists)
  1084. return ok
  1085. }
  1086. // Error does pretty-printing :D
  1087. func (err ErrPullRequestAlreadyExists) Error() string {
  1088. 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]",
  1089. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1090. }
  1091. // ErrPullRequestHeadRepoMissing represents a "ErrPullRequestHeadRepoMissing" error
  1092. type ErrPullRequestHeadRepoMissing struct {
  1093. ID int64
  1094. HeadRepoID int64
  1095. }
  1096. // IsErrErrPullRequestHeadRepoMissing checks if an error is a ErrPullRequestHeadRepoMissing.
  1097. func IsErrErrPullRequestHeadRepoMissing(err error) bool {
  1098. _, ok := err.(ErrPullRequestHeadRepoMissing)
  1099. return ok
  1100. }
  1101. // Error does pretty-printing :D
  1102. func (err ErrPullRequestHeadRepoMissing) Error() string {
  1103. return fmt.Sprintf("pull request head repo missing [id: %d, head_repo_id: %d]",
  1104. err.ID, err.HeadRepoID)
  1105. }
  1106. // ErrInvalidMergeStyle represents an error if merging with disabled merge strategy
  1107. type ErrInvalidMergeStyle struct {
  1108. ID int64
  1109. Style MergeStyle
  1110. }
  1111. // IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.
  1112. func IsErrInvalidMergeStyle(err error) bool {
  1113. _, ok := err.(ErrInvalidMergeStyle)
  1114. return ok
  1115. }
  1116. func (err ErrInvalidMergeStyle) Error() string {
  1117. return fmt.Sprintf("merge strategy is not allowed or is invalid [repo_id: %d, strategy: %s]",
  1118. err.ID, err.Style)
  1119. }
  1120. // ErrMergeConflicts represents an error if merging fails with a conflict
  1121. type ErrMergeConflicts struct {
  1122. Style MergeStyle
  1123. StdOut string
  1124. StdErr string
  1125. Err error
  1126. }
  1127. // IsErrMergeConflicts checks if an error is a ErrMergeConflicts.
  1128. func IsErrMergeConflicts(err error) bool {
  1129. _, ok := err.(ErrMergeConflicts)
  1130. return ok
  1131. }
  1132. func (err ErrMergeConflicts) Error() string {
  1133. return fmt.Sprintf("Merge Conflict Error: %v: %s\n%s", err.Err, err.StdErr, err.StdOut)
  1134. }
  1135. // ErrMergeUnrelatedHistories represents an error if merging fails due to unrelated histories
  1136. type ErrMergeUnrelatedHistories struct {
  1137. Style MergeStyle
  1138. StdOut string
  1139. StdErr string
  1140. Err error
  1141. }
  1142. // IsErrMergeUnrelatedHistories checks if an error is a ErrMergeUnrelatedHistories.
  1143. func IsErrMergeUnrelatedHistories(err error) bool {
  1144. _, ok := err.(ErrMergeUnrelatedHistories)
  1145. return ok
  1146. }
  1147. func (err ErrMergeUnrelatedHistories) Error() string {
  1148. return fmt.Sprintf("Merge UnrelatedHistories Error: %v: %s\n%s", err.Err, err.StdErr, err.StdOut)
  1149. }
  1150. // ErrRebaseConflicts represents an error if rebase fails with a conflict
  1151. type ErrRebaseConflicts struct {
  1152. Style MergeStyle
  1153. CommitSHA string
  1154. StdOut string
  1155. StdErr string
  1156. Err error
  1157. }
  1158. // IsErrRebaseConflicts checks if an error is a ErrRebaseConflicts.
  1159. func IsErrRebaseConflicts(err error) bool {
  1160. _, ok := err.(ErrRebaseConflicts)
  1161. return ok
  1162. }
  1163. func (err ErrRebaseConflicts) Error() string {
  1164. return fmt.Sprintf("Rebase Error: %v: Whilst Rebasing: %s\n%s\n%s", err.Err, err.CommitSHA, err.StdErr, err.StdOut)
  1165. }
  1166. // ErrPullRequestHasMerged represents a "PullRequestHasMerged"-error
  1167. type ErrPullRequestHasMerged struct {
  1168. ID int64
  1169. IssueID int64
  1170. HeadRepoID int64
  1171. BaseRepoID int64
  1172. HeadBranch string
  1173. BaseBranch string
  1174. }
  1175. // IsErrPullRequestHasMerged checks if an error is a ErrPullRequestHasMerged.
  1176. func IsErrPullRequestHasMerged(err error) bool {
  1177. _, ok := err.(ErrPullRequestHasMerged)
  1178. return ok
  1179. }
  1180. // Error does pretty-printing :D
  1181. func (err ErrPullRequestHasMerged) Error() string {
  1182. 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]",
  1183. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1184. }
  1185. // _________ __
  1186. // \_ ___ \ ____ _____ _____ ____ _____/ |_
  1187. // / \ \/ / _ \ / \ / \_/ __ \ / \ __\
  1188. // \ \___( <_> ) Y Y \ Y Y \ ___/| | \ |
  1189. // \______ /\____/|__|_| /__|_| /\___ >___| /__|
  1190. // \/ \/ \/ \/ \/
  1191. // ErrCommentNotExist represents a "CommentNotExist" kind of error.
  1192. type ErrCommentNotExist struct {
  1193. ID int64
  1194. IssueID int64
  1195. }
  1196. // IsErrCommentNotExist checks if an error is a ErrCommentNotExist.
  1197. func IsErrCommentNotExist(err error) bool {
  1198. _, ok := err.(ErrCommentNotExist)
  1199. return ok
  1200. }
  1201. func (err ErrCommentNotExist) Error() string {
  1202. return fmt.Sprintf("comment does not exist [id: %d, issue_id: %d]", err.ID, err.IssueID)
  1203. }
  1204. // _________ __ __ .__
  1205. // / _____// |_ ____ ________ _ _______ _/ |_ ____ | |__
  1206. // \_____ \\ __\/ _ \\____ \ \/ \/ /\__ \\ __\/ ___\| | \
  1207. // / \| | ( <_> ) |_> > / / __ \| | \ \___| Y \
  1208. // /_______ /|__| \____/| __/ \/\_/ (____ /__| \___ >___| /
  1209. // \/ |__| \/ \/ \/
  1210. // ErrStopwatchNotExist represents a "Stopwatch Not Exist" kind of error.
  1211. type ErrStopwatchNotExist struct {
  1212. ID int64
  1213. }
  1214. // IsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.
  1215. func IsErrStopwatchNotExist(err error) bool {
  1216. _, ok := err.(ErrStopwatchNotExist)
  1217. return ok
  1218. }
  1219. func (err ErrStopwatchNotExist) Error() string {
  1220. return fmt.Sprintf("stopwatch does not exist [id: %d]", err.ID)
  1221. }
  1222. // ___________ __ .______________.__
  1223. // \__ ___/___________ ____ | | __ ____ __| _/\__ ___/|__| _____ ____
  1224. // | | \_ __ \__ \ _/ ___\| |/ // __ \ / __ | | | | |/ \_/ __ \
  1225. // | | | | \// __ \\ \___| <\ ___// /_/ | | | | | Y Y \ ___/
  1226. // |____| |__| (____ /\___ >__|_ \\___ >____ | |____| |__|__|_| /\___ >
  1227. // \/ \/ \/ \/ \/ \/ \/
  1228. // ErrTrackedTimeNotExist represents a "TrackedTime Not Exist" kind of error.
  1229. type ErrTrackedTimeNotExist struct {
  1230. ID int64
  1231. }
  1232. // IsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.
  1233. func IsErrTrackedTimeNotExist(err error) bool {
  1234. _, ok := err.(ErrTrackedTimeNotExist)
  1235. return ok
  1236. }
  1237. func (err ErrTrackedTimeNotExist) Error() string {
  1238. return fmt.Sprintf("tracked time does not exist [id: %d]", err.ID)
  1239. }
  1240. // .____ ___. .__
  1241. // | | _____ \_ |__ ____ | |
  1242. // | | \__ \ | __ \_/ __ \| |
  1243. // | |___ / __ \| \_\ \ ___/| |__
  1244. // |_______ (____ /___ /\___ >____/
  1245. // \/ \/ \/ \/
  1246. // ErrRepoLabelNotExist represents a "RepoLabelNotExist" kind of error.
  1247. type ErrRepoLabelNotExist struct {
  1248. LabelID int64
  1249. RepoID int64
  1250. }
  1251. // IsErrRepoLabelNotExist checks if an error is a RepoErrLabelNotExist.
  1252. func IsErrRepoLabelNotExist(err error) bool {
  1253. _, ok := err.(ErrRepoLabelNotExist)
  1254. return ok
  1255. }
  1256. func (err ErrRepoLabelNotExist) Error() string {
  1257. return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID)
  1258. }
  1259. // ErrOrgLabelNotExist represents a "OrgLabelNotExist" kind of error.
  1260. type ErrOrgLabelNotExist struct {
  1261. LabelID int64
  1262. OrgID int64
  1263. }
  1264. // IsErrOrgLabelNotExist checks if an error is a OrgErrLabelNotExist.
  1265. func IsErrOrgLabelNotExist(err error) bool {
  1266. _, ok := err.(ErrOrgLabelNotExist)
  1267. return ok
  1268. }
  1269. func (err ErrOrgLabelNotExist) Error() string {
  1270. return fmt.Sprintf("label does not exist [label_id: %d, org_id: %d]", err.LabelID, err.OrgID)
  1271. }
  1272. // ErrLabelNotExist represents a "LabelNotExist" kind of error.
  1273. type ErrLabelNotExist struct {
  1274. LabelID int64
  1275. }
  1276. // IsErrLabelNotExist checks if an error is a ErrLabelNotExist.
  1277. func IsErrLabelNotExist(err error) bool {
  1278. _, ok := err.(ErrLabelNotExist)
  1279. return ok
  1280. }
  1281. func (err ErrLabelNotExist) Error() string {
  1282. return fmt.Sprintf("label does not exist [label_id: %d]", err.LabelID)
  1283. }
  1284. // _____ .__.__ __
  1285. // / \ |__| | ____ _______/ |_ ____ ____ ____
  1286. // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
  1287. // / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
  1288. // \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
  1289. // \/ \/ \/ \/ \/
  1290. // ErrMilestoneNotExist represents a "MilestoneNotExist" kind of error.
  1291. type ErrMilestoneNotExist struct {
  1292. ID int64
  1293. RepoID int64
  1294. Name string
  1295. }
  1296. // IsErrMilestoneNotExist checks if an error is a ErrMilestoneNotExist.
  1297. func IsErrMilestoneNotExist(err error) bool {
  1298. _, ok := err.(ErrMilestoneNotExist)
  1299. return ok
  1300. }
  1301. func (err ErrMilestoneNotExist) Error() string {
  1302. if len(err.Name) > 0 {
  1303. return fmt.Sprintf("milestone does not exist [name: %s, repo_id: %d]", err.Name, err.RepoID)
  1304. }
  1305. return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID)
  1306. }
  1307. // _____ __ __ .__ __
  1308. // / _ \_/ |__/ |______ ____ | |__ _____ ____ _____/ |_
  1309. // / /_\ \ __\ __\__ \ _/ ___\| | \ / \_/ __ \ / \ __\
  1310. // / | \ | | | / __ \\ \___| Y \ Y Y \ ___/| | \ |
  1311. // \____|__ /__| |__| (____ /\___ >___| /__|_| /\___ >___| /__|
  1312. // \/ \/ \/ \/ \/ \/ \/
  1313. // ErrAttachmentNotExist represents a "AttachmentNotExist" kind of error.
  1314. type ErrAttachmentNotExist struct {
  1315. ID int64
  1316. UUID string
  1317. }
  1318. // IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
  1319. func IsErrAttachmentNotExist(err error) bool {
  1320. _, ok := err.(ErrAttachmentNotExist)
  1321. return ok
  1322. }
  1323. func (err ErrAttachmentNotExist) Error() string {
  1324. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1325. }
  1326. // .____ .__ _________
  1327. // | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____
  1328. // | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \
  1329. // | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/
  1330. // |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ >
  1331. // \/ /_____/ \/ \/ \/ \/
  1332. // ErrLoginSourceNotExist represents a "LoginSourceNotExist" kind of error.
  1333. type ErrLoginSourceNotExist struct {
  1334. ID int64
  1335. }
  1336. // IsErrLoginSourceNotExist checks if an error is a ErrLoginSourceNotExist.
  1337. func IsErrLoginSourceNotExist(err error) bool {
  1338. _, ok := err.(ErrLoginSourceNotExist)
  1339. return ok
  1340. }
  1341. func (err ErrLoginSourceNotExist) Error() string {
  1342. return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
  1343. }
  1344. // ErrLoginSourceAlreadyExist represents a "LoginSourceAlreadyExist" kind of error.
  1345. type ErrLoginSourceAlreadyExist struct {
  1346. Name string
  1347. }
  1348. // IsErrLoginSourceAlreadyExist checks if an error is a ErrLoginSourceAlreadyExist.
  1349. func IsErrLoginSourceAlreadyExist(err error) bool {
  1350. _, ok := err.(ErrLoginSourceAlreadyExist)
  1351. return ok
  1352. }
  1353. func (err ErrLoginSourceAlreadyExist) Error() string {
  1354. return fmt.Sprintf("login source already exists [name: %s]", err.Name)
  1355. }
  1356. // ErrLoginSourceInUse represents a "LoginSourceInUse" kind of error.
  1357. type ErrLoginSourceInUse struct {
  1358. ID int64
  1359. }
  1360. // IsErrLoginSourceInUse checks if an error is a ErrLoginSourceInUse.
  1361. func IsErrLoginSourceInUse(err error) bool {
  1362. _, ok := err.(ErrLoginSourceInUse)
  1363. return ok
  1364. }
  1365. func (err ErrLoginSourceInUse) Error() string {
  1366. return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
  1367. }
  1368. // ___________
  1369. // \__ ___/___ _____ _____
  1370. // | |_/ __ \\__ \ / \
  1371. // | |\ ___/ / __ \| Y Y \
  1372. // |____| \___ >____ /__|_| /
  1373. // \/ \/ \/
  1374. // ErrTeamAlreadyExist represents a "TeamAlreadyExist" kind of error.
  1375. type ErrTeamAlreadyExist struct {
  1376. OrgID int64
  1377. Name string
  1378. }
  1379. // IsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.
  1380. func IsErrTeamAlreadyExist(err error) bool {
  1381. _, ok := err.(ErrTeamAlreadyExist)
  1382. return ok
  1383. }
  1384. func (err ErrTeamAlreadyExist) Error() string {
  1385. return fmt.Sprintf("team already exists [org_id: %d, name: %s]", err.OrgID, err.Name)
  1386. }
  1387. // ErrTeamNotExist represents a "TeamNotExist" error
  1388. type ErrTeamNotExist struct {
  1389. OrgID int64
  1390. TeamID int64
  1391. Name string
  1392. }
  1393. // IsErrTeamNotExist checks if an error is a ErrTeamNotExist.
  1394. func IsErrTeamNotExist(err error) bool {
  1395. _, ok := err.(ErrTeamNotExist)
  1396. return ok
  1397. }
  1398. func (err ErrTeamNotExist) Error() string {
  1399. return fmt.Sprintf("team does not exist [org_id %d, team_id %d, name: %s]", err.OrgID, err.TeamID, err.Name)
  1400. }
  1401. //
  1402. // Two-factor authentication
  1403. //
  1404. // ErrTwoFactorNotEnrolled indicates that a user is not enrolled in two-factor authentication.
  1405. type ErrTwoFactorNotEnrolled struct {
  1406. UID int64
  1407. }
  1408. // IsErrTwoFactorNotEnrolled checks if an error is a ErrTwoFactorNotEnrolled.
  1409. func IsErrTwoFactorNotEnrolled(err error) bool {
  1410. _, ok := err.(ErrTwoFactorNotEnrolled)
  1411. return ok
  1412. }
  1413. func (err ErrTwoFactorNotEnrolled) Error() string {
  1414. return fmt.Sprintf("user not enrolled in 2FA [uid: %d]", err.UID)
  1415. }
  1416. // ____ ___ .__ .___
  1417. // | | \______ | | _________ __| _/
  1418. // | | /\____ \| | / _ \__ \ / __ |
  1419. // | | / | |_> > |_( <_> ) __ \_/ /_/ |
  1420. // |______/ | __/|____/\____(____ /\____ |
  1421. // |__| \/ \/
  1422. //
  1423. // ErrUploadNotExist represents a "UploadNotExist" kind of error.
  1424. type ErrUploadNotExist struct {
  1425. ID int64
  1426. UUID string
  1427. }
  1428. // IsErrUploadNotExist checks if an error is a ErrUploadNotExist.
  1429. func IsErrUploadNotExist(err error) bool {
  1430. _, ok := err.(ErrAttachmentNotExist)
  1431. return ok
  1432. }
  1433. func (err ErrUploadNotExist) Error() string {
  1434. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1435. }
  1436. // ___________ __ .__ .____ .__ ____ ___
  1437. // \_ _____/__ ____/ |_ ___________ ____ _____ | | | | ____ ____ |__| ____ | | \______ ___________
  1438. // | __)_\ \/ /\ __\/ __ \_ __ \/ \\__ \ | | | | / _ \ / ___\| |/ \ | | / ___// __ \_ __ \
  1439. // | \> < | | \ ___/| | \/ | \/ __ \| |__ | |__( <_> ) /_/ > | | \ | | /\___ \\ ___/| | \/
  1440. // /_______ /__/\_ \ |__| \___ >__| |___| (____ /____/ |_______ \____/\___ /|__|___| / |______//____ >\___ >__|
  1441. // \/ \/ \/ \/ \/ \/ /_____/ \/ \/ \/
  1442. // ErrExternalLoginUserAlreadyExist represents a "ExternalLoginUserAlreadyExist" kind of error.
  1443. type ErrExternalLoginUserAlreadyExist struct {
  1444. ExternalID string
  1445. UserID int64
  1446. LoginSourceID int64
  1447. }
  1448. // IsErrExternalLoginUserAlreadyExist checks if an error is a ExternalLoginUserAlreadyExist.
  1449. func IsErrExternalLoginUserAlreadyExist(err error) bool {
  1450. _, ok := err.(ErrExternalLoginUserAlreadyExist)
  1451. return ok
  1452. }
  1453. func (err ErrExternalLoginUserAlreadyExist) Error() string {
  1454. return fmt.Sprintf("external login user already exists [externalID: %s, userID: %d, loginSourceID: %d]", err.ExternalID, err.UserID, err.LoginSourceID)
  1455. }
  1456. // ErrExternalLoginUserNotExist represents a "ExternalLoginUserNotExist" kind of error.
  1457. type ErrExternalLoginUserNotExist struct {
  1458. UserID int64
  1459. LoginSourceID int64
  1460. }
  1461. // IsErrExternalLoginUserNotExist checks if an error is a ExternalLoginUserNotExist.
  1462. func IsErrExternalLoginUserNotExist(err error) bool {
  1463. _, ok := err.(ErrExternalLoginUserNotExist)
  1464. return ok
  1465. }
  1466. func (err ErrExternalLoginUserNotExist) Error() string {
  1467. return fmt.Sprintf("external login user link does not exists [userID: %d, loginSourceID: %d]", err.UserID, err.LoginSourceID)
  1468. }
  1469. // ____ ________________________________ .__ __ __ .__
  1470. // | | \_____ \_ _____/\______ \ ____ ____ |__| _______/ |_____________ _/ |_|__| ____ ____
  1471. // | | // ____/| __) | _// __ \ / ___\| |/ ___/\ __\_ __ \__ \\ __\ |/ _ \ / \
  1472. // | | // \| \ | | \ ___// /_/ > |\___ \ | | | | \// __ \| | | ( <_> ) | \
  1473. // |______/ \_______ \___ / |____|_ /\___ >___ /|__/____ > |__| |__| (____ /__| |__|\____/|___| /
  1474. // \/ \/ \/ \/_____/ \/ \/ \/
  1475. // ErrU2FRegistrationNotExist represents a "ErrU2FRegistrationNotExist" kind of error.
  1476. type ErrU2FRegistrationNotExist struct {
  1477. ID int64
  1478. }
  1479. func (err ErrU2FRegistrationNotExist) Error() string {
  1480. return fmt.Sprintf("U2F registration does not exist [id: %d]", err.ID)
  1481. }
  1482. // IsErrU2FRegistrationNotExist checks if an error is a ErrU2FRegistrationNotExist.
  1483. func IsErrU2FRegistrationNotExist(err error) bool {
  1484. _, ok := err.(ErrU2FRegistrationNotExist)
  1485. return ok
  1486. }
  1487. // .___ ________ .___ .__
  1488. // | | ______ ________ __ ____ \______ \ ____ ______ ____ ____ __| _/____ ____ ____ |__| ____ ______
  1489. // | |/ ___// ___/ | \_/ __ \ | | \_/ __ \\____ \_/ __ \ / \ / __ |/ __ \ / \_/ ___\| |/ __ \ / ___/
  1490. // | |\___ \ \___ \| | /\ ___/ | ` \ ___/| |_> > ___/| | \/ /_/ \ ___/| | \ \___| \ ___/ \___ \
  1491. // |___/____ >____ >____/ \___ >_______ /\___ > __/ \___ >___| /\____ |\___ >___| /\___ >__|\___ >____ >
  1492. // \/ \/ \/ \/ \/|__| \/ \/ \/ \/ \/ \/ \/ \/
  1493. // ErrDependencyExists represents a "DependencyAlreadyExists" kind of error.
  1494. type ErrDependencyExists struct {
  1495. IssueID int64
  1496. DependencyID int64
  1497. }
  1498. // IsErrDependencyExists checks if an error is a ErrDependencyExists.
  1499. func IsErrDependencyExists(err error) bool {
  1500. _, ok := err.(ErrDependencyExists)
  1501. return ok
  1502. }
  1503. func (err ErrDependencyExists) Error() string {
  1504. return fmt.Sprintf("issue dependency does already exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1505. }
  1506. // ErrDependencyNotExists represents a "DependencyAlreadyExists" kind of error.
  1507. type ErrDependencyNotExists struct {
  1508. IssueID int64
  1509. DependencyID int64
  1510. }
  1511. // IsErrDependencyNotExists checks if an error is a ErrDependencyExists.
  1512. func IsErrDependencyNotExists(err error) bool {
  1513. _, ok := err.(ErrDependencyNotExists)
  1514. return ok
  1515. }
  1516. func (err ErrDependencyNotExists) Error() string {
  1517. return fmt.Sprintf("issue dependency does not exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1518. }
  1519. // ErrCircularDependency represents a "DependencyCircular" kind of error.
  1520. type ErrCircularDependency struct {
  1521. IssueID int64
  1522. DependencyID int64
  1523. }
  1524. // IsErrCircularDependency checks if an error is a ErrCircularDependency.
  1525. func IsErrCircularDependency(err error) bool {
  1526. _, ok := err.(ErrCircularDependency)
  1527. return ok
  1528. }
  1529. func (err ErrCircularDependency) Error() string {
  1530. return fmt.Sprintf("circular dependencies exists (two issues blocking each other) [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1531. }
  1532. // ErrDependenciesLeft represents an error where the issue you're trying to close still has dependencies left.
  1533. type ErrDependenciesLeft struct {
  1534. IssueID int64
  1535. }
  1536. // IsErrDependenciesLeft checks if an error is a ErrDependenciesLeft.
  1537. func IsErrDependenciesLeft(err error) bool {
  1538. _, ok := err.(ErrDependenciesLeft)
  1539. return ok
  1540. }
  1541. func (err ErrDependenciesLeft) Error() string {
  1542. return fmt.Sprintf("issue has open dependencies [issue id: %d]", err.IssueID)
  1543. }
  1544. // ErrUnknownDependencyType represents an error where an unknown dependency type was passed
  1545. type ErrUnknownDependencyType struct {
  1546. Type DependencyType
  1547. }
  1548. // IsErrUnknownDependencyType checks if an error is ErrUnknownDependencyType
  1549. func IsErrUnknownDependencyType(err error) bool {
  1550. _, ok := err.(ErrUnknownDependencyType)
  1551. return ok
  1552. }
  1553. func (err ErrUnknownDependencyType) Error() string {
  1554. return fmt.Sprintf("unknown dependency type [type: %d]", err.Type)
  1555. }
  1556. // __________ .__
  1557. // \______ \ _______ _|__| ______ _ __
  1558. // | _// __ \ \/ / |/ __ \ \/ \/ /
  1559. // | | \ ___/\ /| \ ___/\ /
  1560. // |____|_ /\___ >\_/ |__|\___ >\/\_/
  1561. // \/ \/ \/
  1562. // ErrReviewNotExist represents a "ReviewNotExist" kind of error.
  1563. type ErrReviewNotExist struct {
  1564. ID int64
  1565. }
  1566. // IsErrReviewNotExist checks if an error is a ErrReviewNotExist.
  1567. func IsErrReviewNotExist(err error) bool {
  1568. _, ok := err.(ErrReviewNotExist)
  1569. return ok
  1570. }
  1571. func (err ErrReviewNotExist) Error() string {
  1572. return fmt.Sprintf("review does not exist [id: %d]", err.ID)
  1573. }
  1574. // ________ _____ __ .__
  1575. // \_____ \ / _ \ __ ___/ |_| |__
  1576. // / | \ / /_\ \| | \ __\ | \
  1577. // / | \/ | \ | /| | | Y \
  1578. // \_______ /\____|__ /____/ |__| |___| /
  1579. // \/ \/ \/
  1580. // ErrOAuthClientIDInvalid will be thrown if client id cannot be found
  1581. type ErrOAuthClientIDInvalid struct {
  1582. ClientID string
  1583. }
  1584. // IsErrOauthClientIDInvalid checks if an error is a ErrReviewNotExist.
  1585. func IsErrOauthClientIDInvalid(err error) bool {
  1586. _, ok := err.(ErrOAuthClientIDInvalid)
  1587. return ok
  1588. }
  1589. // Error returns the error message
  1590. func (err ErrOAuthClientIDInvalid) Error() string {
  1591. return fmt.Sprintf("Client ID invalid [Client ID: %s]", err.ClientID)
  1592. }
  1593. // ErrOAuthApplicationNotFound will be thrown if id cannot be found
  1594. type ErrOAuthApplicationNotFound struct {
  1595. ID int64
  1596. }
  1597. // IsErrOAuthApplicationNotFound checks if an error is a ErrReviewNotExist.
  1598. func IsErrOAuthApplicationNotFound(err error) bool {
  1599. _, ok := err.(ErrOAuthApplicationNotFound)
  1600. return ok
  1601. }
  1602. // Error returns the error message
  1603. func (err ErrOAuthApplicationNotFound) Error() string {
  1604. return fmt.Sprintf("OAuth application not found [ID: %d]", err.ID)
  1605. }