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

error.go 60 kB

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