A fork of Gitea (see branch `mj`) adding Majority Judgment Polls 𐄷 over Issues and Merge Requests. https://git.mieuxvoter.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2178 lines
65 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
Adopt repositories (#12920) * Don't automatically delete repository files if they are present Prior to this PR Gitea would delete any repository files if they are present during creation or migration. This can in certain circumstances lead to data-loss and is slightly unpleasant. This PR provides a mechanism for Gitea to adopt repositories on creation and otherwise requires an explicit flag for deletion. PushCreate is slightly different - the create will cause adoption if that is allowed otherwise it will delete the data if that is allowed. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix tests and migrate overwrite Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @lunny Only offer to adopt or overwrite if the user can do that. Allow the site administrator to adopt or overwrite in all circumstances Signed-off-by: Andrew Thornton <art27@cantab.net> * Use setting.Repository.DefaultBranch for the default branch Signed-off-by: Andrew Thornton <art27@cantab.net> * Always set setting.Repository.DefaultBranch Signed-off-by: Andrew Thornton <art27@cantab.net> * update swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * update templates Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure repo closed Signed-off-by: Andrew Thornton <art27@cantab.net> * Rewrite of adoption as per @6543 and @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review * update swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * missing not Signed-off-by: Andrew Thornton <art27@cantab.net> * add modals and flash reporting Signed-off-by: Andrew Thornton <art27@cantab.net> * Make the unadopted page searchable Signed-off-by: Andrew Thornton <art27@cantab.net> * Add API Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * fix swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle empty and non-master branched repositories Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * remove commented out code Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
6 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
6 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
6 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>
3 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>
3 years ago
7 years ago
7 years ago
Change target branch for pull request (#6488) * Adds functionality to change target branch of created pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use const instead of var in JavaScript additions Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check if branches are equal and if PR already exists before changing target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Make sure to check all commits Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Print error messages for user as error flash message Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Disallow changing target branch of closed or merged pull requests Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Resolve conflicts after merge of upstream/master Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Change order of branch select fields Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes duplicate check Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use ctx.Tr for translations Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Recompile JS Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Use correct translation namespace Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove redundant if condition Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves most change branch logic into pull service Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Completes comment Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Add Ref to ChangesPayload for logging changed target branches instead of creating a new struct Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Revert changes to go.mod Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Directly use createComment method Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return 404 if pull request is not found. Move written check up Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Remove variable declaration Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return client errors on change pull request target errors Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Return error in commit.HasPreviousCommit Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds blank line Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Test patch before persisting new target branch Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update patch before testing (not working) Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes patch calls when changeing pull request target Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes unneeded check for base name Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves ChangeTargetBranch completely to pull service. Update patch status. Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Set webhook mode after errors were validated Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Update PR in one transaction Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Move logic for check if head is equal with branch to pull model Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds missing comment and simplify return Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adjust CreateComment method call Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
3 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>
5 years ago
Add Organization Wide Labels (#10814) * Add organization wide labels Implement organization wide labels similar to organization wide webhooks. This lets you create individual labels for organizations that can be used for all repos under that organization (so being able to reuse the same label across multiple repos). This makes it possible for small organizations with many repos to use labels effectively. Fixes #7406 * Add migration * remove comments * fix tests * Update options/locale/locale_en-US.ini Removed unused translation string * show org labels in issue search label filter * Use more clear var name * rename migration after merge from master * comment typo * update migration again after rebase with master * check for orgID <=0 per guillep2k review * fmt * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * remove unused code * Make sure RepoID is 0 when searching orgID per code review * more changes/code review requests * More descriptive translation var per code review * func description/delete comment when issue label deleted instead of hiding it * remove comment * only use issues in that repo when calculating number of open issues for org label on repo label page * Add integration test for IssuesSearch API with labels * remove unused function * Update models/issue_label.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Use subquery in GetLabelIDsInReposByNames * Fix tests to use correct orgID * fix more tests * IssuesSearch api now uses new BuildLabelNamesIssueIDsCondition. Add a few more tests as well * update comment for clarity * Revert previous code change now that we can use the new BuildLabelNamesIssueIDsCondition * Don't sort repos by date in IssuesSearch API After much debugging I've found a strange issue where in some cases MySQL will return a different result than other enigines if a query is sorted by a null collumn. For example with our integration test data where we don't set updated_unix in repository fixtures: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 45 Returns different results for MySQL than other engines. However, the similar query: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 30 Returns the same results. This causes integration tests to fail on MySQL in certain cases but would never show up in a real installation. Since this API call always returns issues based on the optionally provided repo_priority_id or the issueID itself, there is no change to results by changing the repo sorting method used to get ids earlier in the function. * linter is back! * code review * remove now unused option * Fix newline at end of files * more unused code * update to master * check for matching ids before query * Update models/issue_label.go Co-Authored-By: 6543 <6543@obermui.de> * Update models/issue_label.go * update comments * Update routers/org/setting.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
2 years ago
Add Organization Wide Labels (#10814) * Add organization wide labels Implement organization wide labels similar to organization wide webhooks. This lets you create individual labels for organizations that can be used for all repos under that organization (so being able to reuse the same label across multiple repos). This makes it possible for small organizations with many repos to use labels effectively. Fixes #7406 * Add migration * remove comments * fix tests * Update options/locale/locale_en-US.ini Removed unused translation string * show org labels in issue search label filter * Use more clear var name * rename migration after merge from master * comment typo * update migration again after rebase with master * check for orgID <=0 per guillep2k review * fmt * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * remove unused code * Make sure RepoID is 0 when searching orgID per code review * more changes/code review requests * More descriptive translation var per code review * func description/delete comment when issue label deleted instead of hiding it * remove comment * only use issues in that repo when calculating number of open issues for org label on repo label page * Add integration test for IssuesSearch API with labels * remove unused function * Update models/issue_label.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Use subquery in GetLabelIDsInReposByNames * Fix tests to use correct orgID * fix more tests * IssuesSearch api now uses new BuildLabelNamesIssueIDsCondition. Add a few more tests as well * update comment for clarity * Revert previous code change now that we can use the new BuildLabelNamesIssueIDsCondition * Don't sort repos by date in IssuesSearch API After much debugging I've found a strange issue where in some cases MySQL will return a different result than other enigines if a query is sorted by a null collumn. For example with our integration test data where we don't set updated_unix in repository fixtures: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 45 Returns different results for MySQL than other engines. However, the similar query: SELECT `id`, `owner_id`, `owner_name`, `lower_name`, `name`, `description`, `website`, `original_service_type`, `original_url`, `default_branch`, `num_watches`, `num_stars`, `num_forks`, `num_issues`, `num_closed_issues`, `num_pulls`, `num_closed_pulls`, `num_milestones`, `num_closed_milestones`, `is_private`, `is_empty`, `is_archived`, `is_mirror`, `status`, `is_fork`, `fork_id`, `is_template`, `template_id`, `size`, `is_fsck_enabled`, `close_issues_via_commit_in_any_branch`, `topics`, `avatar`, `created_unix`, `updated_unix` FROM `repository` ORDER BY updated_unix DESC LIMIT 15 OFFSET 30 Returns the same results. This causes integration tests to fail on MySQL in certain cases but would never show up in a real installation. Since this API call always returns issues based on the optionally provided repo_priority_id or the issueID itself, there is no change to results by changing the repo sorting method used to get ids earlier in the function. * linter is back! * code review * remove now unused option * Fix newline at end of files * more unused code * update to master * check for matching ids before query * Update models/issue_label.go Co-Authored-By: 6543 <6543@obermui.de> * Update models/issue_label.go * update comments * Update routers/org/setting.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
2 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
6 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
6 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
6 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
6 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
6 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
6 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)
6 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>
4 years ago
feat: Majority Judgment Polls (2020) Add `Poll` model and `CreatePoll` function. The poll is ineffective, no one can vote. (yet) Add `Judgment` creation and update. There can be at most one judgment per trio of poll, judge and candidate. Each Judge may emit one Judgment per Candidate of a Poll. Mop up and oust a reminiscent bug. Add the Poll Create, Update and Delete forms and logic. We can't tally a Poll yet. Nor can we judge issues. Add the Judgment forms for each Poll of each issue. Everything works so far without javascript. We added CSS like monkeys, until we figure out what to do with it. Use emotes Chromium can print as well. Fix some warnings. Prepare for the far future. Add scoring pseudo-code for fast deliberation. This was entertaining, but it's perhaps wrong, although we can't find any reason why so far. We contacted the world's top specialist on the matter. … Three gods, A, B, and C are called, in no particular order, True, False, and Random. True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a completely random matter. Your task is to determine the identities of A, B, and C by asking three yes-no questions; each question must be put to exactly one god. The gods understand English, but will answer all questions in their own language, in which the words for yes and no are da and ja, in some order. You do not know which word means which. Add a naive tallier. I wish I had a feature suite in Gherkin here… Add some tests to the deliberator and implement them. Still waiting for input from the specialist(s) before delving into implementation details. Use unsigned integers where it makes sense. (or not) Provision more tests for the deliberator. We've got some answers — still confused, though. Implement a very naive deliberator. Fix a fix for the label's hover area. Let's barf as little as possible on existing CSS. Fill the missing judgments as REJECT judgments. This should be optional. Add a battery of tests to GetMedian We're now going to be able to implement it properly, not like the cheap cheat we had so far. Adapt label color to median grade. This is a cheap implementation that will probably need a rewrite for complete support of other gradations. Add more tests to expose the limitations of the current scoring implementation. Now we can work some more on the scoring. Implement a less naive score calculus. So far it holds. The score is a bit long (90chars = 15 chars per possible grade) but it won't get any longer with more judges, unless we have to go over 500 billion judges. Fix poll's CRUD subheaders I18N. Make sure judgments can be emitted with keyboard only. `:focus-within` <3 U CSS Add a basic page to view a poll. Move Poll CSS to LESS. Clean up. Tease about what will come next. Add a repo header nav item for polls. Ideally this whole thing should be a plugin and not a fork. Not sure how to add new Db models and Routes. We'd also need a custom spot in the issue view template, but that can probably be merged upstream. Clean up. We'd love to move the routes to their own file. And then being able to add them via `custom/`. Disable event sourcing until /user/events do not hang for a minute, because it makes browsing gitea rapidly impossible. Add french translations for the polling UI. Rename `Judgment` into `PollJudgment`. After careful consideration, it's probably best to namespace. Also, explicit is better than implicit. :) BREAKING CHANGE: Not sure how the migrations will operate here. This is why it's best to do it now than once we're actually using it. Tweak the poll's labels for mobile with a CSS media query. Thanks @pierre-louis for the bug report ! Review. docs: explicit is better than implicit chore: "missing" is more explicit than "lost" feat: add radial merit profiles, in SVG Ignore the gitea-repositories directory. chore: clean up the radial merit profile SVG template test: expose an issue with the tally The returned amounts for each grade are wrong. How could this happen, you ask? Lack of unit-testing, that's why! (also, shallow copy shenanigans) chore: spacing Still experimenting with the spacing in templates. I know Gitea does not use spaces. My sight is not getting any better, and spacing helps a lot. Yes, I'm already using bigger fonts. test: refine the tests about the critical bug found … so that it does not happen again! fix: elbow grease the copy mechanism to fix The Bug® fix: hide the description if none is provided. Should we mention that it is a bad practice ? It feels like it is. … To deliberate. chore: review naive deliberator feat: add the issue title to the list of issues of a poll Also naive and inefficient, but if we paginate, we'll be ok. And if not, we can probably improve this by batching the queries. fix: remove a debugging tweak that was overlooked Also, remove the need to translate the word `Issue`. Oddly enough, it is never translated by itself, it is only in plural form opr inside a sentence. feat: add the merit profile behind the median grade Usual CSS woes - Really not confident about positioning top and left with `em`. - Z-index shenanigans to skip unexpected offset in positioning, where the absolute of a child in a relative container won't point to top left but to bottom of other child in static (try moving the merit profile below the input.emote, and remove z-indices) Right now the merit profile is shown to all logged in, whether they judged or not. This is not the intended final behavior. Ideally we'd have settings fdr this. chore: clean up before the next stage
2 years ago
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package models
  6. import (
  7. "fmt"
  8. "code.gitea.io/gitea/modules/git"
  9. )
  10. // ErrNotExist represents a non-exist error.
  11. type ErrNotExist struct {
  12. ID int64
  13. }
  14. // IsErrNotExist checks if an error is an ErrNotExist
  15. func IsErrNotExist(err error) bool {
  16. _, ok := err.(ErrNotExist)
  17. return ok
  18. }
  19. func (err ErrNotExist) Error() string {
  20. return fmt.Sprintf("record does not exist [id: %d]", err.ID)
  21. }
  22. // ErrNameReserved represents a "reserved name" error.
  23. type ErrNameReserved struct {
  24. Name string
  25. }
  26. // IsErrNameReserved checks if an error is a ErrNameReserved.
  27. func IsErrNameReserved(err error) bool {
  28. _, ok := err.(ErrNameReserved)
  29. return ok
  30. }
  31. func (err ErrNameReserved) Error() string {
  32. return fmt.Sprintf("name is reserved [name: %s]", err.Name)
  33. }
  34. // ErrNamePatternNotAllowed represents a "pattern not allowed" error.
  35. type ErrNamePatternNotAllowed struct {
  36. Pattern string
  37. }
  38. // IsErrNamePatternNotAllowed checks if an error is an ErrNamePatternNotAllowed.
  39. func IsErrNamePatternNotAllowed(err error) bool {
  40. _, ok := err.(ErrNamePatternNotAllowed)
  41. return ok
  42. }
  43. func (err ErrNamePatternNotAllowed) Error() string {
  44. return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern)
  45. }
  46. // ErrNameCharsNotAllowed represents a "character not allowed in name" error.
  47. type ErrNameCharsNotAllowed struct {
  48. Name string
  49. }
  50. // IsErrNameCharsNotAllowed checks if an error is an ErrNameCharsNotAllowed.
  51. func IsErrNameCharsNotAllowed(err error) bool {
  52. _, ok := err.(ErrNameCharsNotAllowed)
  53. return ok
  54. }
  55. func (err ErrNameCharsNotAllowed) Error() string {
  56. return fmt.Sprintf("User name is invalid [%s]: must be valid alpha or numeric or dash(-_) or dot characters", err.Name)
  57. }
  58. // ErrSSHDisabled represents an "SSH disabled" error.
  59. type ErrSSHDisabled struct{}
  60. // IsErrSSHDisabled checks if an error is a ErrSSHDisabled.
  61. func IsErrSSHDisabled(err error) bool {
  62. _, ok := err.(ErrSSHDisabled)
  63. return ok
  64. }
  65. func (err ErrSSHDisabled) Error() string {
  66. return "SSH is disabled"
  67. }
  68. // ErrCancelled represents an error due to context cancellation
  69. type ErrCancelled struct {
  70. Message string
  71. }
  72. // IsErrCancelled checks if an error is a ErrCancelled.
  73. func IsErrCancelled(err error) bool {
  74. _, ok := err.(ErrCancelled)
  75. return ok
  76. }
  77. func (err ErrCancelled) Error() string {
  78. return "Cancelled: " + err.Message
  79. }
  80. // ErrCancelledf returns an ErrCancelled for the provided format and args
  81. func ErrCancelledf(format string, args ...interface{}) error {
  82. return ErrCancelled{
  83. fmt.Sprintf(format, args...),
  84. }
  85. }
  86. // ____ ___
  87. // | | \______ ___________
  88. // | | / ___// __ \_ __ \
  89. // | | /\___ \\ ___/| | \/
  90. // |______//____ >\___ >__|
  91. // \/ \/
  92. // ErrUserAlreadyExist represents a "user already exists" error.
  93. type ErrUserAlreadyExist struct {
  94. Name string
  95. }
  96. // IsErrUserAlreadyExist checks if an error is a ErrUserAlreadyExists.
  97. func IsErrUserAlreadyExist(err error) bool {
  98. _, ok := err.(ErrUserAlreadyExist)
  99. return ok
  100. }
  101. func (err ErrUserAlreadyExist) Error() string {
  102. return fmt.Sprintf("user already exists [name: %s]", err.Name)
  103. }
  104. // ErrUserNotExist represents a "UserNotExist" kind of error.
  105. type ErrUserNotExist struct {
  106. UID int64
  107. Name string
  108. KeyID int64
  109. }
  110. // IsErrUserNotExist checks if an error is a ErrUserNotExist.
  111. func IsErrUserNotExist(err error) bool {
  112. _, ok := err.(ErrUserNotExist)
  113. return ok
  114. }
  115. func (err ErrUserNotExist) Error() string {
  116. return fmt.Sprintf("user does not exist [uid: %d, name: %s, keyid: %d]", err.UID, err.Name, err.KeyID)
  117. }
  118. // ErrUserRedirectNotExist represents a "UserRedirectNotExist" kind of error.
  119. type ErrUserRedirectNotExist struct {
  120. Name string
  121. }
  122. // IsErrUserRedirectNotExist check if an error is an ErrUserRedirectNotExist.
  123. func IsErrUserRedirectNotExist(err error) bool {
  124. _, ok := err.(ErrUserRedirectNotExist)
  125. return ok
  126. }
  127. func (err ErrUserRedirectNotExist) Error() string {
  128. return fmt.Sprintf("user redirect does not exist [name: %s]", err.Name)
  129. }
  130. // ErrUserProhibitLogin represents a "ErrUserProhibitLogin" kind of error.
  131. type ErrUserProhibitLogin struct {
  132. UID int64
  133. Name string
  134. }
  135. // IsErrUserProhibitLogin checks if an error is a ErrUserProhibitLogin
  136. func IsErrUserProhibitLogin(err error) bool {
  137. _, ok := err.(ErrUserProhibitLogin)
  138. return ok
  139. }
  140. func (err ErrUserProhibitLogin) Error() string {
  141. return fmt.Sprintf("user is not allowed login [uid: %d, name: %s]", err.UID, err.Name)
  142. }
  143. // ErrUserInactive represents a "ErrUserInactive" kind of error.
  144. type ErrUserInactive struct {
  145. UID int64
  146. Name string
  147. }
  148. // IsErrUserInactive checks if an error is a ErrUserInactive
  149. func IsErrUserInactive(err error) bool {
  150. _, ok := err.(ErrUserInactive)
  151. return ok
  152. }
  153. func (err ErrUserInactive) Error() string {
  154. return fmt.Sprintf("user is inactive [uid: %d, name: %s]", err.UID, err.Name)
  155. }
  156. // ErrEmailAlreadyUsed represents a "EmailAlreadyUsed" kind of error.
  157. type ErrEmailAlreadyUsed struct {
  158. Email string
  159. }
  160. // IsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed.
  161. func IsErrEmailAlreadyUsed(err error) bool {
  162. _, ok := err.(ErrEmailAlreadyUsed)
  163. return ok
  164. }
  165. func (err ErrEmailAlreadyUsed) Error() string {
  166. return fmt.Sprintf("e-mail already in use [email: %s]", err.Email)
  167. }
  168. // ErrEmailInvalid represents an error where the email address does not comply with RFC 5322
  169. type ErrEmailInvalid struct {
  170. Email string
  171. }
  172. // IsErrEmailInvalid checks if an error is an ErrEmailInvalid
  173. func IsErrEmailInvalid(err error) bool {
  174. _, ok := err.(ErrEmailInvalid)
  175. return ok
  176. }
  177. func (err ErrEmailInvalid) Error() string {
  178. return fmt.Sprintf("e-mail invalid [email: %s]", err.Email)
  179. }
  180. // ErrOpenIDAlreadyUsed represents a "OpenIDAlreadyUsed" kind of error.
  181. type ErrOpenIDAlreadyUsed struct {
  182. OpenID string
  183. }
  184. // IsErrOpenIDAlreadyUsed checks if an error is a ErrOpenIDAlreadyUsed.
  185. func IsErrOpenIDAlreadyUsed(err error) bool {
  186. _, ok := err.(ErrOpenIDAlreadyUsed)
  187. return ok
  188. }
  189. func (err ErrOpenIDAlreadyUsed) Error() string {
  190. return fmt.Sprintf("OpenID already in use [oid: %s]", err.OpenID)
  191. }
  192. // ErrUserOwnRepos represents a "UserOwnRepos" kind of error.
  193. type ErrUserOwnRepos struct {
  194. UID int64
  195. }
  196. // IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.
  197. func IsErrUserOwnRepos(err error) bool {
  198. _, ok := err.(ErrUserOwnRepos)
  199. return ok
  200. }
  201. func (err ErrUserOwnRepos) Error() string {
  202. return fmt.Sprintf("user still has ownership of repositories [uid: %d]", err.UID)
  203. }
  204. // ErrUserHasOrgs represents a "UserHasOrgs" kind of error.
  205. type ErrUserHasOrgs struct {
  206. UID int64
  207. }
  208. // IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.
  209. func IsErrUserHasOrgs(err error) bool {
  210. _, ok := err.(ErrUserHasOrgs)
  211. return ok
  212. }
  213. func (err ErrUserHasOrgs) Error() string {
  214. return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
  215. }
  216. // ErrUserNotAllowedCreateOrg represents a "UserNotAllowedCreateOrg" kind of error.
  217. type ErrUserNotAllowedCreateOrg struct{}
  218. // IsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.
  219. func IsErrUserNotAllowedCreateOrg(err error) bool {
  220. _, ok := err.(ErrUserNotAllowedCreateOrg)
  221. return ok
  222. }
  223. func (err ErrUserNotAllowedCreateOrg) Error() string {
  224. return "user is not allowed to create organizations"
  225. }
  226. // ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
  227. type ErrReachLimitOfRepo struct {
  228. Limit int
  229. }
  230. // IsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.
  231. func IsErrReachLimitOfRepo(err error) bool {
  232. _, ok := err.(ErrReachLimitOfRepo)
  233. return ok
  234. }
  235. func (err ErrReachLimitOfRepo) Error() string {
  236. return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
  237. }
  238. // __ __.__ __ .__
  239. // / \ / \__| | _|__|
  240. // \ \/\/ / | |/ / |
  241. // \ /| | <| |
  242. // \__/\ / |__|__|_ \__|
  243. // \/ \/
  244. // ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.
  245. type ErrWikiAlreadyExist struct {
  246. Title string
  247. }
  248. // IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
  249. func IsErrWikiAlreadyExist(err error) bool {
  250. _, ok := err.(ErrWikiAlreadyExist)
  251. return ok
  252. }
  253. func (err ErrWikiAlreadyExist) Error() string {
  254. return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
  255. }
  256. // ErrWikiReservedName represents a reserved name error.
  257. type ErrWikiReservedName struct {
  258. Title string
  259. }
  260. // IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
  261. func IsErrWikiReservedName(err error) bool {
  262. _, ok := err.(ErrWikiReservedName)
  263. return ok
  264. }
  265. func (err ErrWikiReservedName) Error() string {
  266. return fmt.Sprintf("wiki title is reserved: %s", err.Title)
  267. }
  268. // ErrWikiInvalidFileName represents an invalid wiki file name.
  269. type ErrWikiInvalidFileName struct {
  270. FileName string
  271. }
  272. // IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
  273. func IsErrWikiInvalidFileName(err error) bool {
  274. _, ok := err.(ErrWikiInvalidFileName)
  275. return ok
  276. }
  277. func (err ErrWikiInvalidFileName) Error() string {
  278. return fmt.Sprintf("Invalid wiki filename: %s", err.FileName)
  279. }
  280. // __________ ___. .__ .__ ____ __.
  281. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__.
  282. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | |
  283. // | | | | / \_\ \ |_| \ \___ | | \ ___/\___ |
  284. // |____| |____/|___ /____/__|\___ > |____|__ \___ > ____|
  285. // \/ \/ \/ \/\/
  286. // ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error.
  287. type ErrKeyUnableVerify struct {
  288. Result string
  289. }
  290. // IsErrKeyUnableVerify checks if an error is a ErrKeyUnableVerify.
  291. func IsErrKeyUnableVerify(err error) bool {
  292. _, ok := err.(ErrKeyUnableVerify)
  293. return ok
  294. }
  295. func (err ErrKeyUnableVerify) Error() string {
  296. return fmt.Sprintf("Unable to verify key content [result: %s]", err.Result)
  297. }
  298. // ErrKeyNotExist represents a "KeyNotExist" kind of error.
  299. type ErrKeyNotExist struct {
  300. ID int64
  301. }
  302. // IsErrKeyNotExist checks if an error is a ErrKeyNotExist.
  303. func IsErrKeyNotExist(err error) bool {
  304. _, ok := err.(ErrKeyNotExist)
  305. return ok
  306. }
  307. func (err ErrKeyNotExist) Error() string {
  308. return fmt.Sprintf("public key does not exist [id: %d]", err.ID)
  309. }
  310. // ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error.
  311. type ErrKeyAlreadyExist struct {
  312. OwnerID int64
  313. Fingerprint string
  314. Content string
  315. }
  316. // IsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist.
  317. func IsErrKeyAlreadyExist(err error) bool {
  318. _, ok := err.(ErrKeyAlreadyExist)
  319. return ok
  320. }
  321. func (err ErrKeyAlreadyExist) Error() string {
  322. return fmt.Sprintf("public key already exists [owner_id: %d, finger_print: %s, content: %s]",
  323. err.OwnerID, err.Fingerprint, err.Content)
  324. }
  325. // ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error.
  326. type ErrKeyNameAlreadyUsed struct {
  327. OwnerID int64
  328. Name string
  329. }
  330. // IsErrKeyNameAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  331. func IsErrKeyNameAlreadyUsed(err error) bool {
  332. _, ok := err.(ErrKeyNameAlreadyUsed)
  333. return ok
  334. }
  335. func (err ErrKeyNameAlreadyUsed) Error() string {
  336. return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name)
  337. }
  338. // ErrGPGNoEmailFound represents a "ErrGPGNoEmailFound" kind of error.
  339. type ErrGPGNoEmailFound struct {
  340. FailedEmails []string
  341. }
  342. // IsErrGPGNoEmailFound checks if an error is a ErrGPGNoEmailFound.
  343. func IsErrGPGNoEmailFound(err error) bool {
  344. _, ok := err.(ErrGPGNoEmailFound)
  345. return ok
  346. }
  347. func (err ErrGPGNoEmailFound) Error() string {
  348. return fmt.Sprintf("none of the emails attached to the GPG key could be found: %v", err.FailedEmails)
  349. }
  350. // ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error.
  351. type ErrGPGKeyParsing struct {
  352. ParseError error
  353. }
  354. // IsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing.
  355. func IsErrGPGKeyParsing(err error) bool {
  356. _, ok := err.(ErrGPGKeyParsing)
  357. return ok
  358. }
  359. func (err ErrGPGKeyParsing) Error() string {
  360. return fmt.Sprintf("failed to parse gpg key %s", err.ParseError.Error())
  361. }
  362. // ErrGPGKeyNotExist represents a "GPGKeyNotExist" kind of error.
  363. type ErrGPGKeyNotExist struct {
  364. ID int64
  365. }
  366. // IsErrGPGKeyNotExist checks if an error is a ErrGPGKeyNotExist.
  367. func IsErrGPGKeyNotExist(err error) bool {
  368. _, ok := err.(ErrGPGKeyNotExist)
  369. return ok
  370. }
  371. func (err ErrGPGKeyNotExist) Error() string {
  372. return fmt.Sprintf("public gpg key does not exist [id: %d]", err.ID)
  373. }
  374. // ErrGPGKeyImportNotExist represents a "GPGKeyImportNotExist" kind of error.
  375. type ErrGPGKeyImportNotExist struct {
  376. ID string
  377. }
  378. // IsErrGPGKeyImportNotExist checks if an error is a ErrGPGKeyImportNotExist.
  379. func IsErrGPGKeyImportNotExist(err error) bool {
  380. _, ok := err.(ErrGPGKeyImportNotExist)
  381. return ok
  382. }
  383. func (err ErrGPGKeyImportNotExist) Error() string {
  384. return fmt.Sprintf("public gpg key import does not exist [id: %s]", err.ID)
  385. }
  386. // ErrGPGKeyIDAlreadyUsed represents a "GPGKeyIDAlreadyUsed" kind of error.
  387. type ErrGPGKeyIDAlreadyUsed struct {
  388. KeyID string
  389. }
  390. // IsErrGPGKeyIDAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  391. func IsErrGPGKeyIDAlreadyUsed(err error) bool {
  392. _, ok := err.(ErrGPGKeyIDAlreadyUsed)
  393. return ok
  394. }
  395. func (err ErrGPGKeyIDAlreadyUsed) Error() string {
  396. return fmt.Sprintf("public key already exists [key_id: %s]", err.KeyID)
  397. }
  398. // ErrGPGKeyAccessDenied represents a "GPGKeyAccessDenied" kind of Error.
  399. type ErrGPGKeyAccessDenied struct {
  400. UserID int64
  401. KeyID int64
  402. }
  403. // IsErrGPGKeyAccessDenied checks if an error is a ErrGPGKeyAccessDenied.
  404. func IsErrGPGKeyAccessDenied(err error) bool {
  405. _, ok := err.(ErrGPGKeyAccessDenied)
  406. return ok
  407. }
  408. // Error pretty-prints an error of type ErrGPGKeyAccessDenied.
  409. func (err ErrGPGKeyAccessDenied) Error() string {
  410. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d]",
  411. err.UserID, err.KeyID)
  412. }
  413. // ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error.
  414. type ErrKeyAccessDenied struct {
  415. UserID int64
  416. KeyID int64
  417. Note string
  418. }
  419. // IsErrKeyAccessDenied checks if an error is a ErrKeyAccessDenied.
  420. func IsErrKeyAccessDenied(err error) bool {
  421. _, ok := err.(ErrKeyAccessDenied)
  422. return ok
  423. }
  424. func (err ErrKeyAccessDenied) Error() string {
  425. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
  426. err.UserID, err.KeyID, err.Note)
  427. }
  428. // ErrDeployKeyNotExist represents a "DeployKeyNotExist" kind of error.
  429. type ErrDeployKeyNotExist struct {
  430. ID int64
  431. KeyID int64
  432. RepoID int64
  433. }
  434. // IsErrDeployKeyNotExist checks if an error is a ErrDeployKeyNotExist.
  435. func IsErrDeployKeyNotExist(err error) bool {
  436. _, ok := err.(ErrDeployKeyNotExist)
  437. return ok
  438. }
  439. func (err ErrDeployKeyNotExist) Error() string {
  440. return fmt.Sprintf("Deploy key does not exist [id: %d, key_id: %d, repo_id: %d]", err.ID, err.KeyID, err.RepoID)
  441. }
  442. // ErrDeployKeyAlreadyExist represents a "DeployKeyAlreadyExist" kind of error.
  443. type ErrDeployKeyAlreadyExist struct {
  444. KeyID int64
  445. RepoID int64
  446. }
  447. // IsErrDeployKeyAlreadyExist checks if an error is a ErrDeployKeyAlreadyExist.
  448. func IsErrDeployKeyAlreadyExist(err error) bool {
  449. _, ok := err.(ErrDeployKeyAlreadyExist)
  450. return ok
  451. }
  452. func (err ErrDeployKeyAlreadyExist) Error() string {
  453. return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID)
  454. }
  455. // ErrDeployKeyNameAlreadyUsed represents a "DeployKeyNameAlreadyUsed" kind of error.
  456. type ErrDeployKeyNameAlreadyUsed struct {
  457. RepoID int64
  458. Name string
  459. }
  460. // IsErrDeployKeyNameAlreadyUsed checks if an error is a ErrDeployKeyNameAlreadyUsed.
  461. func IsErrDeployKeyNameAlreadyUsed(err error) bool {
  462. _, ok := err.(ErrDeployKeyNameAlreadyUsed)
  463. return ok
  464. }
  465. func (err ErrDeployKeyNameAlreadyUsed) Error() string {
  466. return fmt.Sprintf("public key with name already exists [repo_id: %d, name: %s]", err.RepoID, err.Name)
  467. }
  468. // _____ ___________ __
  469. // / _ \ ____ ____ ____ ______ _____\__ ___/___ | | __ ____ ____
  470. // / /_\ \_/ ___\/ ___\/ __ \ / ___// ___/ | | / _ \| |/ // __ \ / \
  471. // / | \ \__\ \__\ ___/ \___ \ \___ \ | |( <_> ) <\ ___/| | \
  472. // \____|__ /\___ >___ >___ >____ >____ > |____| \____/|__|_ \\___ >___| /
  473. // \/ \/ \/ \/ \/ \/ \/ \/ \/
  474. // ErrAccessTokenNotExist represents a "AccessTokenNotExist" kind of error.
  475. type ErrAccessTokenNotExist struct {
  476. Token string
  477. }
  478. // IsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.
  479. func IsErrAccessTokenNotExist(err error) bool {
  480. _, ok := err.(ErrAccessTokenNotExist)
  481. return ok
  482. }
  483. func (err ErrAccessTokenNotExist) Error() string {
  484. return fmt.Sprintf("access token does not exist [sha: %s]", err.Token)
  485. }
  486. // ErrAccessTokenEmpty represents a "AccessTokenEmpty" kind of error.
  487. type ErrAccessTokenEmpty struct{}
  488. // IsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.
  489. func IsErrAccessTokenEmpty(err error) bool {
  490. _, ok := err.(ErrAccessTokenEmpty)
  491. return ok
  492. }
  493. func (err ErrAccessTokenEmpty) Error() string {
  494. return "access token is empty"
  495. }
  496. // ________ .__ __ .__
  497. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  498. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  499. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  500. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  501. // \/ /_____/ \/ \/ \/ \/ \/
  502. // ErrOrgNotExist represents a "OrgNotExist" kind of error.
  503. type ErrOrgNotExist struct {
  504. ID int64
  505. Name string
  506. }
  507. // IsErrOrgNotExist checks if an error is a ErrOrgNotExist.
  508. func IsErrOrgNotExist(err error) bool {
  509. _, ok := err.(ErrOrgNotExist)
  510. return ok
  511. }
  512. func (err ErrOrgNotExist) Error() string {
  513. return fmt.Sprintf("org does not exist [id: %d, name: %s]", err.ID, err.Name)
  514. }
  515. // ErrLastOrgOwner represents a "LastOrgOwner" kind of error.
  516. type ErrLastOrgOwner struct {
  517. UID int64
  518. }
  519. // IsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.
  520. func IsErrLastOrgOwner(err error) bool {
  521. _, ok := err.(ErrLastOrgOwner)
  522. return ok
  523. }
  524. func (err ErrLastOrgOwner) Error() string {
  525. return fmt.Sprintf("user is the last member of owner team [uid: %d]", err.UID)
  526. }
  527. //.____ ____________________
  528. //| | \_ _____/ _____/
  529. //| | | __) \_____ \
  530. //| |___| \ / \
  531. //|_______ \___ / /_______ /
  532. // \/ \/ \/
  533. // ErrLFSLockNotExist represents a "LFSLockNotExist" kind of error.
  534. type ErrLFSLockNotExist struct {
  535. ID int64
  536. RepoID int64
  537. Path string
  538. }
  539. // IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
  540. func IsErrLFSLockNotExist(err error) bool {
  541. _, ok := err.(ErrLFSLockNotExist)
  542. return ok
  543. }
  544. func (err ErrLFSLockNotExist) Error() string {
  545. return fmt.Sprintf("lfs lock does not exist [id: %d, rid: %d, path: %s]", err.ID, err.RepoID, err.Path)
  546. }
  547. // ErrLFSUnauthorizedAction represents a "LFSUnauthorizedAction" kind of error.
  548. type ErrLFSUnauthorizedAction struct {
  549. RepoID int64
  550. UserName string
  551. Mode AccessMode
  552. }
  553. // IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
  554. func IsErrLFSUnauthorizedAction(err error) bool {
  555. _, ok := err.(ErrLFSUnauthorizedAction)
  556. return ok
  557. }
  558. func (err ErrLFSUnauthorizedAction) Error() string {
  559. if err.Mode == AccessModeWrite {
  560. return fmt.Sprintf("User %s doesn't have write access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  561. }
  562. return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  563. }
  564. // ErrLFSLockAlreadyExist represents a "LFSLockAlreadyExist" kind of error.
  565. type ErrLFSLockAlreadyExist struct {
  566. RepoID int64
  567. Path string
  568. }
  569. // IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
  570. func IsErrLFSLockAlreadyExist(err error) bool {
  571. _, ok := err.(ErrLFSLockAlreadyExist)
  572. return ok
  573. }
  574. func (err ErrLFSLockAlreadyExist) Error() string {
  575. return fmt.Sprintf("lfs lock already exists [rid: %d, path: %s]", err.RepoID, err.Path)
  576. }
  577. // ErrLFSFileLocked represents a "LFSFileLocked" kind of error.
  578. type ErrLFSFileLocked struct {
  579. RepoID int64
  580. Path string
  581. UserName string
  582. }
  583. // IsErrLFSFileLocked checks if an error is a ErrLFSFileLocked.
  584. func IsErrLFSFileLocked(err error) bool {
  585. _, ok := err.(ErrLFSFileLocked)
  586. return ok
  587. }
  588. func (err ErrLFSFileLocked) Error() string {
  589. return fmt.Sprintf("File is lfs locked [repo: %d, locked by: %s, path: %s]", err.RepoID, err.UserName, err.Path)
  590. }
  591. // __________ .__ __
  592. // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
  593. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
  594. // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
  595. // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
  596. // \/ \/|__| \/ \/
  597. // ErrRepoNotExist represents a "RepoNotExist" kind of error.
  598. type ErrRepoNotExist struct {
  599. ID int64
  600. UID int64
  601. OwnerName string
  602. Name string
  603. }
  604. // IsErrRepoNotExist checks if an error is a ErrRepoNotExist.
  605. func IsErrRepoNotExist(err error) bool {
  606. _, ok := err.(ErrRepoNotExist)
  607. return ok
  608. }
  609. func (err ErrRepoNotExist) Error() string {
  610. return fmt.Sprintf("repository does not exist [id: %d, uid: %d, owner_name: %s, name: %s]",
  611. err.ID, err.UID, err.OwnerName, err.Name)
  612. }
  613. // ErrNoPendingRepoTransfer is an error type for repositories without a pending
  614. // transfer request
  615. type ErrNoPendingRepoTransfer struct {
  616. RepoID int64
  617. }
  618. func (e ErrNoPendingRepoTransfer) Error() string {
  619. return fmt.Sprintf("repository doesn't have a pending transfer [repo_id: %d]", e.RepoID)
  620. }
  621. // IsErrNoPendingTransfer is an error type when a repository has no pending
  622. // transfers
  623. func IsErrNoPendingTransfer(err error) bool {
  624. _, ok := err.(ErrNoPendingRepoTransfer)
  625. return ok
  626. }
  627. // ErrRepoTransferInProgress represents the state of a repository that has an
  628. // ongoing transfer
  629. type ErrRepoTransferInProgress struct {
  630. Uname string
  631. Name string
  632. }
  633. // IsErrRepoTransferInProgress checks if an error is a ErrRepoTransferInProgress.
  634. func IsErrRepoTransferInProgress(err error) bool {
  635. _, ok := err.(ErrRepoTransferInProgress)
  636. return ok
  637. }
  638. func (err ErrRepoTransferInProgress) Error() string {
  639. return fmt.Sprintf("repository is already being transferred [uname: %s, name: %s]", err.Uname, err.Name)
  640. }
  641. // ErrRepoAlreadyExist represents a "RepoAlreadyExist" kind of error.
  642. type ErrRepoAlreadyExist struct {
  643. Uname string
  644. Name string
  645. }
  646. // IsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.
  647. func IsErrRepoAlreadyExist(err error) bool {
  648. _, ok := err.(ErrRepoAlreadyExist)
  649. return ok
  650. }
  651. func (err ErrRepoAlreadyExist) Error() string {
  652. return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
  653. }
  654. // ErrRepoFilesAlreadyExist represents a "RepoFilesAlreadyExist" kind of error.
  655. type ErrRepoFilesAlreadyExist struct {
  656. Uname string
  657. Name string
  658. }
  659. // IsErrRepoFilesAlreadyExist checks if an error is a ErrRepoAlreadyExist.
  660. func IsErrRepoFilesAlreadyExist(err error) bool {
  661. _, ok := err.(ErrRepoFilesAlreadyExist)
  662. return ok
  663. }
  664. func (err ErrRepoFilesAlreadyExist) Error() string {
  665. return fmt.Sprintf("repository files already exist [uname: %s, name: %s]", err.Uname, err.Name)
  666. }
  667. // ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error.
  668. type ErrForkAlreadyExist struct {
  669. Uname string
  670. RepoName string
  671. ForkName string
  672. }
  673. // IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist.
  674. func IsErrForkAlreadyExist(err error) bool {
  675. _, ok := err.(ErrForkAlreadyExist)
  676. return ok
  677. }
  678. func (err ErrForkAlreadyExist) Error() string {
  679. return fmt.Sprintf("repository is already forked by user [uname: %s, repo path: %s, fork path: %s]", err.Uname, err.RepoName, err.ForkName)
  680. }
  681. // ErrRepoRedirectNotExist represents a "RepoRedirectNotExist" kind of error.
  682. type ErrRepoRedirectNotExist struct {
  683. OwnerID int64
  684. RepoName string
  685. }
  686. // IsErrRepoRedirectNotExist check if an error is an ErrRepoRedirectNotExist.
  687. func IsErrRepoRedirectNotExist(err error) bool {
  688. _, ok := err.(ErrRepoRedirectNotExist)
  689. return ok
  690. }
  691. func (err ErrRepoRedirectNotExist) Error() string {
  692. return fmt.Sprintf("repository redirect does not exist [uid: %d, name: %s]", err.OwnerID, err.RepoName)
  693. }
  694. // ErrInvalidCloneAddr represents a "InvalidCloneAddr" kind of error.
  695. type ErrInvalidCloneAddr struct {
  696. Host string
  697. IsURLError bool
  698. IsInvalidPath bool
  699. IsProtocolInvalid bool
  700. IsPermissionDenied bool
  701. LocalPath bool
  702. NotResolvedIP bool
  703. PrivateNet string
  704. }
  705. // IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.
  706. func IsErrInvalidCloneAddr(err error) bool {
  707. _, ok := err.(*ErrInvalidCloneAddr)
  708. return ok
  709. }
  710. func (err *ErrInvalidCloneAddr) Error() string {
  711. if err.NotResolvedIP {
  712. return fmt.Sprintf("migration/cloning from '%s' is not allowed: unknown hostname", err.Host)
  713. }
  714. if len(err.PrivateNet) != 0 {
  715. return fmt.Sprintf("migration/cloning from '%s' is not allowed: the host resolve to a private ip address '%s'", err.Host, err.PrivateNet)
  716. }
  717. if err.IsInvalidPath {
  718. return fmt.Sprintf("migration/cloning from '%s' is not allowed: the provided path is invalid", err.Host)
  719. }
  720. if err.IsProtocolInvalid {
  721. return fmt.Sprintf("migration/cloning from '%s' is not allowed: the provided url protocol is not allowed", err.Host)
  722. }
  723. if err.IsPermissionDenied {
  724. return fmt.Sprintf("migration/cloning from '%s' is not allowed.", err.Host)
  725. }
  726. if err.IsURLError {
  727. return fmt.Sprintf("migration/cloning from '%s' is not allowed: the provided url is invalid", err.Host)
  728. }
  729. return fmt.Sprintf("migration/cloning from '%s' is not allowed", err.Host)
  730. }
  731. // ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error.
  732. type ErrUpdateTaskNotExist struct {
  733. UUID string
  734. }
  735. // IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.
  736. func IsErrUpdateTaskNotExist(err error) bool {
  737. _, ok := err.(ErrUpdateTaskNotExist)
  738. return ok
  739. }
  740. func (err ErrUpdateTaskNotExist) Error() string {
  741. return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
  742. }
  743. // ErrReleaseAlreadyExist represents a "ReleaseAlreadyExist" kind of error.
  744. type ErrReleaseAlreadyExist struct {
  745. TagName string
  746. }
  747. // IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.
  748. func IsErrReleaseAlreadyExist(err error) bool {
  749. _, ok := err.(ErrReleaseAlreadyExist)
  750. return ok
  751. }
  752. func (err ErrReleaseAlreadyExist) Error() string {
  753. return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
  754. }
  755. // ErrReleaseNotExist represents a "ReleaseNotExist" kind of error.
  756. type ErrReleaseNotExist struct {
  757. ID int64
  758. TagName string
  759. }
  760. // IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.
  761. func IsErrReleaseNotExist(err error) bool {
  762. _, ok := err.(ErrReleaseNotExist)
  763. return ok
  764. }
  765. func (err ErrReleaseNotExist) Error() string {
  766. return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
  767. }
  768. // ErrInvalidTagName represents a "InvalidTagName" kind of error.
  769. type ErrInvalidTagName struct {
  770. TagName string
  771. }
  772. // IsErrInvalidTagName checks if an error is a ErrInvalidTagName.
  773. func IsErrInvalidTagName(err error) bool {
  774. _, ok := err.(ErrInvalidTagName)
  775. return ok
  776. }
  777. func (err ErrInvalidTagName) Error() string {
  778. return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
  779. }
  780. // ErrRepoFileAlreadyExists represents a "RepoFileAlreadyExist" kind of error.
  781. type ErrRepoFileAlreadyExists struct {
  782. Path string
  783. }
  784. // IsErrRepoFileAlreadyExists checks if an error is a ErrRepoFileAlreadyExists.
  785. func IsErrRepoFileAlreadyExists(err error) bool {
  786. _, ok := err.(ErrRepoFileAlreadyExists)
  787. return ok
  788. }
  789. func (err ErrRepoFileAlreadyExists) Error() string {
  790. return fmt.Sprintf("repository file already exists [path: %s]", err.Path)
  791. }
  792. // ErrRepoFileDoesNotExist represents a "RepoFileDoesNotExist" kind of error.
  793. type ErrRepoFileDoesNotExist struct {
  794. Path string
  795. Name string
  796. }
  797. // IsErrRepoFileDoesNotExist checks if an error is a ErrRepoDoesNotExist.
  798. func IsErrRepoFileDoesNotExist(err error) bool {
  799. _, ok := err.(ErrRepoFileDoesNotExist)
  800. return ok
  801. }
  802. func (err ErrRepoFileDoesNotExist) Error() string {
  803. return fmt.Sprintf("repository file does not exist [path: %s]", err.Path)
  804. }
  805. // ErrFilenameInvalid represents a "FilenameInvalid" kind of error.
  806. type ErrFilenameInvalid struct {
  807. Path string
  808. }
  809. // IsErrFilenameInvalid checks if an error is an ErrFilenameInvalid.
  810. func IsErrFilenameInvalid(err error) bool {
  811. _, ok := err.(ErrFilenameInvalid)
  812. return ok
  813. }
  814. func (err ErrFilenameInvalid) Error() string {
  815. return fmt.Sprintf("path contains a malformed path component [path: %s]", err.Path)
  816. }
  817. // ErrUserCannotCommit represents "UserCannotCommit" kind of error.
  818. type ErrUserCannotCommit struct {
  819. UserName string
  820. }
  821. // IsErrUserCannotCommit checks if an error is an ErrUserCannotCommit.
  822. func IsErrUserCannotCommit(err error) bool {
  823. _, ok := err.(ErrUserCannotCommit)
  824. return ok
  825. }
  826. func (err ErrUserCannotCommit) Error() string {
  827. return fmt.Sprintf("user cannot commit to repo [user: %s]", err.UserName)
  828. }
  829. // ErrFilePathInvalid represents a "FilePathInvalid" kind of error.
  830. type ErrFilePathInvalid struct {
  831. Message string
  832. Path string
  833. Name string
  834. Type git.EntryMode
  835. }
  836. // IsErrFilePathInvalid checks if an error is an ErrFilePathInvalid.
  837. func IsErrFilePathInvalid(err error) bool {
  838. _, ok := err.(ErrFilePathInvalid)
  839. return ok
  840. }
  841. func (err ErrFilePathInvalid) Error() string {
  842. if err.Message != "" {
  843. return err.Message
  844. }
  845. return fmt.Sprintf("path is invalid [path: %s]", err.Path)
  846. }
  847. // ErrFilePathProtected represents a "FilePathProtected" kind of error.
  848. type ErrFilePathProtected struct {
  849. Message string
  850. Path string
  851. }
  852. // IsErrFilePathProtected checks if an error is an ErrFilePathProtected.
  853. func IsErrFilePathProtected(err error) bool {
  854. _, ok := err.(ErrFilePathProtected)
  855. return ok
  856. }
  857. func (err ErrFilePathProtected) Error() string {
  858. if err.Message != "" {
  859. return err.Message
  860. }
  861. return fmt.Sprintf("path is protected and can not be changed [path: %s]", err.Path)
  862. }
  863. // ErrUserDoesNotHaveAccessToRepo represets an error where the user doesn't has access to a given repo.
  864. type ErrUserDoesNotHaveAccessToRepo struct {
  865. UserID int64
  866. RepoName string
  867. }
  868. // IsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrRepoFileAlreadyExists.
  869. func IsErrUserDoesNotHaveAccessToRepo(err error) bool {
  870. _, ok := err.(ErrUserDoesNotHaveAccessToRepo)
  871. return ok
  872. }
  873. func (err ErrUserDoesNotHaveAccessToRepo) Error() string {
  874. return fmt.Sprintf("user doesn't have acces to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName)
  875. }
  876. // ErrWontSign explains the first reason why a commit would not be signed
  877. // There may be other reasons - this is just the first reason found
  878. type ErrWontSign struct {
  879. Reason signingMode
  880. }
  881. func (e *ErrWontSign) Error() string {
  882. return fmt.Sprintf("wont sign: %s", e.Reason)
  883. }
  884. // IsErrWontSign checks if an error is a ErrWontSign
  885. func IsErrWontSign(err error) bool {
  886. _, ok := err.(*ErrWontSign)
  887. return ok
  888. }
  889. // __________ .__
  890. // \______ \____________ ____ ____ | |__
  891. // | | _/\_ __ \__ \ / \_/ ___\| | \
  892. // | | \ | | \// __ \| | \ \___| Y \
  893. // |______ / |__| (____ /___| /\___ >___| /
  894. // \/ \/ \/ \/ \/
  895. // ErrBranchDoesNotExist represents an error that branch with such name does not exist.
  896. type ErrBranchDoesNotExist struct {
  897. BranchName string
  898. }
  899. // IsErrBranchDoesNotExist checks if an error is an ErrBranchDoesNotExist.
  900. func IsErrBranchDoesNotExist(err error) bool {
  901. _, ok := err.(ErrBranchDoesNotExist)
  902. return ok
  903. }
  904. func (err ErrBranchDoesNotExist) Error() string {
  905. return fmt.Sprintf("branch does not exist [name: %s]", err.BranchName)
  906. }
  907. // ErrBranchAlreadyExists represents an error that branch with such name already exists.
  908. type ErrBranchAlreadyExists struct {
  909. BranchName string
  910. }
  911. // IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.
  912. func IsErrBranchAlreadyExists(err error) bool {
  913. _, ok := err.(ErrBranchAlreadyExists)
  914. return ok
  915. }
  916. func (err ErrBranchAlreadyExists) Error() string {
  917. return fmt.Sprintf("branch already exists [name: %s]", err.BranchName)
  918. }
  919. // ErrBranchNameConflict represents an error that branch name conflicts with other branch.
  920. type ErrBranchNameConflict struct {
  921. BranchName string
  922. }
  923. // IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.
  924. func IsErrBranchNameConflict(err error) bool {
  925. _, ok := err.(ErrBranchNameConflict)
  926. return ok
  927. }
  928. func (err ErrBranchNameConflict) Error() string {
  929. return fmt.Sprintf("branch conflicts with existing branch [name: %s]", err.BranchName)
  930. }
  931. // ErrBranchesEqual represents an error that branch name conflicts with other branch.
  932. type ErrBranchesEqual struct {
  933. BaseBranchName string
  934. HeadBranchName string
  935. }
  936. // IsErrBranchesEqual checks if an error is an ErrBranchesEqual.
  937. func IsErrBranchesEqual(err error) bool {
  938. _, ok := err.(ErrBranchesEqual)
  939. return ok
  940. }
  941. func (err ErrBranchesEqual) Error() string {
  942. return fmt.Sprintf("branches are equal [head: %sm base: %s]", err.HeadBranchName, err.BaseBranchName)
  943. }
  944. // ErrNotAllowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it.
  945. type ErrNotAllowedToMerge struct {
  946. Reason string
  947. }
  948. // IsErrNotAllowedToMerge checks if an error is an ErrNotAllowedToMerge.
  949. func IsErrNotAllowedToMerge(err error) bool {
  950. _, ok := err.(ErrNotAllowedToMerge)
  951. return ok
  952. }
  953. func (err ErrNotAllowedToMerge) Error() string {
  954. return fmt.Sprintf("not allowed to merge [reason: %s]", err.Reason)
  955. }
  956. // ErrTagAlreadyExists represents an error that tag with such name already exists.
  957. type ErrTagAlreadyExists struct {
  958. TagName string
  959. }
  960. // IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.
  961. func IsErrTagAlreadyExists(err error) bool {
  962. _, ok := err.(ErrTagAlreadyExists)
  963. return ok
  964. }
  965. func (err ErrTagAlreadyExists) Error() string {
  966. return fmt.Sprintf("tag already exists [name: %s]", err.TagName)
  967. }
  968. // ErrSHADoesNotMatch represents a "SHADoesNotMatch" kind of error.
  969. type ErrSHADoesNotMatch struct {
  970. Path string
  971. GivenSHA string
  972. CurrentSHA string
  973. }
  974. // IsErrSHADoesNotMatch checks if an error is a ErrSHADoesNotMatch.
  975. func IsErrSHADoesNotMatch(err error) bool {
  976. _, ok := err.(ErrSHADoesNotMatch)
  977. return ok
  978. }
  979. func (err ErrSHADoesNotMatch) Error() string {
  980. return fmt.Sprintf("sha does not match [given: %s, expected: %s]", err.GivenSHA, err.CurrentSHA)
  981. }
  982. // ErrSHANotFound represents a "SHADoesNotMatch" kind of error.
  983. type ErrSHANotFound struct {
  984. SHA string
  985. }
  986. // IsErrSHANotFound checks if an error is a ErrSHANotFound.
  987. func IsErrSHANotFound(err error) bool {
  988. _, ok := err.(ErrSHANotFound)
  989. return ok
  990. }
  991. func (err ErrSHANotFound) Error() string {
  992. return fmt.Sprintf("sha not found [%s]", err.SHA)
  993. }
  994. // ErrCommitIDDoesNotMatch represents a "CommitIDDoesNotMatch" kind of error.
  995. type ErrCommitIDDoesNotMatch struct {
  996. GivenCommitID string
  997. CurrentCommitID string
  998. }
  999. // IsErrCommitIDDoesNotMatch checks if an error is a ErrCommitIDDoesNotMatch.
  1000. func IsErrCommitIDDoesNotMatch(err error) bool {
  1001. _, ok := err.(ErrCommitIDDoesNotMatch)
  1002. return ok
  1003. }
  1004. func (err ErrCommitIDDoesNotMatch) Error() string {
  1005. return fmt.Sprintf("file CommitID does not match [given: %s, expected: %s]", err.GivenCommitID, err.CurrentCommitID)
  1006. }
  1007. // ErrSHAOrCommitIDNotProvided represents a "SHAOrCommitIDNotProvided" kind of error.
  1008. type ErrSHAOrCommitIDNotProvided struct{}
  1009. // IsErrSHAOrCommitIDNotProvided checks if an error is a ErrSHAOrCommitIDNotProvided.
  1010. func IsErrSHAOrCommitIDNotProvided(err error) bool {
  1011. _, ok := err.(ErrSHAOrCommitIDNotProvided)
  1012. return ok
  1013. }
  1014. func (err ErrSHAOrCommitIDNotProvided) Error() string {
  1015. return "a SHA or commmit ID must be proved when updating a file"
  1016. }
  1017. // __ __ ___. .__ __
  1018. // / \ / \ ____\_ |__ | |__ ____ ____ | | __
  1019. // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
  1020. // \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
  1021. // \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
  1022. // \/ \/ \/ \/ \/
  1023. // ErrWebhookNotExist represents a "WebhookNotExist" kind of error.
  1024. type ErrWebhookNotExist struct {
  1025. ID int64
  1026. }
  1027. // IsErrWebhookNotExist checks if an error is a ErrWebhookNotExist.
  1028. func IsErrWebhookNotExist(err error) bool {
  1029. _, ok := err.(ErrWebhookNotExist)
  1030. return ok
  1031. }
  1032. func (err ErrWebhookNotExist) Error() string {
  1033. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  1034. }
  1035. // .___
  1036. // | | ______ ________ __ ____
  1037. // | |/ ___// ___/ | \_/ __ \
  1038. // | |\___ \ \___ \| | /\ ___/
  1039. // |___/____ >____ >____/ \___ >
  1040. // \/ \/ \/
  1041. // ErrIssueNotExist represents a "IssueNotExist" kind of error.
  1042. type ErrIssueNotExist struct {
  1043. ID int64
  1044. RepoID int64
  1045. Index int64
  1046. }
  1047. // IsErrIssueNotExist checks if an error is a ErrIssueNotExist.
  1048. func IsErrIssueNotExist(err error) bool {
  1049. _, ok := err.(ErrIssueNotExist)
  1050. return ok
  1051. }
  1052. func (err ErrIssueNotExist) Error() string {
  1053. return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  1054. }
  1055. // ErrIssueIsClosed represents a "IssueIsClosed" kind of error.
  1056. type ErrIssueIsClosed struct {
  1057. ID int64
  1058. RepoID int64
  1059. Index int64
  1060. }
  1061. // IsErrIssueIsClosed checks if an error is a ErrIssueNotExist.
  1062. func IsErrIssueIsClosed(err error) bool {
  1063. _, ok := err.(ErrIssueIsClosed)
  1064. return ok
  1065. }
  1066. func (err ErrIssueIsClosed) Error() string {
  1067. return fmt.Sprintf("issue is closed [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  1068. }
  1069. // ErrIssueLabelTemplateLoad represents a "ErrIssueLabelTemplateLoad" kind of error.
  1070. type ErrIssueLabelTemplateLoad struct {
  1071. TemplateFile string
  1072. OriginalError error
  1073. }
  1074. // IsErrIssueLabelTemplateLoad checks if an error is a ErrIssueLabelTemplateLoad.
  1075. func IsErrIssueLabelTemplateLoad(err error) bool {
  1076. _, ok := err.(ErrIssueLabelTemplateLoad)
  1077. return ok
  1078. }
  1079. func (err ErrIssueLabelTemplateLoad) Error() string {
  1080. return fmt.Sprintf("Failed to load label template file '%s': %v", err.TemplateFile, err.OriginalError)
  1081. }
  1082. // ErrNewIssueInsert is used when the INSERT statement in newIssue fails
  1083. type ErrNewIssueInsert struct {
  1084. OriginalError error
  1085. }
  1086. // IsErrNewIssueInsert checks if an error is a ErrNewIssueInsert.
  1087. func IsErrNewIssueInsert(err error) bool {
  1088. _, ok := err.(ErrNewIssueInsert)
  1089. return ok
  1090. }
  1091. func (err ErrNewIssueInsert) Error() string {
  1092. return err.OriginalError.Error()
  1093. }
  1094. // ErrIssueWasClosed is used when close a closed issue
  1095. type ErrIssueWasClosed struct {
  1096. ID int64
  1097. Index int64
  1098. }
  1099. // IsErrIssueWasClosed checks if an error is a ErrIssueWasClosed.
  1100. func IsErrIssueWasClosed(err error) bool {
  1101. _, ok := err.(ErrIssueWasClosed)
  1102. return ok
  1103. }
  1104. func (err ErrIssueWasClosed) Error() string {
  1105. return fmt.Sprintf("Issue [%d] %d was already closed", err.ID, err.Index)
  1106. }
  1107. // ErrPullWasClosed is used close a closed pull request
  1108. type ErrPullWasClosed struct {
  1109. ID int64
  1110. Index int64
  1111. }
  1112. // IsErrPullWasClosed checks if an error is a ErrErrPullWasClosed.
  1113. func IsErrPullWasClosed(err error) bool {
  1114. _, ok := err.(ErrPullWasClosed)
  1115. return ok
  1116. }
  1117. func (err ErrPullWasClosed) Error() string {
  1118. return fmt.Sprintf("Pull request [%d] %d was already closed", err.ID, err.Index)
  1119. }
  1120. // ErrForbiddenIssueReaction is used when a forbidden reaction was try to created
  1121. type ErrForbiddenIssueReaction struct {
  1122. Reaction string
  1123. }
  1124. // IsErrForbiddenIssueReaction checks if an error is a ErrForbiddenIssueReaction.
  1125. func IsErrForbiddenIssueReaction(err error) bool {
  1126. _, ok := err.(ErrForbiddenIssueReaction)
  1127. return ok
  1128. }
  1129. func (err ErrForbiddenIssueReaction) Error() string {
  1130. return fmt.Sprintf("'%s' is not an allowed reaction", err.Reaction)
  1131. }
  1132. // ErrReactionAlreadyExist is used when a existing reaction was try to created
  1133. type ErrReactionAlreadyExist struct {
  1134. Reaction string
  1135. }
  1136. // IsErrReactionAlreadyExist checks if an error is a ErrReactionAlreadyExist.
  1137. func IsErrReactionAlreadyExist(err error) bool {
  1138. _, ok := err.(ErrReactionAlreadyExist)
  1139. return ok
  1140. }
  1141. func (err ErrReactionAlreadyExist) Error() string {
  1142. return fmt.Sprintf("reaction '%s' already exists", err.Reaction)
  1143. }
  1144. // __________ .__ .__ __________ __
  1145. // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
  1146. // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
  1147. // | | | | / |_| |_| | \ ___< <_| | | /\ ___/ \___ \ | |
  1148. // |____| |____/|____/____/____|_ /\___ >__ |____/ \___ >____ > |__|
  1149. // \/ \/ |__| \/ \/
  1150. // ErrPullRequestNotExist represents a "PullRequestNotExist" kind of error.
  1151. type ErrPullRequestNotExist struct {
  1152. ID int64
  1153. IssueID int64
  1154. HeadRepoID int64
  1155. BaseRepoID int64
  1156. HeadBranch string
  1157. BaseBranch string
  1158. }
  1159. // IsErrPullRequestNotExist checks if an error is a ErrPullRequestNotExist.
  1160. func IsErrPullRequestNotExist(err error) bool {
  1161. _, ok := err.(ErrPullRequestNotExist)
  1162. return ok
  1163. }
  1164. func (err ErrPullRequestNotExist) Error() string {
  1165. 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]",
  1166. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1167. }
  1168. // ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
  1169. type ErrPullRequestAlreadyExists struct {
  1170. ID int64
  1171. IssueID int64
  1172. HeadRepoID int64
  1173. BaseRepoID int64
  1174. HeadBranch string
  1175. BaseBranch string
  1176. }
  1177. // IsErrPullRequestAlreadyExists checks if an error is a ErrPullRequestAlreadyExists.
  1178. func IsErrPullRequestAlreadyExists(err error) bool {
  1179. _, ok := err.(ErrPullRequestAlreadyExists)
  1180. return ok
  1181. }
  1182. // Error does pretty-printing :D
  1183. func (err ErrPullRequestAlreadyExists) Error() string {
  1184. 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]",
  1185. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1186. }
  1187. // ErrPullRequestHeadRepoMissing represents a "ErrPullRequestHeadRepoMissing" error
  1188. type ErrPullRequestHeadRepoMissing struct {
  1189. ID int64
  1190. HeadRepoID int64
  1191. }
  1192. // IsErrErrPullRequestHeadRepoMissing checks if an error is a ErrPullRequestHeadRepoMissing.
  1193. func IsErrErrPullRequestHeadRepoMissing(err error) bool {
  1194. _, ok := err.(ErrPullRequestHeadRepoMissing)
  1195. return ok
  1196. }
  1197. // Error does pretty-printing :D
  1198. func (err ErrPullRequestHeadRepoMissing) Error() string {
  1199. return fmt.Sprintf("pull request head repo missing [id: %d, head_repo_id: %d]",
  1200. err.ID, err.HeadRepoID)
  1201. }
  1202. // ErrInvalidMergeStyle represents an error if merging with disabled merge strategy
  1203. type ErrInvalidMergeStyle struct {
  1204. ID int64
  1205. Style MergeStyle
  1206. }
  1207. // IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.
  1208. func IsErrInvalidMergeStyle(err error) bool {
  1209. _, ok := err.(ErrInvalidMergeStyle)
  1210. return ok
  1211. }
  1212. func (err ErrInvalidMergeStyle) Error() string {
  1213. return fmt.Sprintf("merge strategy is not allowed or is invalid [repo_id: %d, strategy: %s]",
  1214. err.ID, err.Style)
  1215. }
  1216. // ErrMergeConflicts represents an error if merging fails with a conflict
  1217. type ErrMergeConflicts struct {
  1218. Style MergeStyle
  1219. StdOut string
  1220. StdErr string
  1221. Err error
  1222. }
  1223. // IsErrMergeConflicts checks if an error is a ErrMergeConflicts.
  1224. func IsErrMergeConflicts(err error) bool {
  1225. _, ok := err.(ErrMergeConflicts)
  1226. return ok
  1227. }
  1228. func (err ErrMergeConflicts) Error() string {
  1229. return fmt.Sprintf("Merge Conflict Error: %v: %s\n%s", err.Err, err.StdErr, err.StdOut)
  1230. }
  1231. // ErrMergeUnrelatedHistories represents an error if merging fails due to unrelated histories
  1232. type ErrMergeUnrelatedHistories struct {
  1233. Style MergeStyle
  1234. StdOut string
  1235. StdErr string
  1236. Err error
  1237. }
  1238. // IsErrMergeUnrelatedHistories checks if an error is a ErrMergeUnrelatedHistories.
  1239. func IsErrMergeUnrelatedHistories(err error) bool {
  1240. _, ok := err.(ErrMergeUnrelatedHistories)
  1241. return ok
  1242. }
  1243. func (err ErrMergeUnrelatedHistories) Error() string {
  1244. return fmt.Sprintf("Merge UnrelatedHistories Error: %v: %s\n%s", err.Err, err.StdErr, err.StdOut)
  1245. }
  1246. // ErrRebaseConflicts represents an error if rebase fails with a conflict
  1247. type ErrRebaseConflicts struct {
  1248. Style MergeStyle
  1249. CommitSHA string
  1250. StdOut string
  1251. StdErr string
  1252. Err error
  1253. }
  1254. // IsErrRebaseConflicts checks if an error is a ErrRebaseConflicts.
  1255. func IsErrRebaseConflicts(err error) bool {
  1256. _, ok := err.(ErrRebaseConflicts)
  1257. return ok
  1258. }
  1259. func (err ErrRebaseConflicts) Error() string {
  1260. return fmt.Sprintf("Rebase Error: %v: Whilst Rebasing: %s\n%s\n%s", err.Err, err.CommitSHA, err.StdErr, err.StdOut)
  1261. }
  1262. // ErrPullRequestHasMerged represents a "PullRequestHasMerged"-error
  1263. type ErrPullRequestHasMerged struct {
  1264. ID int64
  1265. IssueID int64
  1266. HeadRepoID int64
  1267. BaseRepoID int64
  1268. HeadBranch string
  1269. BaseBranch string
  1270. }
  1271. // IsErrPullRequestHasMerged checks if an error is a ErrPullRequestHasMerged.
  1272. func IsErrPullRequestHasMerged(err error) bool {
  1273. _, ok := err.(ErrPullRequestHasMerged)
  1274. return ok
  1275. }
  1276. // Error does pretty-printing :D
  1277. func (err ErrPullRequestHasMerged) Error() string {
  1278. 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]",
  1279. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  1280. }
  1281. // _________ __
  1282. // \_ ___ \ ____ _____ _____ ____ _____/ |_
  1283. // / \ \/ / _ \ / \ / \_/ __ \ / \ __\
  1284. // \ \___( <_> ) Y Y \ Y Y \ ___/| | \ |
  1285. // \______ /\____/|__|_| /__|_| /\___ >___| /__|
  1286. // \/ \/ \/ \/ \/
  1287. // ErrCommentNotExist represents a "CommentNotExist" kind of error.
  1288. type ErrCommentNotExist struct {
  1289. ID int64
  1290. IssueID int64
  1291. }
  1292. // IsErrCommentNotExist checks if an error is a ErrCommentNotExist.
  1293. func IsErrCommentNotExist(err error) bool {
  1294. _, ok := err.(ErrCommentNotExist)
  1295. return ok
  1296. }
  1297. func (err ErrCommentNotExist) Error() string {
  1298. return fmt.Sprintf("comment does not exist [id: %d, issue_id: %d]", err.ID, err.IssueID)
  1299. }
  1300. // _________ __ __ .__
  1301. // / _____// |_ ____ ________ _ _______ _/ |_ ____ | |__
  1302. // \_____ \\ __\/ _ \\____ \ \/ \/ /\__ \\ __\/ ___\| | \
  1303. // / \| | ( <_> ) |_> > / / __ \| | \ \___| Y \
  1304. // /_______ /|__| \____/| __/ \/\_/ (____ /__| \___ >___| /
  1305. // \/ |__| \/ \/ \/
  1306. // ErrStopwatchNotExist represents a "Stopwatch Not Exist" kind of error.
  1307. type ErrStopwatchNotExist struct {
  1308. ID int64
  1309. }
  1310. // IsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.
  1311. func IsErrStopwatchNotExist(err error) bool {
  1312. _, ok := err.(ErrStopwatchNotExist)
  1313. return ok
  1314. }
  1315. func (err ErrStopwatchNotExist) Error() string {
  1316. return fmt.Sprintf("stopwatch does not exist [id: %d]", err.ID)
  1317. }
  1318. // ___________ __ .______________.__
  1319. // \__ ___/___________ ____ | | __ ____ __| _/\__ ___/|__| _____ ____
  1320. // | | \_ __ \__ \ _/ ___\| |/ // __ \ / __ | | | | |/ \_/ __ \
  1321. // | | | | \// __ \\ \___| <\ ___// /_/ | | | | | Y Y \ ___/
  1322. // |____| |__| (____ /\___ >__|_ \\___ >____ | |____| |__|__|_| /\___ >
  1323. // \/ \/ \/ \/ \/ \/ \/
  1324. // ErrTrackedTimeNotExist represents a "TrackedTime Not Exist" kind of error.
  1325. type ErrTrackedTimeNotExist struct {
  1326. ID int64
  1327. }
  1328. // IsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.
  1329. func IsErrTrackedTimeNotExist(err error) bool {
  1330. _, ok := err.(ErrTrackedTimeNotExist)
  1331. return ok
  1332. }
  1333. func (err ErrTrackedTimeNotExist) Error() string {
  1334. return fmt.Sprintf("tracked time does not exist [id: %d]", err.ID)
  1335. }
  1336. // .____ ___. .__
  1337. // | | _____ \_ |__ ____ | |
  1338. // | | \__ \ | __ \_/ __ \| |
  1339. // | |___ / __ \| \_\ \ ___/| |__
  1340. // |_______ (____ /___ /\___ >____/
  1341. // \/ \/ \/ \/
  1342. // ErrRepoLabelNotExist represents a "RepoLabelNotExist" kind of error.
  1343. type ErrRepoLabelNotExist struct {
  1344. LabelID int64
  1345. RepoID int64
  1346. }
  1347. // IsErrRepoLabelNotExist checks if an error is a RepoErrLabelNotExist.
  1348. func IsErrRepoLabelNotExist(err error) bool {
  1349. _, ok := err.(ErrRepoLabelNotExist)
  1350. return ok
  1351. }
  1352. func (err ErrRepoLabelNotExist) Error() string {
  1353. return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID)
  1354. }
  1355. // ErrOrgLabelNotExist represents a "OrgLabelNotExist" kind of error.
  1356. type ErrOrgLabelNotExist struct {
  1357. LabelID int64
  1358. OrgID int64
  1359. }
  1360. // IsErrOrgLabelNotExist checks if an error is a OrgErrLabelNotExist.
  1361. func IsErrOrgLabelNotExist(err error) bool {
  1362. _, ok := err.(ErrOrgLabelNotExist)
  1363. return ok
  1364. }
  1365. func (err ErrOrgLabelNotExist) Error() string {
  1366. return fmt.Sprintf("label does not exist [label_id: %d, org_id: %d]", err.LabelID, err.OrgID)
  1367. }
  1368. // ErrLabelNotExist represents a "LabelNotExist" kind of error.
  1369. type ErrLabelNotExist struct {
  1370. LabelID int64
  1371. }
  1372. // IsErrLabelNotExist checks if an error is a ErrLabelNotExist.
  1373. func IsErrLabelNotExist(err error) bool {
  1374. _, ok := err.(ErrLabelNotExist)
  1375. return ok
  1376. }
  1377. func (err ErrLabelNotExist) Error() string {
  1378. return fmt.Sprintf("label does not exist [label_id: %d]", err.LabelID)
  1379. }
  1380. // __________ __ __
  1381. // \______ \_______ ____ |__| ____ _____/ |_ ______
  1382. // | ___/\_ __ \/ _ \ | |/ __ \_/ ___\ __\/ ___/
  1383. // | | | | \( <_> ) | \ ___/\ \___| | \___ \
  1384. // |____| |__| \____/\__| |\___ >\___ >__| /____ >
  1385. // \______| \/ \/ \/
  1386. // ErrProjectNotExist represents a "ProjectNotExist" kind of error.
  1387. type ErrProjectNotExist struct {
  1388. ID int64
  1389. RepoID int64
  1390. }
  1391. // IsErrProjectNotExist checks if an error is a ErrProjectNotExist
  1392. func IsErrProjectNotExist(err error) bool {
  1393. _, ok := err.(ErrProjectNotExist)
  1394. return ok
  1395. }
  1396. func (err ErrProjectNotExist) Error() string {
  1397. return fmt.Sprintf("projects does not exist [id: %d]", err.ID)
  1398. }
  1399. // ErrProjectBoardNotExist represents a "ProjectBoardNotExist" kind of error.
  1400. type ErrProjectBoardNotExist struct {
  1401. BoardID int64
  1402. }
  1403. // IsErrProjectBoardNotExist checks if an error is a ErrProjectBoardNotExist
  1404. func IsErrProjectBoardNotExist(err error) bool {
  1405. _, ok := err.(ErrProjectBoardNotExist)
  1406. return ok
  1407. }
  1408. func (err ErrProjectBoardNotExist) Error() string {
  1409. return fmt.Sprintf("project board does not exist [id: %d]", err.BoardID)
  1410. }
  1411. // _____ .__.__ __
  1412. // / \ |__| | ____ _______/ |_ ____ ____ ____
  1413. // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
  1414. // / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
  1415. // \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
  1416. // \/ \/ \/ \/ \/
  1417. // ErrMilestoneNotExist represents a "MilestoneNotExist" kind of error.
  1418. type ErrMilestoneNotExist struct {
  1419. ID int64
  1420. RepoID int64
  1421. Name string
  1422. }
  1423. // IsErrMilestoneNotExist checks if an error is a ErrMilestoneNotExist.
  1424. func IsErrMilestoneNotExist(err error) bool {
  1425. _, ok := err.(ErrMilestoneNotExist)
  1426. return ok
  1427. }
  1428. func (err ErrMilestoneNotExist) Error() string {
  1429. if len(err.Name) > 0 {
  1430. return fmt.Sprintf("milestone does not exist [name: %s, repo_id: %d]", err.Name, err.RepoID)
  1431. }
  1432. return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID)
  1433. }
  1434. // _____ __ __ .__ __
  1435. // / _ \_/ |__/ |______ ____ | |__ _____ ____ _____/ |_
  1436. // / /_\ \ __\ __\__ \ _/ ___\| | \ / \_/ __ \ / \ __\
  1437. // / | \ | | | / __ \\ \___| Y \ Y Y \ ___/| | \ |
  1438. // \____|__ /__| |__| (____ /\___ >___| /__|_| /\___ >___| /__|
  1439. // \/ \/ \/ \/ \/ \/ \/
  1440. // ErrAttachmentNotExist represents a "AttachmentNotExist" kind of error.
  1441. type ErrAttachmentNotExist struct {
  1442. ID int64
  1443. UUID string
  1444. }
  1445. // IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
  1446. func IsErrAttachmentNotExist(err error) bool {
  1447. _, ok := err.(ErrAttachmentNotExist)
  1448. return ok
  1449. }
  1450. func (err ErrAttachmentNotExist) Error() string {
  1451. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1452. }
  1453. // .____ .__ _________
  1454. // | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____
  1455. // | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \
  1456. // | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/
  1457. // |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ >
  1458. // \/ /_____/ \/ \/ \/ \/
  1459. // ErrLoginSourceNotExist represents a "LoginSourceNotExist" kind of error.
  1460. type ErrLoginSourceNotExist struct {
  1461. ID int64
  1462. }
  1463. // IsErrLoginSourceNotExist checks if an error is a ErrLoginSourceNotExist.
  1464. func IsErrLoginSourceNotExist(err error) bool {
  1465. _, ok := err.(ErrLoginSourceNotExist)
  1466. return ok
  1467. }
  1468. func (err ErrLoginSourceNotExist) Error() string {
  1469. return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
  1470. }
  1471. // ErrLoginSourceAlreadyExist represents a "LoginSourceAlreadyExist" kind of error.
  1472. type ErrLoginSourceAlreadyExist struct {
  1473. Name string
  1474. }
  1475. // IsErrLoginSourceAlreadyExist checks if an error is a ErrLoginSourceAlreadyExist.
  1476. func IsErrLoginSourceAlreadyExist(err error) bool {
  1477. _, ok := err.(ErrLoginSourceAlreadyExist)
  1478. return ok
  1479. }
  1480. func (err ErrLoginSourceAlreadyExist) Error() string {
  1481. return fmt.Sprintf("login source already exists [name: %s]", err.Name)
  1482. }
  1483. // ErrLoginSourceInUse represents a "LoginSourceInUse" kind of error.
  1484. type ErrLoginSourceInUse struct {
  1485. ID int64
  1486. }
  1487. // IsErrLoginSourceInUse checks if an error is a ErrLoginSourceInUse.
  1488. func IsErrLoginSourceInUse(err error) bool {
  1489. _, ok := err.(ErrLoginSourceInUse)
  1490. return ok
  1491. }
  1492. func (err ErrLoginSourceInUse) Error() string {
  1493. return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
  1494. }
  1495. // ___________
  1496. // \__ ___/___ _____ _____
  1497. // | |_/ __ \\__ \ / \
  1498. // | |\ ___/ / __ \| Y Y \
  1499. // |____| \___ >____ /__|_| /
  1500. // \/ \/ \/
  1501. // ErrTeamAlreadyExist represents a "TeamAlreadyExist" kind of error.
  1502. type ErrTeamAlreadyExist struct {
  1503. OrgID int64
  1504. Name string
  1505. }
  1506. // IsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.
  1507. func IsErrTeamAlreadyExist(err error) bool {
  1508. _, ok := err.(ErrTeamAlreadyExist)
  1509. return ok
  1510. }
  1511. func (err ErrTeamAlreadyExist) Error() string {
  1512. return fmt.Sprintf("team already exists [org_id: %d, name: %s]", err.OrgID, err.Name)
  1513. }
  1514. // ErrTeamNotExist represents a "TeamNotExist" error
  1515. type ErrTeamNotExist struct {
  1516. OrgID int64
  1517. TeamID int64
  1518. Name string
  1519. }
  1520. // IsErrTeamNotExist checks if an error is a ErrTeamNotExist.
  1521. func IsErrTeamNotExist(err error) bool {
  1522. _, ok := err.(ErrTeamNotExist)
  1523. return ok
  1524. }
  1525. func (err ErrTeamNotExist) Error() string {
  1526. return fmt.Sprintf("team does not exist [org_id %d, team_id %d, name: %s]", err.OrgID, err.TeamID, err.Name)
  1527. }
  1528. //
  1529. // Two-factor authentication
  1530. //
  1531. // ErrTwoFactorNotEnrolled indicates that a user is not enrolled in two-factor authentication.
  1532. type ErrTwoFactorNotEnrolled struct {
  1533. UID int64
  1534. }
  1535. // IsErrTwoFactorNotEnrolled checks if an error is a ErrTwoFactorNotEnrolled.
  1536. func IsErrTwoFactorNotEnrolled(err error) bool {
  1537. _, ok := err.(ErrTwoFactorNotEnrolled)
  1538. return ok
  1539. }
  1540. func (err ErrTwoFactorNotEnrolled) Error() string {
  1541. return fmt.Sprintf("user not enrolled in 2FA [uid: %d]", err.UID)
  1542. }
  1543. // ____ ___ .__ .___
  1544. // | | \______ | | _________ __| _/
  1545. // | | /\____ \| | / _ \__ \ / __ |
  1546. // | | / | |_> > |_( <_> ) __ \_/ /_/ |
  1547. // |______/ | __/|____/\____(____ /\____ |
  1548. // |__| \/ \/
  1549. //
  1550. // ErrUploadNotExist represents a "UploadNotExist" kind of error.
  1551. type ErrUploadNotExist struct {
  1552. ID int64
  1553. UUID string
  1554. }
  1555. // IsErrUploadNotExist checks if an error is a ErrUploadNotExist.
  1556. func IsErrUploadNotExist(err error) bool {
  1557. _, ok := err.(ErrAttachmentNotExist)
  1558. return ok
  1559. }
  1560. func (err ErrUploadNotExist) Error() string {
  1561. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1562. }
  1563. // ___________ __ .__ .____ .__ ____ ___
  1564. // \_ _____/__ ____/ |_ ___________ ____ _____ | | | | ____ ____ |__| ____ | | \______ ___________
  1565. // | __)_\ \/ /\ __\/ __ \_ __ \/ \\__ \ | | | | / _ \ / ___\| |/ \ | | / ___// __ \_ __ \
  1566. // | \> < | | \ ___/| | \/ | \/ __ \| |__ | |__( <_> ) /_/ > | | \ | | /\___ \\ ___/| | \/
  1567. // /_______ /__/\_ \ |__| \___ >__| |___| (____ /____/ |_______ \____/\___ /|__|___| / |______//____ >\___ >__|
  1568. // \/ \/ \/ \/ \/ \/ /_____/ \/ \/ \/
  1569. // ErrExternalLoginUserAlreadyExist represents a "ExternalLoginUserAlreadyExist" kind of error.
  1570. type ErrExternalLoginUserAlreadyExist struct {
  1571. ExternalID string
  1572. UserID int64
  1573. LoginSourceID int64
  1574. }
  1575. // IsErrExternalLoginUserAlreadyExist checks if an error is a ExternalLoginUserAlreadyExist.
  1576. func IsErrExternalLoginUserAlreadyExist(err error) bool {
  1577. _, ok := err.(ErrExternalLoginUserAlreadyExist)
  1578. return ok
  1579. }
  1580. func (err ErrExternalLoginUserAlreadyExist) Error() string {
  1581. return fmt.Sprintf("external login user already exists [externalID: %s, userID: %d, loginSourceID: %d]", err.ExternalID, err.UserID, err.LoginSourceID)
  1582. }
  1583. // ErrExternalLoginUserNotExist represents a "ExternalLoginUserNotExist" kind of error.
  1584. type ErrExternalLoginUserNotExist struct {
  1585. UserID int64
  1586. LoginSourceID int64
  1587. }
  1588. // IsErrExternalLoginUserNotExist checks if an error is a ExternalLoginUserNotExist.
  1589. func IsErrExternalLoginUserNotExist(err error) bool {
  1590. _, ok := err.(ErrExternalLoginUserNotExist)
  1591. return ok
  1592. }
  1593. func (err ErrExternalLoginUserNotExist) Error() string {
  1594. return fmt.Sprintf("external login user link does not exists [userID: %d, loginSourceID: %d]", err.UserID, err.LoginSourceID)
  1595. }
  1596. // ____ ________________________________ .__ __ __ .__
  1597. // | | \_____ \_ _____/\______ \ ____ ____ |__| _______/ |_____________ _/ |_|__| ____ ____
  1598. // | | // ____/| __) | _// __ \ / ___\| |/ ___/\ __\_ __ \__ \\ __\ |/ _ \ / \
  1599. // | | // \| \ | | \ ___// /_/ > |\___ \ | | | | \// __ \| | | ( <_> ) | \
  1600. // |______/ \_______ \___ / |____|_ /\___ >___ /|__/____ > |__| |__| (____ /__| |__|\____/|___| /
  1601. // \/ \/ \/ \/_____/ \/ \/ \/
  1602. // ErrU2FRegistrationNotExist represents a "ErrU2FRegistrationNotExist" kind of error.
  1603. type ErrU2FRegistrationNotExist struct {
  1604. ID int64
  1605. }
  1606. func (err ErrU2FRegistrationNotExist) Error() string {
  1607. return fmt.Sprintf("U2F registration does not exist [id: %d]", err.ID)
  1608. }
  1609. // IsErrU2FRegistrationNotExist checks if an error is a ErrU2FRegistrationNotExist.
  1610. func IsErrU2FRegistrationNotExist(err error) bool {
  1611. _, ok := err.(ErrU2FRegistrationNotExist)
  1612. return ok
  1613. }
  1614. // .___ ________ .___ .__
  1615. // | | ______ ________ __ ____ \______ \ ____ ______ ____ ____ __| _/____ ____ ____ |__| ____ ______
  1616. // | |/ ___// ___/ | \_/ __ \ | | \_/ __ \\____ \_/ __ \ / \ / __ |/ __ \ / \_/ ___\| |/ __ \ / ___/
  1617. // | |\___ \ \___ \| | /\ ___/ | ` \ ___/| |_> > ___/| | \/ /_/ \ ___/| | \ \___| \ ___/ \___ \
  1618. // |___/____ >____ >____/ \___ >_______ /\___ > __/ \___ >___| /\____ |\___ >___| /\___ >__|\___ >____ >
  1619. // \/ \/ \/ \/ \/|__| \/ \/ \/ \/ \/ \/ \/ \/
  1620. // ErrDependencyExists represents a "DependencyAlreadyExists" kind of error.
  1621. type ErrDependencyExists struct {
  1622. IssueID int64
  1623. DependencyID int64
  1624. }
  1625. // IsErrDependencyExists checks if an error is a ErrDependencyExists.
  1626. func IsErrDependencyExists(err error) bool {
  1627. _, ok := err.(ErrDependencyExists)
  1628. return ok
  1629. }
  1630. func (err ErrDependencyExists) Error() string {
  1631. return fmt.Sprintf("issue dependency does already exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1632. }
  1633. // ErrDependencyNotExists represents a "DependencyAlreadyExists" kind of error.
  1634. type ErrDependencyNotExists struct {
  1635. IssueID int64
  1636. DependencyID int64
  1637. }
  1638. // IsErrDependencyNotExists checks if an error is a ErrDependencyExists.
  1639. func IsErrDependencyNotExists(err error) bool {
  1640. _, ok := err.(ErrDependencyNotExists)
  1641. return ok
  1642. }
  1643. func (err ErrDependencyNotExists) Error() string {
  1644. return fmt.Sprintf("issue dependency does not exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1645. }
  1646. // ErrCircularDependency represents a "DependencyCircular" kind of error.
  1647. type ErrCircularDependency struct {
  1648. IssueID int64
  1649. DependencyID int64
  1650. }
  1651. // IsErrCircularDependency checks if an error is a ErrCircularDependency.
  1652. func IsErrCircularDependency(err error) bool {
  1653. _, ok := err.(ErrCircularDependency)
  1654. return ok
  1655. }
  1656. func (err ErrCircularDependency) Error() string {
  1657. return fmt.Sprintf("circular dependencies exists (two issues blocking each other) [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1658. }
  1659. // ErrDependenciesLeft represents an error where the issue you're trying to close still has dependencies left.
  1660. type ErrDependenciesLeft struct {
  1661. IssueID int64
  1662. }
  1663. // IsErrDependenciesLeft checks if an error is a ErrDependenciesLeft.
  1664. func IsErrDependenciesLeft(err error) bool {
  1665. _, ok := err.(ErrDependenciesLeft)
  1666. return ok
  1667. }
  1668. func (err ErrDependenciesLeft) Error() string {
  1669. return fmt.Sprintf("issue has open dependencies [issue id: %d]", err.IssueID)
  1670. }
  1671. // ErrUnknownDependencyType represents an error where an unknown dependency type was passed
  1672. type ErrUnknownDependencyType struct {
  1673. Type DependencyType
  1674. }
  1675. // IsErrUnknownDependencyType checks if an error is ErrUnknownDependencyType
  1676. func IsErrUnknownDependencyType(err error) bool {
  1677. _, ok := err.(ErrUnknownDependencyType)
  1678. return ok
  1679. }
  1680. func (err ErrUnknownDependencyType) Error() string {
  1681. return fmt.Sprintf("unknown dependency type [type: %d]", err.Type)
  1682. }
  1683. // __________ .__
  1684. // \______ \ _______ _|__| ______ _ __
  1685. // | _// __ \ \/ / |/ __ \ \/ \/ /
  1686. // | | \ ___/\ /| \ ___/\ /
  1687. // |____|_ /\___ >\_/ |__|\___ >\/\_/
  1688. // \/ \/ \/
  1689. // ErrReviewNotExist represents a "ReviewNotExist" kind of error.
  1690. type ErrReviewNotExist struct {
  1691. ID int64
  1692. }
  1693. // IsErrReviewNotExist checks if an error is a ErrReviewNotExist.
  1694. func IsErrReviewNotExist(err error) bool {
  1695. _, ok := err.(ErrReviewNotExist)
  1696. return ok
  1697. }
  1698. func (err ErrReviewNotExist) Error() string {
  1699. return fmt.Sprintf("review does not exist [id: %d]", err.ID)
  1700. }
  1701. // ErrNotValidReviewRequest an not allowed review request modify
  1702. type ErrNotValidReviewRequest struct {
  1703. Reason string
  1704. UserID int64
  1705. RepoID int64
  1706. }
  1707. // IsErrNotValidReviewRequest checks if an error is a ErrNotValidReviewRequest.
  1708. func IsErrNotValidReviewRequest(err error) bool {
  1709. _, ok := err.(ErrNotValidReviewRequest)
  1710. return ok
  1711. }
  1712. func (err ErrNotValidReviewRequest) Error() string {
  1713. return fmt.Sprintf("%s [user_id: %d, repo_id: %d]",
  1714. err.Reason,
  1715. err.UserID,
  1716. err.RepoID)
  1717. }
  1718. // ________ _____ __ .__
  1719. // \_____ \ / _ \ __ ___/ |_| |__
  1720. // / | \ / /_\ \| | \ __\ | \
  1721. // / | \/ | \ | /| | | Y \
  1722. // \_______ /\____|__ /____/ |__| |___| /
  1723. // \/ \/ \/
  1724. // ErrOAuthClientIDInvalid will be thrown if client id cannot be found
  1725. type ErrOAuthClientIDInvalid struct {
  1726. ClientID string
  1727. }
  1728. // IsErrOauthClientIDInvalid checks if an error is a ErrReviewNotExist.
  1729. func IsErrOauthClientIDInvalid(err error) bool {
  1730. _, ok := err.(ErrOAuthClientIDInvalid)
  1731. return ok
  1732. }
  1733. // Error returns the error message
  1734. func (err ErrOAuthClientIDInvalid) Error() string {
  1735. return fmt.Sprintf("Client ID invalid [Client ID: %s]", err.ClientID)
  1736. }
  1737. // ErrOAuthApplicationNotFound will be thrown if id cannot be found
  1738. type ErrOAuthApplicationNotFound struct {
  1739. ID int64
  1740. }
  1741. // IsErrOAuthApplicationNotFound checks if an error is a ErrReviewNotExist.
  1742. func IsErrOAuthApplicationNotFound(err error) bool {
  1743. _, ok := err.(ErrOAuthApplicationNotFound)
  1744. return ok
  1745. }
  1746. // Error returns the error message
  1747. func (err ErrOAuthApplicationNotFound) Error() string {
  1748. return fmt.Sprintf("OAuth application not found [ID: %d]", err.ID)
  1749. }
  1750. // ___ _ _ __ _ _ _
  1751. // | _ \___| | | / _|___ _ | |_ _ __| |__ _ _ __ ___ _ _| |_
  1752. // | _/ _ \ | | > _|_ _| | || | || / _` / _` | ' \/ -_) ' \ _|
  1753. // |_| \___/_|_| \_____| \__/ \_,_\__,_\__, |_|_|_\___|_||_\__|
  1754. // |___/
  1755. // ErrPollNotFound represents a "PollNotFound" kind of error.
  1756. type ErrPollNotFound struct {
  1757. ID int64
  1758. RepoID int64
  1759. }
  1760. // IsErrPollNotFound checks if an error is a ErrPollNotFound.
  1761. func IsErrPollNotFound(err error) bool {
  1762. _, ok := err.(ErrPollNotFound)
  1763. return ok
  1764. }
  1765. func (err ErrPollNotFound) Error() string {
  1766. return fmt.Sprintf("poll not found [id: %d, repo_id: %d]", err.ID, err.RepoID)
  1767. }
  1768. type ErrJudgmentNotFound struct {
  1769. Judge *User
  1770. Poll *Poll
  1771. CandidateID int64
  1772. }
  1773. func IsErrJudgmentNotFound(err error) bool {
  1774. _, ok := err.(ErrJudgmentNotFound)
  1775. return ok
  1776. }
  1777. func (err ErrJudgmentNotFound) Error() string {
  1778. return fmt.Sprintf("Judgment not found.")
  1779. //return fmt.Sprintf("Judgment not found" +
  1780. // " for judge %d, poll %d and candidate %d.",
  1781. // err.Judge.ID, err.Poll.ID, err.CandidateID)
  1782. }