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

error.go 51KB

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