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

error.go 40 kB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
10 years ago
10 years ago
Feature: Timetracking (#2211) * Added comment's hashtag to url for mail notifications. * Added explanation to return statement + documentation. * Replacing in-line link generation with HTMLURL. (+gofmt) * Replaced action-based model with nil-based model. (+gofmt) * Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants. * Updating comment for mailIssueCommentToParticipants * Added link to comment in "Dashboard" * Deleting feed entry if a comment is going to be deleted * Added migration * Added improved migration to add a CommentID column to action. * Added improved links to comments in feed entries. * Fixes #1956 by filtering for deleted comments that are referenced in actions. * Introducing "IsDeleted" column to action. * Adding design draft (not functional) * Adding database models for stopwatches and trackedtimes * See go-gitea/gitea#967 * Adding design draft (not functional) * Adding translations and improving design * Implementing stopwatch (for timetracking) * Make UI functional * Add hints in timeline for time tracking events * Implementing timetracking feature * Adding "Add time manual" option * Improved stopwatch * Created report of total spent time by user * Only showing total time spent if theire is something to show. * Adding license headers. * Improved error handling for "Add Time Manual" * Adding @sapks 's changes, refactoring * Adding API for feature tracking * Adding unit test * Adding DISABLE/ENABLE option to Repository settings page * Improving translations * Applying @sapk 's changes * Removing repo_unit and using IssuesSetting for disabling/enabling timetracker * Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu * Improving documentation * Fixing vendor/ folder * Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks ) * Restricting write access to timetracking based on the repo settings (Proposed by @lafriks ) * Fixed minor permissions bug. * Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo * Allow assignees and authors to track there time too. * Fixed some build-time-errors + logical errors. * Removing unused Get...ByID functions * Moving IsTimetrackerEnabled from context.Repository to models.Repository * Adding a seperate file for issue related repo functions * Adding license headers * Fixed GetUserByParams return 404 * Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons * Adding /repos/:username/times to get all tracked times of the repo * Updating sdk-dependency * Updating swagger.v1.json * Adding warning if user has already a running stopwatch (auto-timetracker) * Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions) * Changing code.gitea.io/sdk back to code.gitea.io/sdk * Correcting spelling mistake * Updating vendor.json * Changing GET stopwatch/toggle to POST stopwatch/toggle * Changing GET stopwatch/cancel to POST stopwatch/cancel * Added migration for stopwatches/timetracking * Fixed some access bugs for read-only users * Added default allow only contributors to track time value to config * Fixed migration by chaging x.Iterate to x.Find * Resorted imports * Moved Add Time Manually form to repo_form.go * Removed "Seconds" field from Add Time Manually * Resorted imports * Improved permission checking * Fixed some bugs * Added integration test * gofmt * Adding integration test by @lafriks * Added created_unix to comment fixtures * Using last event instead of a fixed event * Adding another integration test by @lafriks * Fixing bug Timetracker enabled causing error 500 at sidebar.tpl * Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning. * Returning TrackedTime instead of AddTimeOption at AddTime. * Updating SDK from go-gitea/go-sdk#69 * Resetting Go-SDK back to default repository * Fixing test-vendor by changing ini back to original repository * Adding "tags" to swagger spec * govendor sync * Removed duplicate * Formatting templates * Adding IsTimetrackingEnabled checks to API * Improving translations / english texts * Improving documentation * Updating swagger spec * Fixing integration test caused be translation-changes * Removed encoding issues in local_en-US.ini. * "Added" copyright line * Moved unit.IssuesConfig().EnableTimetracker into a != nil check * Removed some other encoding issues in local_en-US.ini * Improved javascript by checking if data-context exists * Replaced manual comment creation with CreateComment * Removed unnecessary code * Improved error checking * Small cosmetic changes * Replaced int>string>duration parsing with int>duration parsing * Fixed encoding issues * Removed unused imports Signed-off-by: Jonas Franz <info@jonasfranz.software>
8 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
9 years ago
Oauth2 consumer (#679) * initial stuff for oauth2 login, fails on: * login button on the signIn page to start the OAuth2 flow and a callback for each provider Only GitHub is implemented for now * show login button only when the OAuth2 consumer is configured (and activated) * create macaron group for oauth2 urls * prevent net/http in modules (other then oauth2) * use a new data sessions oauth2 folder for storing the oauth2 session data * add missing 2FA when this is enabled on the user * add password option for OAuth2 user , for use with git over http and login to the GUI * add tip for registering a GitHub OAuth application * at startup of Gitea register all configured providers and also on adding/deleting of new providers * custom handling of errors in oauth2 request init + show better tip * add ExternalLoginUser model and migration script to add it to database * link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed * remove the linked external account from the user his settings * if user is unknown we allow him to register a new account or link it to some existing account * sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers) * from gorilla/sessions docs: "Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!" (we're using gorilla/sessions for storing oauth2 sessions) * use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package models
  5. import "fmt"
  6. // ErrNameReserved represents a "reserved name" error.
  7. type ErrNameReserved struct {
  8. Name string
  9. }
  10. // IsErrNameReserved checks if an error is a ErrNameReserved.
  11. func IsErrNameReserved(err error) bool {
  12. _, ok := err.(ErrNameReserved)
  13. return ok
  14. }
  15. func (err ErrNameReserved) Error() string {
  16. return fmt.Sprintf("name is reserved [name: %s]", err.Name)
  17. }
  18. // ErrNamePatternNotAllowed represents a "pattern not allowed" error.
  19. type ErrNamePatternNotAllowed struct {
  20. Pattern string
  21. }
  22. // IsErrNamePatternNotAllowed checks if an error is an
  23. // ErrNamePatternNotAllowed.
  24. func IsErrNamePatternNotAllowed(err error) bool {
  25. _, ok := err.(ErrNamePatternNotAllowed)
  26. return ok
  27. }
  28. func (err ErrNamePatternNotAllowed) Error() string {
  29. return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern)
  30. }
  31. // ErrSSHDisabled represents an "SSH disabled" error.
  32. type ErrSSHDisabled struct {
  33. }
  34. // IsErrSSHDisabled checks if an error is a ErrSSHDisabled.
  35. func IsErrSSHDisabled(err error) bool {
  36. _, ok := err.(ErrSSHDisabled)
  37. return ok
  38. }
  39. func (err ErrSSHDisabled) Error() string {
  40. return "SSH is disabled"
  41. }
  42. // ____ ___
  43. // | | \______ ___________
  44. // | | / ___// __ \_ __ \
  45. // | | /\___ \\ ___/| | \/
  46. // |______//____ >\___ >__|
  47. // \/ \/
  48. // ErrUserAlreadyExist represents a "user already exists" error.
  49. type ErrUserAlreadyExist struct {
  50. Name string
  51. }
  52. // IsErrUserAlreadyExist checks if an error is a ErrUserAlreadyExists.
  53. func IsErrUserAlreadyExist(err error) bool {
  54. _, ok := err.(ErrUserAlreadyExist)
  55. return ok
  56. }
  57. func (err ErrUserAlreadyExist) Error() string {
  58. return fmt.Sprintf("user already exists [name: %s]", err.Name)
  59. }
  60. // ErrUserNotExist represents a "UserNotExist" kind of error.
  61. type ErrUserNotExist struct {
  62. UID int64
  63. Name string
  64. KeyID int64
  65. }
  66. // IsErrUserNotExist checks if an error is a ErrUserNotExist.
  67. func IsErrUserNotExist(err error) bool {
  68. _, ok := err.(ErrUserNotExist)
  69. return ok
  70. }
  71. func (err ErrUserNotExist) Error() string {
  72. return fmt.Sprintf("user does not exist [uid: %d, name: %s, keyid: %d]", err.UID, err.Name, err.KeyID)
  73. }
  74. // ErrEmailAlreadyUsed represents a "EmailAlreadyUsed" kind of error.
  75. type ErrEmailAlreadyUsed struct {
  76. Email string
  77. }
  78. // IsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed.
  79. func IsErrEmailAlreadyUsed(err error) bool {
  80. _, ok := err.(ErrEmailAlreadyUsed)
  81. return ok
  82. }
  83. func (err ErrEmailAlreadyUsed) Error() string {
  84. return fmt.Sprintf("e-mail already in use [email: %s]", err.Email)
  85. }
  86. // ErrOpenIDAlreadyUsed represents a "OpenIDAlreadyUsed" kind of error.
  87. type ErrOpenIDAlreadyUsed struct {
  88. OpenID string
  89. }
  90. // IsErrOpenIDAlreadyUsed checks if an error is a ErrOpenIDAlreadyUsed.
  91. func IsErrOpenIDAlreadyUsed(err error) bool {
  92. _, ok := err.(ErrOpenIDAlreadyUsed)
  93. return ok
  94. }
  95. func (err ErrOpenIDAlreadyUsed) Error() string {
  96. return fmt.Sprintf("OpenID already in use [oid: %s]", err.OpenID)
  97. }
  98. // ErrUserOwnRepos represents a "UserOwnRepos" kind of error.
  99. type ErrUserOwnRepos struct {
  100. UID int64
  101. }
  102. // IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.
  103. func IsErrUserOwnRepos(err error) bool {
  104. _, ok := err.(ErrUserOwnRepos)
  105. return ok
  106. }
  107. func (err ErrUserOwnRepos) Error() string {
  108. return fmt.Sprintf("user still has ownership of repositories [uid: %d]", err.UID)
  109. }
  110. // ErrUserHasOrgs represents a "UserHasOrgs" kind of error.
  111. type ErrUserHasOrgs struct {
  112. UID int64
  113. }
  114. // IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.
  115. func IsErrUserHasOrgs(err error) bool {
  116. _, ok := err.(ErrUserHasOrgs)
  117. return ok
  118. }
  119. func (err ErrUserHasOrgs) Error() string {
  120. return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
  121. }
  122. // ErrUserNotAllowedCreateOrg represents a "UserNotAllowedCreateOrg" kind of error.
  123. type ErrUserNotAllowedCreateOrg struct {
  124. }
  125. // IsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.
  126. func IsErrUserNotAllowedCreateOrg(err error) bool {
  127. _, ok := err.(ErrUserNotAllowedCreateOrg)
  128. return ok
  129. }
  130. func (err ErrUserNotAllowedCreateOrg) Error() string {
  131. return fmt.Sprintf("user is not allowed to create organizations")
  132. }
  133. // ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
  134. type ErrReachLimitOfRepo struct {
  135. Limit int
  136. }
  137. // IsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.
  138. func IsErrReachLimitOfRepo(err error) bool {
  139. _, ok := err.(ErrReachLimitOfRepo)
  140. return ok
  141. }
  142. func (err ErrReachLimitOfRepo) Error() string {
  143. return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
  144. }
  145. // __ __.__ __ .__
  146. // / \ / \__| | _|__|
  147. // \ \/\/ / | |/ / |
  148. // \ /| | <| |
  149. // \__/\ / |__|__|_ \__|
  150. // \/ \/
  151. // ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.
  152. type ErrWikiAlreadyExist struct {
  153. Title string
  154. }
  155. // IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
  156. func IsErrWikiAlreadyExist(err error) bool {
  157. _, ok := err.(ErrWikiAlreadyExist)
  158. return ok
  159. }
  160. func (err ErrWikiAlreadyExist) Error() string {
  161. return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
  162. }
  163. // ErrWikiReservedName represents a reserved name error.
  164. type ErrWikiReservedName struct {
  165. Title string
  166. }
  167. // IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
  168. func IsErrWikiReservedName(err error) bool {
  169. _, ok := err.(ErrWikiReservedName)
  170. return ok
  171. }
  172. func (err ErrWikiReservedName) Error() string {
  173. return fmt.Sprintf("wiki title is reserved: %s", err.Title)
  174. }
  175. // ErrWikiInvalidFileName represents an invalid wiki file name.
  176. type ErrWikiInvalidFileName struct {
  177. FileName string
  178. }
  179. // IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
  180. func IsErrWikiInvalidFileName(err error) bool {
  181. _, ok := err.(ErrWikiInvalidFileName)
  182. return ok
  183. }
  184. func (err ErrWikiInvalidFileName) Error() string {
  185. return fmt.Sprintf("Invalid wiki filename: %s", err.FileName)
  186. }
  187. // __________ ___. .__ .__ ____ __.
  188. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__.
  189. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | |
  190. // | | | | / \_\ \ |_| \ \___ | | \ ___/\___ |
  191. // |____| |____/|___ /____/__|\___ > |____|__ \___ > ____|
  192. // \/ \/ \/ \/\/
  193. // ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error.
  194. type ErrKeyUnableVerify struct {
  195. Result string
  196. }
  197. // IsErrKeyUnableVerify checks if an error is a ErrKeyUnableVerify.
  198. func IsErrKeyUnableVerify(err error) bool {
  199. _, ok := err.(ErrKeyUnableVerify)
  200. return ok
  201. }
  202. func (err ErrKeyUnableVerify) Error() string {
  203. return fmt.Sprintf("Unable to verify key content [result: %s]", err.Result)
  204. }
  205. // ErrKeyNotExist represents a "KeyNotExist" kind of error.
  206. type ErrKeyNotExist struct {
  207. ID int64
  208. }
  209. // IsErrKeyNotExist checks if an error is a ErrKeyNotExist.
  210. func IsErrKeyNotExist(err error) bool {
  211. _, ok := err.(ErrKeyNotExist)
  212. return ok
  213. }
  214. func (err ErrKeyNotExist) Error() string {
  215. return fmt.Sprintf("public key does not exist [id: %d]", err.ID)
  216. }
  217. // ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error.
  218. type ErrKeyAlreadyExist struct {
  219. OwnerID int64
  220. Fingerprint string
  221. Content string
  222. }
  223. // IsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist.
  224. func IsErrKeyAlreadyExist(err error) bool {
  225. _, ok := err.(ErrKeyAlreadyExist)
  226. return ok
  227. }
  228. func (err ErrKeyAlreadyExist) Error() string {
  229. return fmt.Sprintf("public key already exists [owner_id: %d, finter_print: %s, content: %s]",
  230. err.OwnerID, err.Fingerprint, err.Content)
  231. }
  232. // ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error.
  233. type ErrKeyNameAlreadyUsed struct {
  234. OwnerID int64
  235. Name string
  236. }
  237. // IsErrKeyNameAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  238. func IsErrKeyNameAlreadyUsed(err error) bool {
  239. _, ok := err.(ErrKeyNameAlreadyUsed)
  240. return ok
  241. }
  242. func (err ErrKeyNameAlreadyUsed) Error() string {
  243. return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name)
  244. }
  245. // ErrGPGNoEmailFound represents a "ErrGPGNoEmailFound" kind of error.
  246. type ErrGPGNoEmailFound struct {
  247. FailedEmails []string
  248. }
  249. // IsErrGPGNoEmailFound checks if an error is a ErrGPGNoEmailFound.
  250. func IsErrGPGNoEmailFound(err error) bool {
  251. _, ok := err.(ErrGPGNoEmailFound)
  252. return ok
  253. }
  254. func (err ErrGPGNoEmailFound) Error() string {
  255. return fmt.Sprintf("none of the emails attached to the GPG key could be found: %v", err.FailedEmails)
  256. }
  257. // ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error.
  258. type ErrGPGKeyParsing struct {
  259. ParseError error
  260. }
  261. // IsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing.
  262. func IsErrGPGKeyParsing(err error) bool {
  263. _, ok := err.(ErrGPGKeyParsing)
  264. return ok
  265. }
  266. func (err ErrGPGKeyParsing) Error() string {
  267. return fmt.Sprintf("failed to parse gpg key %s", err.ParseError.Error())
  268. }
  269. // ErrGPGKeyNotExist represents a "GPGKeyNotExist" kind of error.
  270. type ErrGPGKeyNotExist struct {
  271. ID int64
  272. }
  273. // IsErrGPGKeyNotExist checks if an error is a ErrGPGKeyNotExist.
  274. func IsErrGPGKeyNotExist(err error) bool {
  275. _, ok := err.(ErrGPGKeyNotExist)
  276. return ok
  277. }
  278. func (err ErrGPGKeyNotExist) Error() string {
  279. return fmt.Sprintf("public gpg key does not exist [id: %d]", err.ID)
  280. }
  281. // ErrGPGKeyIDAlreadyUsed represents a "GPGKeyIDAlreadyUsed" kind of error.
  282. type ErrGPGKeyIDAlreadyUsed struct {
  283. KeyID string
  284. }
  285. // IsErrGPGKeyIDAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  286. func IsErrGPGKeyIDAlreadyUsed(err error) bool {
  287. _, ok := err.(ErrGPGKeyIDAlreadyUsed)
  288. return ok
  289. }
  290. func (err ErrGPGKeyIDAlreadyUsed) Error() string {
  291. return fmt.Sprintf("public key already exists [key_id: %s]", err.KeyID)
  292. }
  293. // ErrGPGKeyAccessDenied represents a "GPGKeyAccessDenied" kind of Error.
  294. type ErrGPGKeyAccessDenied struct {
  295. UserID int64
  296. KeyID int64
  297. }
  298. // IsErrGPGKeyAccessDenied checks if an error is a ErrGPGKeyAccessDenied.
  299. func IsErrGPGKeyAccessDenied(err error) bool {
  300. _, ok := err.(ErrGPGKeyAccessDenied)
  301. return ok
  302. }
  303. // Error pretty-prints an error of type ErrGPGKeyAccessDenied.
  304. func (err ErrGPGKeyAccessDenied) Error() string {
  305. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d]",
  306. err.UserID, err.KeyID)
  307. }
  308. // ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error.
  309. type ErrKeyAccessDenied struct {
  310. UserID int64
  311. KeyID int64
  312. Note string
  313. }
  314. // IsErrKeyAccessDenied checks if an error is a ErrKeyAccessDenied.
  315. func IsErrKeyAccessDenied(err error) bool {
  316. _, ok := err.(ErrKeyAccessDenied)
  317. return ok
  318. }
  319. func (err ErrKeyAccessDenied) Error() string {
  320. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
  321. err.UserID, err.KeyID, err.Note)
  322. }
  323. // ErrDeployKeyNotExist represents a "DeployKeyNotExist" kind of error.
  324. type ErrDeployKeyNotExist struct {
  325. ID int64
  326. KeyID int64
  327. RepoID int64
  328. }
  329. // IsErrDeployKeyNotExist checks if an error is a ErrDeployKeyNotExist.
  330. func IsErrDeployKeyNotExist(err error) bool {
  331. _, ok := err.(ErrDeployKeyNotExist)
  332. return ok
  333. }
  334. func (err ErrDeployKeyNotExist) Error() string {
  335. return fmt.Sprintf("Deploy key does not exist [id: %d, key_id: %d, repo_id: %d]", err.ID, err.KeyID, err.RepoID)
  336. }
  337. // ErrDeployKeyAlreadyExist represents a "DeployKeyAlreadyExist" kind of error.
  338. type ErrDeployKeyAlreadyExist struct {
  339. KeyID int64
  340. RepoID int64
  341. }
  342. // IsErrDeployKeyAlreadyExist checks if an error is a ErrDeployKeyAlreadyExist.
  343. func IsErrDeployKeyAlreadyExist(err error) bool {
  344. _, ok := err.(ErrDeployKeyAlreadyExist)
  345. return ok
  346. }
  347. func (err ErrDeployKeyAlreadyExist) Error() string {
  348. return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID)
  349. }
  350. // ErrDeployKeyNameAlreadyUsed represents a "DeployKeyNameAlreadyUsed" kind of error.
  351. type ErrDeployKeyNameAlreadyUsed struct {
  352. RepoID int64
  353. Name string
  354. }
  355. // IsErrDeployKeyNameAlreadyUsed checks if an error is a ErrDeployKeyNameAlreadyUsed.
  356. func IsErrDeployKeyNameAlreadyUsed(err error) bool {
  357. _, ok := err.(ErrDeployKeyNameAlreadyUsed)
  358. return ok
  359. }
  360. func (err ErrDeployKeyNameAlreadyUsed) Error() string {
  361. return fmt.Sprintf("public key already exists [repo_id: %d, name: %s]", err.RepoID, err.Name)
  362. }
  363. // _____ ___________ __
  364. // / _ \ ____ ____ ____ ______ _____\__ ___/___ | | __ ____ ____
  365. // / /_\ \_/ ___\/ ___\/ __ \ / ___// ___/ | | / _ \| |/ // __ \ / \
  366. // / | \ \__\ \__\ ___/ \___ \ \___ \ | |( <_> ) <\ ___/| | \
  367. // \____|__ /\___ >___ >___ >____ >____ > |____| \____/|__|_ \\___ >___| /
  368. // \/ \/ \/ \/ \/ \/ \/ \/ \/
  369. // ErrAccessTokenNotExist represents a "AccessTokenNotExist" kind of error.
  370. type ErrAccessTokenNotExist struct {
  371. SHA string
  372. }
  373. // IsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.
  374. func IsErrAccessTokenNotExist(err error) bool {
  375. _, ok := err.(ErrAccessTokenNotExist)
  376. return ok
  377. }
  378. func (err ErrAccessTokenNotExist) Error() string {
  379. return fmt.Sprintf("access token does not exist [sha: %s]", err.SHA)
  380. }
  381. // ErrAccessTokenEmpty represents a "AccessTokenEmpty" kind of error.
  382. type ErrAccessTokenEmpty struct {
  383. }
  384. // IsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.
  385. func IsErrAccessTokenEmpty(err error) bool {
  386. _, ok := err.(ErrAccessTokenEmpty)
  387. return ok
  388. }
  389. func (err ErrAccessTokenEmpty) Error() string {
  390. return fmt.Sprintf("access token is empty")
  391. }
  392. // ________ .__ __ .__
  393. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  394. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  395. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  396. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  397. // \/ /_____/ \/ \/ \/ \/ \/
  398. // ErrOrgNotExist represents a "OrgNotExist" kind of error.
  399. type ErrOrgNotExist struct {
  400. ID int64
  401. Name string
  402. }
  403. // IsErrOrgNotExist checks if an error is a ErrOrgNotExist.
  404. func IsErrOrgNotExist(err error) bool {
  405. _, ok := err.(ErrOrgNotExist)
  406. return ok
  407. }
  408. func (err ErrOrgNotExist) Error() string {
  409. return fmt.Sprintf("org does not exist [id: %d, name: %s]", err.ID, err.Name)
  410. }
  411. // ErrLastOrgOwner represents a "LastOrgOwner" kind of error.
  412. type ErrLastOrgOwner struct {
  413. UID int64
  414. }
  415. // IsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.
  416. func IsErrLastOrgOwner(err error) bool {
  417. _, ok := err.(ErrLastOrgOwner)
  418. return ok
  419. }
  420. func (err ErrLastOrgOwner) Error() string {
  421. return fmt.Sprintf("user is the last member of owner team [uid: %d]", err.UID)
  422. }
  423. //.____ ____________________
  424. //| | \_ _____/ _____/
  425. //| | | __) \_____ \
  426. //| |___| \ / \
  427. //|_______ \___ / /_______ /
  428. // \/ \/ \/
  429. // ErrLFSLockNotExist represents a "LFSLockNotExist" kind of error.
  430. type ErrLFSLockNotExist struct {
  431. ID int64
  432. RepoID int64
  433. Path string
  434. }
  435. // IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
  436. func IsErrLFSLockNotExist(err error) bool {
  437. _, ok := err.(ErrLFSLockNotExist)
  438. return ok
  439. }
  440. func (err ErrLFSLockNotExist) Error() string {
  441. return fmt.Sprintf("lfs lock does not exist [id: %d, rid: %d, path: %s]", err.ID, err.RepoID, err.Path)
  442. }
  443. // ErrLFSUnauthorizedAction represents a "LFSUnauthorizedAction" kind of error.
  444. type ErrLFSUnauthorizedAction struct {
  445. RepoID int64
  446. UserName string
  447. Mode AccessMode
  448. }
  449. // IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
  450. func IsErrLFSUnauthorizedAction(err error) bool {
  451. _, ok := err.(ErrLFSUnauthorizedAction)
  452. return ok
  453. }
  454. func (err ErrLFSUnauthorizedAction) Error() string {
  455. if err.Mode == AccessModeWrite {
  456. return fmt.Sprintf("User %s doesn't have write access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  457. }
  458. return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  459. }
  460. // ErrLFSLockAlreadyExist represents a "LFSLockAlreadyExist" kind of error.
  461. type ErrLFSLockAlreadyExist struct {
  462. RepoID int64
  463. Path string
  464. }
  465. // IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
  466. func IsErrLFSLockAlreadyExist(err error) bool {
  467. _, ok := err.(ErrLFSLockAlreadyExist)
  468. return ok
  469. }
  470. func (err ErrLFSLockAlreadyExist) Error() string {
  471. return fmt.Sprintf("lfs lock already exists [rid: %d, path: %s]", err.RepoID, err.Path)
  472. }
  473. // __________ .__ __
  474. // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
  475. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
  476. // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
  477. // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
  478. // \/ \/|__| \/ \/
  479. // ErrRepoNotExist represents a "RepoNotExist" kind of error.
  480. type ErrRepoNotExist struct {
  481. ID int64
  482. UID int64
  483. OwnerName string
  484. Name string
  485. }
  486. // IsErrRepoNotExist checks if an error is a ErrRepoNotExist.
  487. func IsErrRepoNotExist(err error) bool {
  488. _, ok := err.(ErrRepoNotExist)
  489. return ok
  490. }
  491. func (err ErrRepoNotExist) Error() string {
  492. return fmt.Sprintf("repository does not exist [id: %d, uid: %d, owner_name: %s, name: %s]",
  493. err.ID, err.UID, err.OwnerName, err.Name)
  494. }
  495. // ErrRepoAlreadyExist represents a "RepoAlreadyExist" kind of error.
  496. type ErrRepoAlreadyExist struct {
  497. Uname string
  498. Name string
  499. }
  500. // IsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.
  501. func IsErrRepoAlreadyExist(err error) bool {
  502. _, ok := err.(ErrRepoAlreadyExist)
  503. return ok
  504. }
  505. func (err ErrRepoAlreadyExist) Error() string {
  506. return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
  507. }
  508. // ErrRepoRedirectNotExist represents a "RepoRedirectNotExist" kind of error.
  509. type ErrRepoRedirectNotExist struct {
  510. OwnerID int64
  511. RepoName string
  512. }
  513. // IsErrRepoRedirectNotExist check if an error is an ErrRepoRedirectNotExist
  514. func IsErrRepoRedirectNotExist(err error) bool {
  515. _, ok := err.(ErrRepoRedirectNotExist)
  516. return ok
  517. }
  518. func (err ErrRepoRedirectNotExist) Error() string {
  519. return fmt.Sprintf("repository redirect does not exist [uid: %d, name: %s]", err.OwnerID, err.RepoName)
  520. }
  521. // ErrInvalidCloneAddr represents a "InvalidCloneAddr" kind of error.
  522. type ErrInvalidCloneAddr struct {
  523. IsURLError bool
  524. IsInvalidPath bool
  525. IsPermissionDenied bool
  526. }
  527. // IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.
  528. func IsErrInvalidCloneAddr(err error) bool {
  529. _, ok := err.(ErrInvalidCloneAddr)
  530. return ok
  531. }
  532. func (err ErrInvalidCloneAddr) Error() string {
  533. return fmt.Sprintf("invalid clone address [is_url_error: %v, is_invalid_path: %v, is_permission_denied: %v]",
  534. err.IsURLError, err.IsInvalidPath, err.IsPermissionDenied)
  535. }
  536. // ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error.
  537. type ErrUpdateTaskNotExist struct {
  538. UUID string
  539. }
  540. // IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.
  541. func IsErrUpdateTaskNotExist(err error) bool {
  542. _, ok := err.(ErrUpdateTaskNotExist)
  543. return ok
  544. }
  545. func (err ErrUpdateTaskNotExist) Error() string {
  546. return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
  547. }
  548. // ErrReleaseAlreadyExist represents a "ReleaseAlreadyExist" kind of error.
  549. type ErrReleaseAlreadyExist struct {
  550. TagName string
  551. }
  552. // IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.
  553. func IsErrReleaseAlreadyExist(err error) bool {
  554. _, ok := err.(ErrReleaseAlreadyExist)
  555. return ok
  556. }
  557. func (err ErrReleaseAlreadyExist) Error() string {
  558. return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
  559. }
  560. // ErrReleaseNotExist represents a "ReleaseNotExist" kind of error.
  561. type ErrReleaseNotExist struct {
  562. ID int64
  563. TagName string
  564. }
  565. // IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.
  566. func IsErrReleaseNotExist(err error) bool {
  567. _, ok := err.(ErrReleaseNotExist)
  568. return ok
  569. }
  570. func (err ErrReleaseNotExist) Error() string {
  571. return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
  572. }
  573. // ErrInvalidTagName represents a "InvalidTagName" kind of error.
  574. type ErrInvalidTagName struct {
  575. TagName string
  576. }
  577. // IsErrInvalidTagName checks if an error is a ErrInvalidTagName.
  578. func IsErrInvalidTagName(err error) bool {
  579. _, ok := err.(ErrInvalidTagName)
  580. return ok
  581. }
  582. func (err ErrInvalidTagName) Error() string {
  583. return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
  584. }
  585. // ErrRepoFileAlreadyExist represents a "RepoFileAlreadyExist" kind of error.
  586. type ErrRepoFileAlreadyExist struct {
  587. FileName string
  588. }
  589. // IsErrRepoFileAlreadyExist checks if an error is a ErrRepoFileAlreadyExist.
  590. func IsErrRepoFileAlreadyExist(err error) bool {
  591. _, ok := err.(ErrRepoFileAlreadyExist)
  592. return ok
  593. }
  594. func (err ErrRepoFileAlreadyExist) Error() string {
  595. return fmt.Sprintf("repository file already exists [file_name: %s]", err.FileName)
  596. }
  597. // ErrUserDoesNotHaveAccessToRepo represets an error where the user doesn't has access to a given repo
  598. type ErrUserDoesNotHaveAccessToRepo struct {
  599. UserID int64
  600. RepoName string
  601. }
  602. // IsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrRepoFileAlreadyExist.
  603. func IsErrUserDoesNotHaveAccessToRepo(err error) bool {
  604. _, ok := err.(ErrUserDoesNotHaveAccessToRepo)
  605. return ok
  606. }
  607. func (err ErrUserDoesNotHaveAccessToRepo) Error() string {
  608. return fmt.Sprintf("user doesn't have acces to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName)
  609. }
  610. // __________ .__
  611. // \______ \____________ ____ ____ | |__
  612. // | | _/\_ __ \__ \ / \_/ ___\| | \
  613. // | | \ | | \// __ \| | \ \___| Y \
  614. // |______ / |__| (____ /___| /\___ >___| /
  615. // \/ \/ \/ \/ \/
  616. // ErrBranchNotExist represents a "BranchNotExist" kind of error.
  617. type ErrBranchNotExist struct {
  618. Name string
  619. }
  620. // IsErrBranchNotExist checks if an error is a ErrBranchNotExist.
  621. func IsErrBranchNotExist(err error) bool {
  622. _, ok := err.(ErrBranchNotExist)
  623. return ok
  624. }
  625. func (err ErrBranchNotExist) Error() string {
  626. return fmt.Sprintf("branch does not exist [name: %s]", err.Name)
  627. }
  628. // ErrBranchAlreadyExists represents an error that branch with such name already exists
  629. type ErrBranchAlreadyExists struct {
  630. BranchName string
  631. }
  632. // IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.
  633. func IsErrBranchAlreadyExists(err error) bool {
  634. _, ok := err.(ErrBranchAlreadyExists)
  635. return ok
  636. }
  637. func (err ErrBranchAlreadyExists) Error() string {
  638. return fmt.Sprintf("branch already exists [name: %s]", err.BranchName)
  639. }
  640. // ErrBranchNameConflict represents an error that branch name conflicts with other branch
  641. type ErrBranchNameConflict struct {
  642. BranchName string
  643. }
  644. // IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.
  645. func IsErrBranchNameConflict(err error) bool {
  646. _, ok := err.(ErrBranchNameConflict)
  647. return ok
  648. }
  649. func (err ErrBranchNameConflict) Error() string {
  650. return fmt.Sprintf("branch conflicts with existing branch [name: %s]", err.BranchName)
  651. }
  652. // ErrNotAllowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it
  653. type ErrNotAllowedToMerge struct {
  654. Reason string
  655. }
  656. // IsErrNotAllowedToMerge checks if an error is an ErrNotAllowedToMerge.
  657. func IsErrNotAllowedToMerge(err error) bool {
  658. _, ok := err.(ErrNotAllowedToMerge)
  659. return ok
  660. }
  661. func (err ErrNotAllowedToMerge) Error() string {
  662. return fmt.Sprintf("not allowed to merge [reason: %s]", err.Reason)
  663. }
  664. // ErrTagAlreadyExists represents an error that tag with such name already exists
  665. type ErrTagAlreadyExists struct {
  666. TagName string
  667. }
  668. // IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.
  669. func IsErrTagAlreadyExists(err error) bool {
  670. _, ok := err.(ErrTagAlreadyExists)
  671. return ok
  672. }
  673. func (err ErrTagAlreadyExists) Error() string {
  674. return fmt.Sprintf("tag already exists [name: %s]", err.TagName)
  675. }
  676. // __ __ ___. .__ __
  677. // / \ / \ ____\_ |__ | |__ ____ ____ | | __
  678. // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
  679. // \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
  680. // \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
  681. // \/ \/ \/ \/ \/
  682. // ErrWebhookNotExist represents a "WebhookNotExist" kind of error.
  683. type ErrWebhookNotExist struct {
  684. ID int64
  685. }
  686. // IsErrWebhookNotExist checks if an error is a ErrWebhookNotExist.
  687. func IsErrWebhookNotExist(err error) bool {
  688. _, ok := err.(ErrWebhookNotExist)
  689. return ok
  690. }
  691. func (err ErrWebhookNotExist) Error() string {
  692. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  693. }
  694. // .___
  695. // | | ______ ________ __ ____
  696. // | |/ ___// ___/ | \_/ __ \
  697. // | |\___ \ \___ \| | /\ ___/
  698. // |___/____ >____ >____/ \___ >
  699. // \/ \/ \/
  700. // ErrIssueNotExist represents a "IssueNotExist" kind of error.
  701. type ErrIssueNotExist struct {
  702. ID int64
  703. RepoID int64
  704. Index int64
  705. }
  706. // IsErrIssueNotExist checks if an error is a ErrIssueNotExist.
  707. func IsErrIssueNotExist(err error) bool {
  708. _, ok := err.(ErrIssueNotExist)
  709. return ok
  710. }
  711. func (err ErrIssueNotExist) Error() string {
  712. return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  713. }
  714. // __________ .__ .__ __________ __
  715. // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
  716. // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
  717. // | | | | / |_| |_| | \ ___< <_| | | /\ ___/ \___ \ | |
  718. // |____| |____/|____/____/____|_ /\___ >__ |____/ \___ >____ > |__|
  719. // \/ \/ |__| \/ \/
  720. // ErrPullRequestNotExist represents a "PullRequestNotExist" kind of error.
  721. type ErrPullRequestNotExist struct {
  722. ID int64
  723. IssueID int64
  724. HeadRepoID int64
  725. BaseRepoID int64
  726. HeadBranch string
  727. BaseBranch string
  728. }
  729. // IsErrPullRequestNotExist checks if an error is a ErrPullRequestNotExist.
  730. func IsErrPullRequestNotExist(err error) bool {
  731. _, ok := err.(ErrPullRequestNotExist)
  732. return ok
  733. }
  734. func (err ErrPullRequestNotExist) Error() string {
  735. 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]",
  736. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  737. }
  738. // ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
  739. type ErrPullRequestAlreadyExists struct {
  740. ID int64
  741. IssueID int64
  742. HeadRepoID int64
  743. BaseRepoID int64
  744. HeadBranch string
  745. BaseBranch string
  746. }
  747. // IsErrPullRequestAlreadyExists checks if an error is a ErrPullRequestAlreadyExists.
  748. func IsErrPullRequestAlreadyExists(err error) bool {
  749. _, ok := err.(ErrPullRequestAlreadyExists)
  750. return ok
  751. }
  752. // Error does pretty-printing :D
  753. func (err ErrPullRequestAlreadyExists) Error() string {
  754. 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]",
  755. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  756. }
  757. // ErrInvalidMergeStyle represents an error if merging with disabled merge strategy
  758. type ErrInvalidMergeStyle struct {
  759. ID int64
  760. Style MergeStyle
  761. }
  762. // IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.
  763. func IsErrInvalidMergeStyle(err error) bool {
  764. _, ok := err.(ErrInvalidMergeStyle)
  765. return ok
  766. }
  767. func (err ErrInvalidMergeStyle) Error() string {
  768. return fmt.Sprintf("merge strategy is not allowed or is invalid [repo_id: %d, strategy: %s]",
  769. err.ID, err.Style)
  770. }
  771. // _________ __
  772. // \_ ___ \ ____ _____ _____ ____ _____/ |_
  773. // / \ \/ / _ \ / \ / \_/ __ \ / \ __\
  774. // \ \___( <_> ) Y Y \ Y Y \ ___/| | \ |
  775. // \______ /\____/|__|_| /__|_| /\___ >___| /__|
  776. // \/ \/ \/ \/ \/
  777. // ErrCommentNotExist represents a "CommentNotExist" kind of error.
  778. type ErrCommentNotExist struct {
  779. ID int64
  780. IssueID int64
  781. }
  782. // IsErrCommentNotExist checks if an error is a ErrCommentNotExist.
  783. func IsErrCommentNotExist(err error) bool {
  784. _, ok := err.(ErrCommentNotExist)
  785. return ok
  786. }
  787. func (err ErrCommentNotExist) Error() string {
  788. return fmt.Sprintf("comment does not exist [id: %d, issue_id: %d]", err.ID, err.IssueID)
  789. }
  790. // _________ __ __ .__
  791. // / _____// |_ ____ ________ _ _______ _/ |_ ____ | |__
  792. // \_____ \\ __\/ _ \\____ \ \/ \/ /\__ \\ __\/ ___\| | \
  793. // / \| | ( <_> ) |_> > / / __ \| | \ \___| Y \
  794. // /_______ /|__| \____/| __/ \/\_/ (____ /__| \___ >___| /
  795. // \/ |__| \/ \/ \/
  796. // ErrStopwatchNotExist represents a "Stopwatch Not Exist" kind of error.
  797. type ErrStopwatchNotExist struct {
  798. ID int64
  799. }
  800. // IsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.
  801. func IsErrStopwatchNotExist(err error) bool {
  802. _, ok := err.(ErrStopwatchNotExist)
  803. return ok
  804. }
  805. func (err ErrStopwatchNotExist) Error() string {
  806. return fmt.Sprintf("stopwatch does not exist [id: %d]", err.ID)
  807. }
  808. // ___________ __ .______________.__
  809. // \__ ___/___________ ____ | | __ ____ __| _/\__ ___/|__| _____ ____
  810. // | | \_ __ \__ \ _/ ___\| |/ // __ \ / __ | | | | |/ \_/ __ \
  811. // | | | | \// __ \\ \___| <\ ___// /_/ | | | | | Y Y \ ___/
  812. // |____| |__| (____ /\___ >__|_ \\___ >____ | |____| |__|__|_| /\___ >
  813. // \/ \/ \/ \/ \/ \/ \/
  814. // ErrTrackedTimeNotExist represents a "TrackedTime Not Exist" kind of error.
  815. type ErrTrackedTimeNotExist struct {
  816. ID int64
  817. }
  818. // IsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.
  819. func IsErrTrackedTimeNotExist(err error) bool {
  820. _, ok := err.(ErrTrackedTimeNotExist)
  821. return ok
  822. }
  823. func (err ErrTrackedTimeNotExist) Error() string {
  824. return fmt.Sprintf("tracked time does not exist [id: %d]", err.ID)
  825. }
  826. // .____ ___. .__
  827. // | | _____ \_ |__ ____ | |
  828. // | | \__ \ | __ \_/ __ \| |
  829. // | |___ / __ \| \_\ \ ___/| |__
  830. // |_______ (____ /___ /\___ >____/
  831. // \/ \/ \/ \/
  832. // ErrLabelNotExist represents a "LabelNotExist" kind of error.
  833. type ErrLabelNotExist struct {
  834. LabelID int64
  835. RepoID int64
  836. }
  837. // IsErrLabelNotExist checks if an error is a ErrLabelNotExist.
  838. func IsErrLabelNotExist(err error) bool {
  839. _, ok := err.(ErrLabelNotExist)
  840. return ok
  841. }
  842. func (err ErrLabelNotExist) Error() string {
  843. return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID)
  844. }
  845. // _____ .__.__ __
  846. // / \ |__| | ____ _______/ |_ ____ ____ ____
  847. // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
  848. // / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
  849. // \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
  850. // \/ \/ \/ \/ \/
  851. // ErrMilestoneNotExist represents a "MilestoneNotExist" kind of error.
  852. type ErrMilestoneNotExist struct {
  853. ID int64
  854. RepoID int64
  855. }
  856. // IsErrMilestoneNotExist checks if an error is a ErrMilestoneNotExist.
  857. func IsErrMilestoneNotExist(err error) bool {
  858. _, ok := err.(ErrMilestoneNotExist)
  859. return ok
  860. }
  861. func (err ErrMilestoneNotExist) Error() string {
  862. return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID)
  863. }
  864. // _____ __ __ .__ __
  865. // / _ \_/ |__/ |______ ____ | |__ _____ ____ _____/ |_
  866. // / /_\ \ __\ __\__ \ _/ ___\| | \ / \_/ __ \ / \ __\
  867. // / | \ | | | / __ \\ \___| Y \ Y Y \ ___/| | \ |
  868. // \____|__ /__| |__| (____ /\___ >___| /__|_| /\___ >___| /__|
  869. // \/ \/ \/ \/ \/ \/ \/
  870. // ErrAttachmentNotExist represents a "AttachmentNotExist" kind of error.
  871. type ErrAttachmentNotExist struct {
  872. ID int64
  873. UUID string
  874. }
  875. // IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
  876. func IsErrAttachmentNotExist(err error) bool {
  877. _, ok := err.(ErrAttachmentNotExist)
  878. return ok
  879. }
  880. func (err ErrAttachmentNotExist) Error() string {
  881. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  882. }
  883. // .____ .__ _________
  884. // | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____
  885. // | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \
  886. // | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/
  887. // |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ >
  888. // \/ /_____/ \/ \/ \/ \/
  889. // ErrLoginSourceNotExist represents a "LoginSourceNotExist" kind of error.
  890. type ErrLoginSourceNotExist struct {
  891. ID int64
  892. }
  893. // IsErrLoginSourceNotExist checks if an error is a ErrLoginSourceNotExist.
  894. func IsErrLoginSourceNotExist(err error) bool {
  895. _, ok := err.(ErrLoginSourceNotExist)
  896. return ok
  897. }
  898. func (err ErrLoginSourceNotExist) Error() string {
  899. return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
  900. }
  901. // ErrLoginSourceAlreadyExist represents a "LoginSourceAlreadyExist" kind of error.
  902. type ErrLoginSourceAlreadyExist struct {
  903. Name string
  904. }
  905. // IsErrLoginSourceAlreadyExist checks if an error is a ErrLoginSourceAlreadyExist.
  906. func IsErrLoginSourceAlreadyExist(err error) bool {
  907. _, ok := err.(ErrLoginSourceAlreadyExist)
  908. return ok
  909. }
  910. func (err ErrLoginSourceAlreadyExist) Error() string {
  911. return fmt.Sprintf("login source already exists [name: %s]", err.Name)
  912. }
  913. // ErrLoginSourceInUse represents a "LoginSourceInUse" kind of error.
  914. type ErrLoginSourceInUse struct {
  915. ID int64
  916. }
  917. // IsErrLoginSourceInUse checks if an error is a ErrLoginSourceInUse.
  918. func IsErrLoginSourceInUse(err error) bool {
  919. _, ok := err.(ErrLoginSourceInUse)
  920. return ok
  921. }
  922. func (err ErrLoginSourceInUse) Error() string {
  923. return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
  924. }
  925. // ___________
  926. // \__ ___/___ _____ _____
  927. // | |_/ __ \\__ \ / \
  928. // | |\ ___/ / __ \| Y Y \
  929. // |____| \___ >____ /__|_| /
  930. // \/ \/ \/
  931. // ErrTeamAlreadyExist represents a "TeamAlreadyExist" kind of error.
  932. type ErrTeamAlreadyExist struct {
  933. OrgID int64
  934. Name string
  935. }
  936. // IsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.
  937. func IsErrTeamAlreadyExist(err error) bool {
  938. _, ok := err.(ErrTeamAlreadyExist)
  939. return ok
  940. }
  941. func (err ErrTeamAlreadyExist) Error() string {
  942. return fmt.Sprintf("team already exists [org_id: %d, name: %s]", err.OrgID, err.Name)
  943. }
  944. //
  945. // Two-factor authentication
  946. //
  947. // ErrTwoFactorNotEnrolled indicates that a user is not enrolled in two-factor authentication.
  948. type ErrTwoFactorNotEnrolled struct {
  949. UID int64
  950. }
  951. // IsErrTwoFactorNotEnrolled checks if an error is a ErrTwoFactorNotEnrolled.
  952. func IsErrTwoFactorNotEnrolled(err error) bool {
  953. _, ok := err.(ErrTwoFactorNotEnrolled)
  954. return ok
  955. }
  956. func (err ErrTwoFactorNotEnrolled) Error() string {
  957. return fmt.Sprintf("user not enrolled in 2FA [uid: %d]", err.UID)
  958. }
  959. // ____ ___ .__ .___
  960. // | | \______ | | _________ __| _/
  961. // | | /\____ \| | / _ \__ \ / __ |
  962. // | | / | |_> > |_( <_> ) __ \_/ /_/ |
  963. // |______/ | __/|____/\____(____ /\____ |
  964. // |__| \/ \/
  965. //
  966. // ErrUploadNotExist represents a "UploadNotExist" kind of error.
  967. type ErrUploadNotExist struct {
  968. ID int64
  969. UUID string
  970. }
  971. // IsErrUploadNotExist checks if an error is a ErrUploadNotExist.
  972. func IsErrUploadNotExist(err error) bool {
  973. _, ok := err.(ErrAttachmentNotExist)
  974. return ok
  975. }
  976. func (err ErrUploadNotExist) Error() string {
  977. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  978. }
  979. // ___________ __ .__ .____ .__ ____ ___
  980. // \_ _____/__ ____/ |_ ___________ ____ _____ | | | | ____ ____ |__| ____ | | \______ ___________
  981. // | __)_\ \/ /\ __\/ __ \_ __ \/ \\__ \ | | | | / _ \ / ___\| |/ \ | | / ___// __ \_ __ \
  982. // | \> < | | \ ___/| | \/ | \/ __ \| |__ | |__( <_> ) /_/ > | | \ | | /\___ \\ ___/| | \/
  983. // /_______ /__/\_ \ |__| \___ >__| |___| (____ /____/ |_______ \____/\___ /|__|___| / |______//____ >\___ >__|
  984. // \/ \/ \/ \/ \/ \/ /_____/ \/ \/ \/
  985. // ErrExternalLoginUserAlreadyExist represents a "ExternalLoginUserAlreadyExist" kind of error.
  986. type ErrExternalLoginUserAlreadyExist struct {
  987. ExternalID string
  988. UserID int64
  989. LoginSourceID int64
  990. }
  991. // IsErrExternalLoginUserAlreadyExist checks if an error is a ExternalLoginUserAlreadyExist.
  992. func IsErrExternalLoginUserAlreadyExist(err error) bool {
  993. _, ok := err.(ErrExternalLoginUserAlreadyExist)
  994. return ok
  995. }
  996. func (err ErrExternalLoginUserAlreadyExist) Error() string {
  997. return fmt.Sprintf("external login user already exists [externalID: %s, userID: %d, loginSourceID: %d]", err.ExternalID, err.UserID, err.LoginSourceID)
  998. }
  999. // ErrExternalLoginUserNotExist represents a "ExternalLoginUserNotExist" kind of error.
  1000. type ErrExternalLoginUserNotExist struct {
  1001. UserID int64
  1002. LoginSourceID int64
  1003. }
  1004. // IsErrExternalLoginUserNotExist checks if an error is a ExternalLoginUserNotExist.
  1005. func IsErrExternalLoginUserNotExist(err error) bool {
  1006. _, ok := err.(ErrExternalLoginUserNotExist)
  1007. return ok
  1008. }
  1009. func (err ErrExternalLoginUserNotExist) Error() string {
  1010. return fmt.Sprintf("external login user link does not exists [userID: %d, loginSourceID: %d]", err.UserID, err.LoginSourceID)
  1011. }
  1012. // ____ ________________________________ .__ __ __ .__
  1013. // | | \_____ \_ _____/\______ \ ____ ____ |__| _______/ |_____________ _/ |_|__| ____ ____
  1014. // | | // ____/| __) | _// __ \ / ___\| |/ ___/\ __\_ __ \__ \\ __\ |/ _ \ / \
  1015. // | | // \| \ | | \ ___// /_/ > |\___ \ | | | | \// __ \| | | ( <_> ) | \
  1016. // |______/ \_______ \___ / |____|_ /\___ >___ /|__/____ > |__| |__| (____ /__| |__|\____/|___| /
  1017. // \/ \/ \/ \/_____/ \/ \/ \/
  1018. // ErrU2FRegistrationNotExist represents a "ErrU2FRegistrationNotExist" kind of error.
  1019. type ErrU2FRegistrationNotExist struct {
  1020. ID int64
  1021. }
  1022. func (err ErrU2FRegistrationNotExist) Error() string {
  1023. return fmt.Sprintf("U2F registration does not exist [id: %d]", err.ID)
  1024. }
  1025. // IsErrU2FRegistrationNotExist checks if an error is a ErrU2FRegistrationNotExist.
  1026. func IsErrU2FRegistrationNotExist(err error) bool {
  1027. _, ok := err.(ErrU2FRegistrationNotExist)
  1028. return ok
  1029. }