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.

1606 lines
49 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
Squashed commit of the following: commit 0afcb843d7ffd596991c4885cab768273a6eb42c Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 17:13:29 2016 -0600 Removed Upload stats as the upload table is just a temporary table commit 7ecd73ff5535612d79d471409173ee7f1fcfa157 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:42:41 2016 -0600 Fix for CodeMirror mode commit c29b9ab531e2e7af0fb5db24dc17e51027dd1174 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 08:03:33 2016 -0600 Made tabbing in editor use spaces commit 23af384c53206a8a40e11e45bf49d7a149c4adcd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:56:46 2016 -0600 Fix for data-url commit cfb8a97591cb6fc0a92e49563b7b764c524db0e9 Merge: 7fc8a89 991ce42 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:42:53 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit 7fc8a89cb495478225b02d613e647f99a1489634 Merge: fd3d86c c03d040 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:40:00 2016 -0600 Merge branch 'feature-create-and-edit-repo-file' of github.com:richmahn/gogs into feature-create-and-edit-repo-file commit fd3d86ca6bbc02cfda566a504ffd6b03db4f75ef Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Sun Jul 31 07:39:44 2016 -0600 Code cleanup commit c03d0401c1049eeeccc32ab1f9c3303c130be5ee Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 29 15:38:23 2016 -0600 Code cleanup commit 98e1206ccf9f9a4503c020e3a7830cf9f861dfae Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:36:01 2016 -0600 Code cleanup and fixes commit c2895dc742f25f8412879c9fa15e18f27f42f194 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 18:24:04 2016 -0600 Fixes per Unknwon's requests commit 6aa7e46b21ad4c96e562daa2eac26a8fb408f8ef Merge: 889e9fa ad7ea88 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Thu Jul 28 17:13:43 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go modules/setting/setting.go commit 889e9faf1bd8559a4979c8f46005d488c1a234d4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:09:18 2016 -0600 Fix in gogs.js commit 47603edf223f147b114be65f3bd27bc1e88827a5 Merge: bb57912 cf85e9e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:07:36 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go public/js/gogs.js commit bb5791255867a71c11a77b639db050ad09c597a4 Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 22 14:02:18 2016 -0600 Update for using CodeMirror mode addon commit d10d128c51039be19e2af9c66c63db66a9f2ec6d Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 16:12:57 2016 -0600 Update for Edit commit 34a34982025144e3225e389f7849eb6273c1d576 Merge: fa1b752 1c7dcdd Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Tue Jul 19 11:52:02 2016 -0600 Merge remote-tracking branch 'gogits/develop' into feature-create-and-edit-repo-file Conflicts: modules/bindata/bindata.go commit fa1b752be29cd455c5184ddac2ffe80b3489763e Author: Richard Mahn <richard_mahn@wycliffeassociates.org> Date: Fri Jul 15 18:35:42 2016 -0600 Feature for editing, creating, uploading and deleting files
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
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
8 years ago
9 years ago
9 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>
7 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
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
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
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
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
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
8 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>
6 years ago
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package models
  6. import (
  7. "fmt"
  8. "code.gitea.io/gitea/modules/git"
  9. )
  10. // ErrNameReserved represents a "reserved name" error.
  11. type ErrNameReserved struct {
  12. Name string
  13. }
  14. // IsErrNameReserved checks if an error is a ErrNameReserved.
  15. func IsErrNameReserved(err error) bool {
  16. _, ok := err.(ErrNameReserved)
  17. return ok
  18. }
  19. func (err ErrNameReserved) Error() string {
  20. return fmt.Sprintf("name is reserved [name: %s]", err.Name)
  21. }
  22. // ErrNamePatternNotAllowed represents a "pattern not allowed" error.
  23. type ErrNamePatternNotAllowed struct {
  24. Pattern string
  25. }
  26. // IsErrNamePatternNotAllowed checks if an error is an ErrNamePatternNotAllowed.
  27. func IsErrNamePatternNotAllowed(err error) bool {
  28. _, ok := err.(ErrNamePatternNotAllowed)
  29. return ok
  30. }
  31. func (err ErrNamePatternNotAllowed) Error() string {
  32. return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern)
  33. }
  34. // ErrSSHDisabled represents an "SSH disabled" error.
  35. type ErrSSHDisabled struct {
  36. }
  37. // IsErrSSHDisabled checks if an error is a ErrSSHDisabled.
  38. func IsErrSSHDisabled(err error) bool {
  39. _, ok := err.(ErrSSHDisabled)
  40. return ok
  41. }
  42. func (err ErrSSHDisabled) Error() string {
  43. return "SSH is disabled"
  44. }
  45. // ____ ___
  46. // | | \______ ___________
  47. // | | / ___// __ \_ __ \
  48. // | | /\___ \\ ___/| | \/
  49. // |______//____ >\___ >__|
  50. // \/ \/
  51. // ErrUserAlreadyExist represents a "user already exists" error.
  52. type ErrUserAlreadyExist struct {
  53. Name string
  54. }
  55. // IsErrUserAlreadyExist checks if an error is a ErrUserAlreadyExists.
  56. func IsErrUserAlreadyExist(err error) bool {
  57. _, ok := err.(ErrUserAlreadyExist)
  58. return ok
  59. }
  60. func (err ErrUserAlreadyExist) Error() string {
  61. return fmt.Sprintf("user already exists [name: %s]", err.Name)
  62. }
  63. // ErrUserNotExist represents a "UserNotExist" kind of error.
  64. type ErrUserNotExist struct {
  65. UID int64
  66. Name string
  67. KeyID int64
  68. }
  69. // IsErrUserNotExist checks if an error is a ErrUserNotExist.
  70. func IsErrUserNotExist(err error) bool {
  71. _, ok := err.(ErrUserNotExist)
  72. return ok
  73. }
  74. func (err ErrUserNotExist) Error() string {
  75. return fmt.Sprintf("user does not exist [uid: %d, name: %s, keyid: %d]", err.UID, err.Name, err.KeyID)
  76. }
  77. // ErrUserProhibitLogin represents a "ErrUserProhibitLogin" kind of error.
  78. type ErrUserProhibitLogin struct {
  79. UID int64
  80. Name string
  81. }
  82. // IsErrUserProhibitLogin checks if an error is a ErrUserProhibitLogin
  83. func IsErrUserProhibitLogin(err error) bool {
  84. _, ok := err.(ErrUserProhibitLogin)
  85. return ok
  86. }
  87. func (err ErrUserProhibitLogin) Error() string {
  88. return fmt.Sprintf("user is not allowed login [uid: %d, name: %s]", err.UID, err.Name)
  89. }
  90. // ErrUserInactive represents a "ErrUserInactive" kind of error.
  91. type ErrUserInactive struct {
  92. UID int64
  93. Name string
  94. }
  95. // IsErrUserInactive checks if an error is a ErrUserInactive
  96. func IsErrUserInactive(err error) bool {
  97. _, ok := err.(ErrUserInactive)
  98. return ok
  99. }
  100. func (err ErrUserInactive) Error() string {
  101. return fmt.Sprintf("user is inactive [uid: %d, name: %s]", err.UID, err.Name)
  102. }
  103. // ErrEmailAlreadyUsed represents a "EmailAlreadyUsed" kind of error.
  104. type ErrEmailAlreadyUsed struct {
  105. Email string
  106. }
  107. // IsErrEmailAlreadyUsed checks if an error is a ErrEmailAlreadyUsed.
  108. func IsErrEmailAlreadyUsed(err error) bool {
  109. _, ok := err.(ErrEmailAlreadyUsed)
  110. return ok
  111. }
  112. func (err ErrEmailAlreadyUsed) Error() string {
  113. return fmt.Sprintf("e-mail already in use [email: %s]", err.Email)
  114. }
  115. // ErrOpenIDAlreadyUsed represents a "OpenIDAlreadyUsed" kind of error.
  116. type ErrOpenIDAlreadyUsed struct {
  117. OpenID string
  118. }
  119. // IsErrOpenIDAlreadyUsed checks if an error is a ErrOpenIDAlreadyUsed.
  120. func IsErrOpenIDAlreadyUsed(err error) bool {
  121. _, ok := err.(ErrOpenIDAlreadyUsed)
  122. return ok
  123. }
  124. func (err ErrOpenIDAlreadyUsed) Error() string {
  125. return fmt.Sprintf("OpenID already in use [oid: %s]", err.OpenID)
  126. }
  127. // ErrUserOwnRepos represents a "UserOwnRepos" kind of error.
  128. type ErrUserOwnRepos struct {
  129. UID int64
  130. }
  131. // IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.
  132. func IsErrUserOwnRepos(err error) bool {
  133. _, ok := err.(ErrUserOwnRepos)
  134. return ok
  135. }
  136. func (err ErrUserOwnRepos) Error() string {
  137. return fmt.Sprintf("user still has ownership of repositories [uid: %d]", err.UID)
  138. }
  139. // ErrUserHasOrgs represents a "UserHasOrgs" kind of error.
  140. type ErrUserHasOrgs struct {
  141. UID int64
  142. }
  143. // IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.
  144. func IsErrUserHasOrgs(err error) bool {
  145. _, ok := err.(ErrUserHasOrgs)
  146. return ok
  147. }
  148. func (err ErrUserHasOrgs) Error() string {
  149. return fmt.Sprintf("user still has membership of organizations [uid: %d]", err.UID)
  150. }
  151. // ErrUserNotAllowedCreateOrg represents a "UserNotAllowedCreateOrg" kind of error.
  152. type ErrUserNotAllowedCreateOrg struct {
  153. }
  154. // IsErrUserNotAllowedCreateOrg checks if an error is an ErrUserNotAllowedCreateOrg.
  155. func IsErrUserNotAllowedCreateOrg(err error) bool {
  156. _, ok := err.(ErrUserNotAllowedCreateOrg)
  157. return ok
  158. }
  159. func (err ErrUserNotAllowedCreateOrg) Error() string {
  160. return fmt.Sprintf("user is not allowed to create organizations")
  161. }
  162. // ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
  163. type ErrReachLimitOfRepo struct {
  164. Limit int
  165. }
  166. // IsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.
  167. func IsErrReachLimitOfRepo(err error) bool {
  168. _, ok := err.(ErrReachLimitOfRepo)
  169. return ok
  170. }
  171. func (err ErrReachLimitOfRepo) Error() string {
  172. return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit)
  173. }
  174. // __ __.__ __ .__
  175. // / \ / \__| | _|__|
  176. // \ \/\/ / | |/ / |
  177. // \ /| | <| |
  178. // \__/\ / |__|__|_ \__|
  179. // \/ \/
  180. // ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.
  181. type ErrWikiAlreadyExist struct {
  182. Title string
  183. }
  184. // IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
  185. func IsErrWikiAlreadyExist(err error) bool {
  186. _, ok := err.(ErrWikiAlreadyExist)
  187. return ok
  188. }
  189. func (err ErrWikiAlreadyExist) Error() string {
  190. return fmt.Sprintf("wiki page already exists [title: %s]", err.Title)
  191. }
  192. // ErrWikiReservedName represents a reserved name error.
  193. type ErrWikiReservedName struct {
  194. Title string
  195. }
  196. // IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
  197. func IsErrWikiReservedName(err error) bool {
  198. _, ok := err.(ErrWikiReservedName)
  199. return ok
  200. }
  201. func (err ErrWikiReservedName) Error() string {
  202. return fmt.Sprintf("wiki title is reserved: %s", err.Title)
  203. }
  204. // ErrWikiInvalidFileName represents an invalid wiki file name.
  205. type ErrWikiInvalidFileName struct {
  206. FileName string
  207. }
  208. // IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
  209. func IsErrWikiInvalidFileName(err error) bool {
  210. _, ok := err.(ErrWikiInvalidFileName)
  211. return ok
  212. }
  213. func (err ErrWikiInvalidFileName) Error() string {
  214. return fmt.Sprintf("Invalid wiki filename: %s", err.FileName)
  215. }
  216. // __________ ___. .__ .__ ____ __.
  217. // \______ \__ _\_ |__ | | |__| ____ | |/ _|____ ___.__.
  218. // | ___/ | \ __ \| | | |/ ___\ | <_/ __ < | |
  219. // | | | | / \_\ \ |_| \ \___ | | \ ___/\___ |
  220. // |____| |____/|___ /____/__|\___ > |____|__ \___ > ____|
  221. // \/ \/ \/ \/\/
  222. // ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error.
  223. type ErrKeyUnableVerify struct {
  224. Result string
  225. }
  226. // IsErrKeyUnableVerify checks if an error is a ErrKeyUnableVerify.
  227. func IsErrKeyUnableVerify(err error) bool {
  228. _, ok := err.(ErrKeyUnableVerify)
  229. return ok
  230. }
  231. func (err ErrKeyUnableVerify) Error() string {
  232. return fmt.Sprintf("Unable to verify key content [result: %s]", err.Result)
  233. }
  234. // ErrKeyNotExist represents a "KeyNotExist" kind of error.
  235. type ErrKeyNotExist struct {
  236. ID int64
  237. }
  238. // IsErrKeyNotExist checks if an error is a ErrKeyNotExist.
  239. func IsErrKeyNotExist(err error) bool {
  240. _, ok := err.(ErrKeyNotExist)
  241. return ok
  242. }
  243. func (err ErrKeyNotExist) Error() string {
  244. return fmt.Sprintf("public key does not exist [id: %d]", err.ID)
  245. }
  246. // ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error.
  247. type ErrKeyAlreadyExist struct {
  248. OwnerID int64
  249. Fingerprint string
  250. Content string
  251. }
  252. // IsErrKeyAlreadyExist checks if an error is a ErrKeyAlreadyExist.
  253. func IsErrKeyAlreadyExist(err error) bool {
  254. _, ok := err.(ErrKeyAlreadyExist)
  255. return ok
  256. }
  257. func (err ErrKeyAlreadyExist) Error() string {
  258. return fmt.Sprintf("public key already exists [owner_id: %d, finger_print: %s, content: %s]",
  259. err.OwnerID, err.Fingerprint, err.Content)
  260. }
  261. // ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error.
  262. type ErrKeyNameAlreadyUsed struct {
  263. OwnerID int64
  264. Name string
  265. }
  266. // IsErrKeyNameAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  267. func IsErrKeyNameAlreadyUsed(err error) bool {
  268. _, ok := err.(ErrKeyNameAlreadyUsed)
  269. return ok
  270. }
  271. func (err ErrKeyNameAlreadyUsed) Error() string {
  272. return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name)
  273. }
  274. // ErrGPGNoEmailFound represents a "ErrGPGNoEmailFound" kind of error.
  275. type ErrGPGNoEmailFound struct {
  276. FailedEmails []string
  277. }
  278. // IsErrGPGNoEmailFound checks if an error is a ErrGPGNoEmailFound.
  279. func IsErrGPGNoEmailFound(err error) bool {
  280. _, ok := err.(ErrGPGNoEmailFound)
  281. return ok
  282. }
  283. func (err ErrGPGNoEmailFound) Error() string {
  284. return fmt.Sprintf("none of the emails attached to the GPG key could be found: %v", err.FailedEmails)
  285. }
  286. // ErrGPGKeyParsing represents a "ErrGPGKeyParsing" kind of error.
  287. type ErrGPGKeyParsing struct {
  288. ParseError error
  289. }
  290. // IsErrGPGKeyParsing checks if an error is a ErrGPGKeyParsing.
  291. func IsErrGPGKeyParsing(err error) bool {
  292. _, ok := err.(ErrGPGKeyParsing)
  293. return ok
  294. }
  295. func (err ErrGPGKeyParsing) Error() string {
  296. return fmt.Sprintf("failed to parse gpg key %s", err.ParseError.Error())
  297. }
  298. // ErrGPGKeyNotExist represents a "GPGKeyNotExist" kind of error.
  299. type ErrGPGKeyNotExist struct {
  300. ID int64
  301. }
  302. // IsErrGPGKeyNotExist checks if an error is a ErrGPGKeyNotExist.
  303. func IsErrGPGKeyNotExist(err error) bool {
  304. _, ok := err.(ErrGPGKeyNotExist)
  305. return ok
  306. }
  307. func (err ErrGPGKeyNotExist) Error() string {
  308. return fmt.Sprintf("public gpg key does not exist [id: %d]", err.ID)
  309. }
  310. // ErrGPGKeyImportNotExist represents a "GPGKeyImportNotExist" kind of error.
  311. type ErrGPGKeyImportNotExist struct {
  312. ID string
  313. }
  314. // IsErrGPGKeyImportNotExist checks if an error is a ErrGPGKeyImportNotExist.
  315. func IsErrGPGKeyImportNotExist(err error) bool {
  316. _, ok := err.(ErrGPGKeyImportNotExist)
  317. return ok
  318. }
  319. func (err ErrGPGKeyImportNotExist) Error() string {
  320. return fmt.Sprintf("public gpg key import does not exist [id: %s]", err.ID)
  321. }
  322. // ErrGPGKeyIDAlreadyUsed represents a "GPGKeyIDAlreadyUsed" kind of error.
  323. type ErrGPGKeyIDAlreadyUsed struct {
  324. KeyID string
  325. }
  326. // IsErrGPGKeyIDAlreadyUsed checks if an error is a ErrKeyNameAlreadyUsed.
  327. func IsErrGPGKeyIDAlreadyUsed(err error) bool {
  328. _, ok := err.(ErrGPGKeyIDAlreadyUsed)
  329. return ok
  330. }
  331. func (err ErrGPGKeyIDAlreadyUsed) Error() string {
  332. return fmt.Sprintf("public key already exists [key_id: %s]", err.KeyID)
  333. }
  334. // ErrGPGKeyAccessDenied represents a "GPGKeyAccessDenied" kind of Error.
  335. type ErrGPGKeyAccessDenied struct {
  336. UserID int64
  337. KeyID int64
  338. }
  339. // IsErrGPGKeyAccessDenied checks if an error is a ErrGPGKeyAccessDenied.
  340. func IsErrGPGKeyAccessDenied(err error) bool {
  341. _, ok := err.(ErrGPGKeyAccessDenied)
  342. return ok
  343. }
  344. // Error pretty-prints an error of type ErrGPGKeyAccessDenied.
  345. func (err ErrGPGKeyAccessDenied) Error() string {
  346. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d]",
  347. err.UserID, err.KeyID)
  348. }
  349. // ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error.
  350. type ErrKeyAccessDenied struct {
  351. UserID int64
  352. KeyID int64
  353. Note string
  354. }
  355. // IsErrKeyAccessDenied checks if an error is a ErrKeyAccessDenied.
  356. func IsErrKeyAccessDenied(err error) bool {
  357. _, ok := err.(ErrKeyAccessDenied)
  358. return ok
  359. }
  360. func (err ErrKeyAccessDenied) Error() string {
  361. return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
  362. err.UserID, err.KeyID, err.Note)
  363. }
  364. // ErrDeployKeyNotExist represents a "DeployKeyNotExist" kind of error.
  365. type ErrDeployKeyNotExist struct {
  366. ID int64
  367. KeyID int64
  368. RepoID int64
  369. }
  370. // IsErrDeployKeyNotExist checks if an error is a ErrDeployKeyNotExist.
  371. func IsErrDeployKeyNotExist(err error) bool {
  372. _, ok := err.(ErrDeployKeyNotExist)
  373. return ok
  374. }
  375. func (err ErrDeployKeyNotExist) Error() string {
  376. return fmt.Sprintf("Deploy key does not exist [id: %d, key_id: %d, repo_id: %d]", err.ID, err.KeyID, err.RepoID)
  377. }
  378. // ErrDeployKeyAlreadyExist represents a "DeployKeyAlreadyExist" kind of error.
  379. type ErrDeployKeyAlreadyExist struct {
  380. KeyID int64
  381. RepoID int64
  382. }
  383. // IsErrDeployKeyAlreadyExist checks if an error is a ErrDeployKeyAlreadyExist.
  384. func IsErrDeployKeyAlreadyExist(err error) bool {
  385. _, ok := err.(ErrDeployKeyAlreadyExist)
  386. return ok
  387. }
  388. func (err ErrDeployKeyAlreadyExist) Error() string {
  389. return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID)
  390. }
  391. // ErrDeployKeyNameAlreadyUsed represents a "DeployKeyNameAlreadyUsed" kind of error.
  392. type ErrDeployKeyNameAlreadyUsed struct {
  393. RepoID int64
  394. Name string
  395. }
  396. // IsErrDeployKeyNameAlreadyUsed checks if an error is a ErrDeployKeyNameAlreadyUsed.
  397. func IsErrDeployKeyNameAlreadyUsed(err error) bool {
  398. _, ok := err.(ErrDeployKeyNameAlreadyUsed)
  399. return ok
  400. }
  401. func (err ErrDeployKeyNameAlreadyUsed) Error() string {
  402. return fmt.Sprintf("public key already exists [repo_id: %d, name: %s]", err.RepoID, err.Name)
  403. }
  404. // _____ ___________ __
  405. // / _ \ ____ ____ ____ ______ _____\__ ___/___ | | __ ____ ____
  406. // / /_\ \_/ ___\/ ___\/ __ \ / ___// ___/ | | / _ \| |/ // __ \ / \
  407. // / | \ \__\ \__\ ___/ \___ \ \___ \ | |( <_> ) <\ ___/| | \
  408. // \____|__ /\___ >___ >___ >____ >____ > |____| \____/|__|_ \\___ >___| /
  409. // \/ \/ \/ \/ \/ \/ \/ \/ \/
  410. // ErrAccessTokenNotExist represents a "AccessTokenNotExist" kind of error.
  411. type ErrAccessTokenNotExist struct {
  412. Token string
  413. }
  414. // IsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.
  415. func IsErrAccessTokenNotExist(err error) bool {
  416. _, ok := err.(ErrAccessTokenNotExist)
  417. return ok
  418. }
  419. func (err ErrAccessTokenNotExist) Error() string {
  420. return fmt.Sprintf("access token does not exist [sha: %s]", err.Token)
  421. }
  422. // ErrAccessTokenEmpty represents a "AccessTokenEmpty" kind of error.
  423. type ErrAccessTokenEmpty struct {
  424. }
  425. // IsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.
  426. func IsErrAccessTokenEmpty(err error) bool {
  427. _, ok := err.(ErrAccessTokenEmpty)
  428. return ok
  429. }
  430. func (err ErrAccessTokenEmpty) Error() string {
  431. return fmt.Sprintf("access token is empty")
  432. }
  433. // ________ .__ __ .__
  434. // \_____ \_______ _________ ____ |__|____________ _/ |_|__| ____ ____
  435. // / | \_ __ \/ ___\__ \ / \| \___ /\__ \\ __\ |/ _ \ / \
  436. // / | \ | \/ /_/ > __ \| | \ |/ / / __ \| | | ( <_> ) | \
  437. // \_______ /__| \___ (____ /___| /__/_____ \(____ /__| |__|\____/|___| /
  438. // \/ /_____/ \/ \/ \/ \/ \/
  439. // ErrOrgNotExist represents a "OrgNotExist" kind of error.
  440. type ErrOrgNotExist struct {
  441. ID int64
  442. Name string
  443. }
  444. // IsErrOrgNotExist checks if an error is a ErrOrgNotExist.
  445. func IsErrOrgNotExist(err error) bool {
  446. _, ok := err.(ErrOrgNotExist)
  447. return ok
  448. }
  449. func (err ErrOrgNotExist) Error() string {
  450. return fmt.Sprintf("org does not exist [id: %d, name: %s]", err.ID, err.Name)
  451. }
  452. // ErrLastOrgOwner represents a "LastOrgOwner" kind of error.
  453. type ErrLastOrgOwner struct {
  454. UID int64
  455. }
  456. // IsErrLastOrgOwner checks if an error is a ErrLastOrgOwner.
  457. func IsErrLastOrgOwner(err error) bool {
  458. _, ok := err.(ErrLastOrgOwner)
  459. return ok
  460. }
  461. func (err ErrLastOrgOwner) Error() string {
  462. return fmt.Sprintf("user is the last member of owner team [uid: %d]", err.UID)
  463. }
  464. //.____ ____________________
  465. //| | \_ _____/ _____/
  466. //| | | __) \_____ \
  467. //| |___| \ / \
  468. //|_______ \___ / /_______ /
  469. // \/ \/ \/
  470. // ErrLFSLockNotExist represents a "LFSLockNotExist" kind of error.
  471. type ErrLFSLockNotExist struct {
  472. ID int64
  473. RepoID int64
  474. Path string
  475. }
  476. // IsErrLFSLockNotExist checks if an error is a ErrLFSLockNotExist.
  477. func IsErrLFSLockNotExist(err error) bool {
  478. _, ok := err.(ErrLFSLockNotExist)
  479. return ok
  480. }
  481. func (err ErrLFSLockNotExist) Error() string {
  482. return fmt.Sprintf("lfs lock does not exist [id: %d, rid: %d, path: %s]", err.ID, err.RepoID, err.Path)
  483. }
  484. // ErrLFSUnauthorizedAction represents a "LFSUnauthorizedAction" kind of error.
  485. type ErrLFSUnauthorizedAction struct {
  486. RepoID int64
  487. UserName string
  488. Mode AccessMode
  489. }
  490. // IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
  491. func IsErrLFSUnauthorizedAction(err error) bool {
  492. _, ok := err.(ErrLFSUnauthorizedAction)
  493. return ok
  494. }
  495. func (err ErrLFSUnauthorizedAction) Error() string {
  496. if err.Mode == AccessModeWrite {
  497. return fmt.Sprintf("User %s doesn't have write access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  498. }
  499. return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID)
  500. }
  501. // ErrLFSLockAlreadyExist represents a "LFSLockAlreadyExist" kind of error.
  502. type ErrLFSLockAlreadyExist struct {
  503. RepoID int64
  504. Path string
  505. }
  506. // IsErrLFSLockAlreadyExist checks if an error is a ErrLFSLockAlreadyExist.
  507. func IsErrLFSLockAlreadyExist(err error) bool {
  508. _, ok := err.(ErrLFSLockAlreadyExist)
  509. return ok
  510. }
  511. func (err ErrLFSLockAlreadyExist) Error() string {
  512. return fmt.Sprintf("lfs lock already exists [rid: %d, path: %s]", err.RepoID, err.Path)
  513. }
  514. // __________ .__ __
  515. // \______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
  516. // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
  517. // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
  518. // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
  519. // \/ \/|__| \/ \/
  520. // ErrRepoNotExist represents a "RepoNotExist" kind of error.
  521. type ErrRepoNotExist struct {
  522. ID int64
  523. UID int64
  524. OwnerName string
  525. Name string
  526. }
  527. // IsErrRepoNotExist checks if an error is a ErrRepoNotExist.
  528. func IsErrRepoNotExist(err error) bool {
  529. _, ok := err.(ErrRepoNotExist)
  530. return ok
  531. }
  532. func (err ErrRepoNotExist) Error() string {
  533. return fmt.Sprintf("repository does not exist [id: %d, uid: %d, owner_name: %s, name: %s]",
  534. err.ID, err.UID, err.OwnerName, err.Name)
  535. }
  536. // ErrRepoAlreadyExist represents a "RepoAlreadyExist" kind of error.
  537. type ErrRepoAlreadyExist struct {
  538. Uname string
  539. Name string
  540. }
  541. // IsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.
  542. func IsErrRepoAlreadyExist(err error) bool {
  543. _, ok := err.(ErrRepoAlreadyExist)
  544. return ok
  545. }
  546. func (err ErrRepoAlreadyExist) Error() string {
  547. return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
  548. }
  549. // ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error.
  550. type ErrForkAlreadyExist struct {
  551. Uname string
  552. RepoName string
  553. ForkName string
  554. }
  555. // IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist.
  556. func IsErrForkAlreadyExist(err error) bool {
  557. _, ok := err.(ErrForkAlreadyExist)
  558. return ok
  559. }
  560. func (err ErrForkAlreadyExist) Error() string {
  561. return fmt.Sprintf("repository is already forked by user [uname: %s, repo path: %s, fork path: %s]", err.Uname, err.RepoName, err.ForkName)
  562. }
  563. // ErrRepoRedirectNotExist represents a "RepoRedirectNotExist" kind of error.
  564. type ErrRepoRedirectNotExist struct {
  565. OwnerID int64
  566. RepoName string
  567. }
  568. // IsErrRepoRedirectNotExist check if an error is an ErrRepoRedirectNotExist.
  569. func IsErrRepoRedirectNotExist(err error) bool {
  570. _, ok := err.(ErrRepoRedirectNotExist)
  571. return ok
  572. }
  573. func (err ErrRepoRedirectNotExist) Error() string {
  574. return fmt.Sprintf("repository redirect does not exist [uid: %d, name: %s]", err.OwnerID, err.RepoName)
  575. }
  576. // ErrInvalidCloneAddr represents a "InvalidCloneAddr" kind of error.
  577. type ErrInvalidCloneAddr struct {
  578. IsURLError bool
  579. IsInvalidPath bool
  580. IsPermissionDenied bool
  581. }
  582. // IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.
  583. func IsErrInvalidCloneAddr(err error) bool {
  584. _, ok := err.(ErrInvalidCloneAddr)
  585. return ok
  586. }
  587. func (err ErrInvalidCloneAddr) Error() string {
  588. return fmt.Sprintf("invalid clone address [is_url_error: %v, is_invalid_path: %v, is_permission_denied: %v]",
  589. err.IsURLError, err.IsInvalidPath, err.IsPermissionDenied)
  590. }
  591. // ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error.
  592. type ErrUpdateTaskNotExist struct {
  593. UUID string
  594. }
  595. // IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.
  596. func IsErrUpdateTaskNotExist(err error) bool {
  597. _, ok := err.(ErrUpdateTaskNotExist)
  598. return ok
  599. }
  600. func (err ErrUpdateTaskNotExist) Error() string {
  601. return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID)
  602. }
  603. // ErrReleaseAlreadyExist represents a "ReleaseAlreadyExist" kind of error.
  604. type ErrReleaseAlreadyExist struct {
  605. TagName string
  606. }
  607. // IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.
  608. func IsErrReleaseAlreadyExist(err error) bool {
  609. _, ok := err.(ErrReleaseAlreadyExist)
  610. return ok
  611. }
  612. func (err ErrReleaseAlreadyExist) Error() string {
  613. return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName)
  614. }
  615. // ErrReleaseNotExist represents a "ReleaseNotExist" kind of error.
  616. type ErrReleaseNotExist struct {
  617. ID int64
  618. TagName string
  619. }
  620. // IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.
  621. func IsErrReleaseNotExist(err error) bool {
  622. _, ok := err.(ErrReleaseNotExist)
  623. return ok
  624. }
  625. func (err ErrReleaseNotExist) Error() string {
  626. return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName)
  627. }
  628. // ErrInvalidTagName represents a "InvalidTagName" kind of error.
  629. type ErrInvalidTagName struct {
  630. TagName string
  631. }
  632. // IsErrInvalidTagName checks if an error is a ErrInvalidTagName.
  633. func IsErrInvalidTagName(err error) bool {
  634. _, ok := err.(ErrInvalidTagName)
  635. return ok
  636. }
  637. func (err ErrInvalidTagName) Error() string {
  638. return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName)
  639. }
  640. // ErrRepoFileAlreadyExists represents a "RepoFileAlreadyExist" kind of error.
  641. type ErrRepoFileAlreadyExists struct {
  642. Path string
  643. }
  644. // IsErrRepoFileAlreadyExists checks if an error is a ErrRepoFileAlreadyExists.
  645. func IsErrRepoFileAlreadyExists(err error) bool {
  646. _, ok := err.(ErrRepoFileAlreadyExists)
  647. return ok
  648. }
  649. func (err ErrRepoFileAlreadyExists) Error() string {
  650. return fmt.Sprintf("repository file already exists [path: %s]", err.Path)
  651. }
  652. // ErrRepoFileDoesNotExist represents a "RepoFileDoesNotExist" kind of error.
  653. type ErrRepoFileDoesNotExist struct {
  654. Path string
  655. Name string
  656. }
  657. // IsErrRepoFileDoesNotExist checks if an error is a ErrRepoDoesNotExist.
  658. func IsErrRepoFileDoesNotExist(err error) bool {
  659. _, ok := err.(ErrRepoFileDoesNotExist)
  660. return ok
  661. }
  662. func (err ErrRepoFileDoesNotExist) Error() string {
  663. return fmt.Sprintf("repository file does not exist [path: %s]", err.Path)
  664. }
  665. // ErrFilenameInvalid represents a "FilenameInvalid" kind of error.
  666. type ErrFilenameInvalid struct {
  667. Path string
  668. }
  669. // IsErrFilenameInvalid checks if an error is an ErrFilenameInvalid.
  670. func IsErrFilenameInvalid(err error) bool {
  671. _, ok := err.(ErrFilenameInvalid)
  672. return ok
  673. }
  674. func (err ErrFilenameInvalid) Error() string {
  675. return fmt.Sprintf("path contains a malformed path component [path: %s]", err.Path)
  676. }
  677. // ErrUserCannotCommit represents "UserCannotCommit" kind of error.
  678. type ErrUserCannotCommit struct {
  679. UserName string
  680. }
  681. // IsErrUserCannotCommit checks if an error is an ErrUserCannotCommit.
  682. func IsErrUserCannotCommit(err error) bool {
  683. _, ok := err.(ErrUserCannotCommit)
  684. return ok
  685. }
  686. func (err ErrUserCannotCommit) Error() string {
  687. return fmt.Sprintf("user cannot commit to repo [user: %s]", err.UserName)
  688. }
  689. // ErrFilePathInvalid represents a "FilePathInvalid" kind of error.
  690. type ErrFilePathInvalid struct {
  691. Message string
  692. Path string
  693. Name string
  694. Type git.EntryMode
  695. }
  696. // IsErrFilePathInvalid checks if an error is an ErrFilePathInvalid.
  697. func IsErrFilePathInvalid(err error) bool {
  698. _, ok := err.(ErrFilePathInvalid)
  699. return ok
  700. }
  701. func (err ErrFilePathInvalid) Error() string {
  702. if err.Message != "" {
  703. return err.Message
  704. }
  705. return fmt.Sprintf("path is invalid [path: %s]", err.Path)
  706. }
  707. // ErrUserDoesNotHaveAccessToRepo represets an error where the user doesn't has access to a given repo.
  708. type ErrUserDoesNotHaveAccessToRepo struct {
  709. UserID int64
  710. RepoName string
  711. }
  712. // IsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrRepoFileAlreadyExists.
  713. func IsErrUserDoesNotHaveAccessToRepo(err error) bool {
  714. _, ok := err.(ErrUserDoesNotHaveAccessToRepo)
  715. return ok
  716. }
  717. func (err ErrUserDoesNotHaveAccessToRepo) Error() string {
  718. return fmt.Sprintf("user doesn't have acces to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName)
  719. }
  720. // __________ .__
  721. // \______ \____________ ____ ____ | |__
  722. // | | _/\_ __ \__ \ / \_/ ___\| | \
  723. // | | \ | | \// __ \| | \ \___| Y \
  724. // |______ / |__| (____ /___| /\___ >___| /
  725. // \/ \/ \/ \/ \/
  726. // ErrBranchAlreadyExists represents an error that branch with such name already exists.
  727. type ErrBranchAlreadyExists struct {
  728. BranchName string
  729. }
  730. // IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.
  731. func IsErrBranchAlreadyExists(err error) bool {
  732. _, ok := err.(ErrBranchAlreadyExists)
  733. return ok
  734. }
  735. func (err ErrBranchAlreadyExists) Error() string {
  736. return fmt.Sprintf("branch already exists [name: %s]", err.BranchName)
  737. }
  738. // ErrBranchNameConflict represents an error that branch name conflicts with other branch.
  739. type ErrBranchNameConflict struct {
  740. BranchName string
  741. }
  742. // IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.
  743. func IsErrBranchNameConflict(err error) bool {
  744. _, ok := err.(ErrBranchNameConflict)
  745. return ok
  746. }
  747. func (err ErrBranchNameConflict) Error() string {
  748. return fmt.Sprintf("branch conflicts with existing branch [name: %s]", err.BranchName)
  749. }
  750. // ErrNotAllowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it.
  751. type ErrNotAllowedToMerge struct {
  752. Reason string
  753. }
  754. // IsErrNotAllowedToMerge checks if an error is an ErrNotAllowedToMerge.
  755. func IsErrNotAllowedToMerge(err error) bool {
  756. _, ok := err.(ErrNotAllowedToMerge)
  757. return ok
  758. }
  759. func (err ErrNotAllowedToMerge) Error() string {
  760. return fmt.Sprintf("not allowed to merge [reason: %s]", err.Reason)
  761. }
  762. // ErrTagAlreadyExists represents an error that tag with such name already exists.
  763. type ErrTagAlreadyExists struct {
  764. TagName string
  765. }
  766. // IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.
  767. func IsErrTagAlreadyExists(err error) bool {
  768. _, ok := err.(ErrTagAlreadyExists)
  769. return ok
  770. }
  771. func (err ErrTagAlreadyExists) Error() string {
  772. return fmt.Sprintf("tag already exists [name: %s]", err.TagName)
  773. }
  774. // ErrSHADoesNotMatch represents a "SHADoesNotMatch" kind of error.
  775. type ErrSHADoesNotMatch struct {
  776. Path string
  777. GivenSHA string
  778. CurrentSHA string
  779. }
  780. // IsErrSHADoesNotMatch checks if an error is a ErrSHADoesNotMatch.
  781. func IsErrSHADoesNotMatch(err error) bool {
  782. _, ok := err.(ErrSHADoesNotMatch)
  783. return ok
  784. }
  785. func (err ErrSHADoesNotMatch) Error() string {
  786. return fmt.Sprintf("sha does not match [given: %s, expected: %s]", err.GivenSHA, err.CurrentSHA)
  787. }
  788. // ErrSHANotFound represents a "SHADoesNotMatch" kind of error.
  789. type ErrSHANotFound struct {
  790. SHA string
  791. }
  792. // IsErrSHANotFound checks if an error is a ErrSHANotFound.
  793. func IsErrSHANotFound(err error) bool {
  794. _, ok := err.(ErrSHANotFound)
  795. return ok
  796. }
  797. func (err ErrSHANotFound) Error() string {
  798. return fmt.Sprintf("sha not found [%s]", err.SHA)
  799. }
  800. // ErrCommitIDDoesNotMatch represents a "CommitIDDoesNotMatch" kind of error.
  801. type ErrCommitIDDoesNotMatch struct {
  802. GivenCommitID string
  803. CurrentCommitID string
  804. }
  805. // IsErrCommitIDDoesNotMatch checks if an error is a ErrCommitIDDoesNotMatch.
  806. func IsErrCommitIDDoesNotMatch(err error) bool {
  807. _, ok := err.(ErrCommitIDDoesNotMatch)
  808. return ok
  809. }
  810. func (err ErrCommitIDDoesNotMatch) Error() string {
  811. return fmt.Sprintf("file CommitID does not match [given: %s, expected: %s]", err.GivenCommitID, err.CurrentCommitID)
  812. }
  813. // ErrSHAOrCommitIDNotProvided represents a "SHAOrCommitIDNotProvided" kind of error.
  814. type ErrSHAOrCommitIDNotProvided struct{}
  815. // IsErrSHAOrCommitIDNotProvided checks if an error is a ErrSHAOrCommitIDNotProvided.
  816. func IsErrSHAOrCommitIDNotProvided(err error) bool {
  817. _, ok := err.(ErrSHAOrCommitIDNotProvided)
  818. return ok
  819. }
  820. func (err ErrSHAOrCommitIDNotProvided) Error() string {
  821. return fmt.Sprintf("a SHA or commmit ID must be proved when updating a file")
  822. }
  823. // __ __ ___. .__ __
  824. // / \ / \ ____\_ |__ | |__ ____ ____ | | __
  825. // \ \/\/ // __ \| __ \| | \ / _ \ / _ \| |/ /
  826. // \ /\ ___/| \_\ \ Y ( <_> | <_> ) <
  827. // \__/\ / \___ >___ /___| /\____/ \____/|__|_ \
  828. // \/ \/ \/ \/ \/
  829. // ErrWebhookNotExist represents a "WebhookNotExist" kind of error.
  830. type ErrWebhookNotExist struct {
  831. ID int64
  832. }
  833. // IsErrWebhookNotExist checks if an error is a ErrWebhookNotExist.
  834. func IsErrWebhookNotExist(err error) bool {
  835. _, ok := err.(ErrWebhookNotExist)
  836. return ok
  837. }
  838. func (err ErrWebhookNotExist) Error() string {
  839. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  840. }
  841. // .___
  842. // | | ______ ________ __ ____
  843. // | |/ ___// ___/ | \_/ __ \
  844. // | |\___ \ \___ \| | /\ ___/
  845. // |___/____ >____ >____/ \___ >
  846. // \/ \/ \/
  847. // ErrIssueNotExist represents a "IssueNotExist" kind of error.
  848. type ErrIssueNotExist struct {
  849. ID int64
  850. RepoID int64
  851. Index int64
  852. }
  853. // IsErrIssueNotExist checks if an error is a ErrIssueNotExist.
  854. func IsErrIssueNotExist(err error) bool {
  855. _, ok := err.(ErrIssueNotExist)
  856. return ok
  857. }
  858. func (err ErrIssueNotExist) Error() string {
  859. return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  860. }
  861. // __________ .__ .__ __________ __
  862. // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_
  863. // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\
  864. // | | | | / |_| |_| | \ ___< <_| | | /\ ___/ \___ \ | |
  865. // |____| |____/|____/____/____|_ /\___ >__ |____/ \___ >____ > |__|
  866. // \/ \/ |__| \/ \/
  867. // ErrPullRequestNotExist represents a "PullRequestNotExist" kind of error.
  868. type ErrPullRequestNotExist struct {
  869. ID int64
  870. IssueID int64
  871. HeadRepoID int64
  872. BaseRepoID int64
  873. HeadBranch string
  874. BaseBranch string
  875. }
  876. // IsErrPullRequestNotExist checks if an error is a ErrPullRequestNotExist.
  877. func IsErrPullRequestNotExist(err error) bool {
  878. _, ok := err.(ErrPullRequestNotExist)
  879. return ok
  880. }
  881. func (err ErrPullRequestNotExist) Error() string {
  882. 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]",
  883. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  884. }
  885. // ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error
  886. type ErrPullRequestAlreadyExists struct {
  887. ID int64
  888. IssueID int64
  889. HeadRepoID int64
  890. BaseRepoID int64
  891. HeadBranch string
  892. BaseBranch string
  893. }
  894. // IsErrPullRequestAlreadyExists checks if an error is a ErrPullRequestAlreadyExists.
  895. func IsErrPullRequestAlreadyExists(err error) bool {
  896. _, ok := err.(ErrPullRequestAlreadyExists)
  897. return ok
  898. }
  899. // Error does pretty-printing :D
  900. func (err ErrPullRequestAlreadyExists) Error() string {
  901. 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]",
  902. err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
  903. }
  904. // ErrPullRequestHeadRepoMissing represents a "ErrPullRequestHeadRepoMissing" error
  905. type ErrPullRequestHeadRepoMissing struct {
  906. ID int64
  907. HeadRepoID int64
  908. }
  909. // IsErrErrPullRequestHeadRepoMissing checks if an error is a ErrPullRequestHeadRepoMissing.
  910. func IsErrErrPullRequestHeadRepoMissing(err error) bool {
  911. _, ok := err.(ErrPullRequestHeadRepoMissing)
  912. return ok
  913. }
  914. // Error does pretty-printing :D
  915. func (err ErrPullRequestHeadRepoMissing) Error() string {
  916. return fmt.Sprintf("pull request head repo missing [id: %d, head_repo_id: %d]",
  917. err.ID, err.HeadRepoID)
  918. }
  919. // ErrInvalidMergeStyle represents an error if merging with disabled merge strategy
  920. type ErrInvalidMergeStyle struct {
  921. ID int64
  922. Style MergeStyle
  923. }
  924. // IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.
  925. func IsErrInvalidMergeStyle(err error) bool {
  926. _, ok := err.(ErrInvalidMergeStyle)
  927. return ok
  928. }
  929. func (err ErrInvalidMergeStyle) Error() string {
  930. return fmt.Sprintf("merge strategy is not allowed or is invalid [repo_id: %d, strategy: %s]",
  931. err.ID, err.Style)
  932. }
  933. // _________ __
  934. // \_ ___ \ ____ _____ _____ ____ _____/ |_
  935. // / \ \/ / _ \ / \ / \_/ __ \ / \ __\
  936. // \ \___( <_> ) Y Y \ Y Y \ ___/| | \ |
  937. // \______ /\____/|__|_| /__|_| /\___ >___| /__|
  938. // \/ \/ \/ \/ \/
  939. // ErrCommentNotExist represents a "CommentNotExist" kind of error.
  940. type ErrCommentNotExist struct {
  941. ID int64
  942. IssueID int64
  943. }
  944. // IsErrCommentNotExist checks if an error is a ErrCommentNotExist.
  945. func IsErrCommentNotExist(err error) bool {
  946. _, ok := err.(ErrCommentNotExist)
  947. return ok
  948. }
  949. func (err ErrCommentNotExist) Error() string {
  950. return fmt.Sprintf("comment does not exist [id: %d, issue_id: %d]", err.ID, err.IssueID)
  951. }
  952. // _________ __ __ .__
  953. // / _____// |_ ____ ________ _ _______ _/ |_ ____ | |__
  954. // \_____ \\ __\/ _ \\____ \ \/ \/ /\__ \\ __\/ ___\| | \
  955. // / \| | ( <_> ) |_> > / / __ \| | \ \___| Y \
  956. // /_______ /|__| \____/| __/ \/\_/ (____ /__| \___ >___| /
  957. // \/ |__| \/ \/ \/
  958. // ErrStopwatchNotExist represents a "Stopwatch Not Exist" kind of error.
  959. type ErrStopwatchNotExist struct {
  960. ID int64
  961. }
  962. // IsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.
  963. func IsErrStopwatchNotExist(err error) bool {
  964. _, ok := err.(ErrStopwatchNotExist)
  965. return ok
  966. }
  967. func (err ErrStopwatchNotExist) Error() string {
  968. return fmt.Sprintf("stopwatch does not exist [id: %d]", err.ID)
  969. }
  970. // ___________ __ .______________.__
  971. // \__ ___/___________ ____ | | __ ____ __| _/\__ ___/|__| _____ ____
  972. // | | \_ __ \__ \ _/ ___\| |/ // __ \ / __ | | | | |/ \_/ __ \
  973. // | | | | \// __ \\ \___| <\ ___// /_/ | | | | | Y Y \ ___/
  974. // |____| |__| (____ /\___ >__|_ \\___ >____ | |____| |__|__|_| /\___ >
  975. // \/ \/ \/ \/ \/ \/ \/
  976. // ErrTrackedTimeNotExist represents a "TrackedTime Not Exist" kind of error.
  977. type ErrTrackedTimeNotExist struct {
  978. ID int64
  979. }
  980. // IsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.
  981. func IsErrTrackedTimeNotExist(err error) bool {
  982. _, ok := err.(ErrTrackedTimeNotExist)
  983. return ok
  984. }
  985. func (err ErrTrackedTimeNotExist) Error() string {
  986. return fmt.Sprintf("tracked time does not exist [id: %d]", err.ID)
  987. }
  988. // .____ ___. .__
  989. // | | _____ \_ |__ ____ | |
  990. // | | \__ \ | __ \_/ __ \| |
  991. // | |___ / __ \| \_\ \ ___/| |__
  992. // |_______ (____ /___ /\___ >____/
  993. // \/ \/ \/ \/
  994. // ErrLabelNotExist represents a "LabelNotExist" kind of error.
  995. type ErrLabelNotExist struct {
  996. LabelID int64
  997. RepoID int64
  998. }
  999. // IsErrLabelNotExist checks if an error is a ErrLabelNotExist.
  1000. func IsErrLabelNotExist(err error) bool {
  1001. _, ok := err.(ErrLabelNotExist)
  1002. return ok
  1003. }
  1004. func (err ErrLabelNotExist) Error() string {
  1005. return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID)
  1006. }
  1007. // _____ .__.__ __
  1008. // / \ |__| | ____ _______/ |_ ____ ____ ____
  1009. // / \ / \| | | _/ __ \ / ___/\ __\/ _ \ / \_/ __ \
  1010. // / Y \ | |_\ ___/ \___ \ | | ( <_> ) | \ ___/
  1011. // \____|__ /__|____/\___ >____ > |__| \____/|___| /\___ >
  1012. // \/ \/ \/ \/ \/
  1013. // ErrMilestoneNotExist represents a "MilestoneNotExist" kind of error.
  1014. type ErrMilestoneNotExist struct {
  1015. ID int64
  1016. RepoID int64
  1017. }
  1018. // IsErrMilestoneNotExist checks if an error is a ErrMilestoneNotExist.
  1019. func IsErrMilestoneNotExist(err error) bool {
  1020. _, ok := err.(ErrMilestoneNotExist)
  1021. return ok
  1022. }
  1023. func (err ErrMilestoneNotExist) Error() string {
  1024. return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID)
  1025. }
  1026. // _____ __ __ .__ __
  1027. // / _ \_/ |__/ |______ ____ | |__ _____ ____ _____/ |_
  1028. // / /_\ \ __\ __\__ \ _/ ___\| | \ / \_/ __ \ / \ __\
  1029. // / | \ | | | / __ \\ \___| Y \ Y Y \ ___/| | \ |
  1030. // \____|__ /__| |__| (____ /\___ >___| /__|_| /\___ >___| /__|
  1031. // \/ \/ \/ \/ \/ \/ \/
  1032. // ErrAttachmentNotExist represents a "AttachmentNotExist" kind of error.
  1033. type ErrAttachmentNotExist struct {
  1034. ID int64
  1035. UUID string
  1036. }
  1037. // IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
  1038. func IsErrAttachmentNotExist(err error) bool {
  1039. _, ok := err.(ErrAttachmentNotExist)
  1040. return ok
  1041. }
  1042. func (err ErrAttachmentNotExist) Error() string {
  1043. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1044. }
  1045. // .____ .__ _________
  1046. // | | ____ ____ |__| ____ / _____/ ____ __ _________ ____ ____
  1047. // | | / _ \ / ___\| |/ \ \_____ \ / _ \| | \_ __ \_/ ___\/ __ \
  1048. // | |__( <_> ) /_/ > | | \ / ( <_> ) | /| | \/\ \__\ ___/
  1049. // |_______ \____/\___ /|__|___| / /_______ /\____/|____/ |__| \___ >___ >
  1050. // \/ /_____/ \/ \/ \/ \/
  1051. // ErrLoginSourceNotExist represents a "LoginSourceNotExist" kind of error.
  1052. type ErrLoginSourceNotExist struct {
  1053. ID int64
  1054. }
  1055. // IsErrLoginSourceNotExist checks if an error is a ErrLoginSourceNotExist.
  1056. func IsErrLoginSourceNotExist(err error) bool {
  1057. _, ok := err.(ErrLoginSourceNotExist)
  1058. return ok
  1059. }
  1060. func (err ErrLoginSourceNotExist) Error() string {
  1061. return fmt.Sprintf("login source does not exist [id: %d]", err.ID)
  1062. }
  1063. // ErrLoginSourceAlreadyExist represents a "LoginSourceAlreadyExist" kind of error.
  1064. type ErrLoginSourceAlreadyExist struct {
  1065. Name string
  1066. }
  1067. // IsErrLoginSourceAlreadyExist checks if an error is a ErrLoginSourceAlreadyExist.
  1068. func IsErrLoginSourceAlreadyExist(err error) bool {
  1069. _, ok := err.(ErrLoginSourceAlreadyExist)
  1070. return ok
  1071. }
  1072. func (err ErrLoginSourceAlreadyExist) Error() string {
  1073. return fmt.Sprintf("login source already exists [name: %s]", err.Name)
  1074. }
  1075. // ErrLoginSourceInUse represents a "LoginSourceInUse" kind of error.
  1076. type ErrLoginSourceInUse struct {
  1077. ID int64
  1078. }
  1079. // IsErrLoginSourceInUse checks if an error is a ErrLoginSourceInUse.
  1080. func IsErrLoginSourceInUse(err error) bool {
  1081. _, ok := err.(ErrLoginSourceInUse)
  1082. return ok
  1083. }
  1084. func (err ErrLoginSourceInUse) Error() string {
  1085. return fmt.Sprintf("login source is still used by some users [id: %d]", err.ID)
  1086. }
  1087. // ___________
  1088. // \__ ___/___ _____ _____
  1089. // | |_/ __ \\__ \ / \
  1090. // | |\ ___/ / __ \| Y Y \
  1091. // |____| \___ >____ /__|_| /
  1092. // \/ \/ \/
  1093. // ErrTeamAlreadyExist represents a "TeamAlreadyExist" kind of error.
  1094. type ErrTeamAlreadyExist struct {
  1095. OrgID int64
  1096. Name string
  1097. }
  1098. // IsErrTeamAlreadyExist checks if an error is a ErrTeamAlreadyExist.
  1099. func IsErrTeamAlreadyExist(err error) bool {
  1100. _, ok := err.(ErrTeamAlreadyExist)
  1101. return ok
  1102. }
  1103. func (err ErrTeamAlreadyExist) Error() string {
  1104. return fmt.Sprintf("team already exists [org_id: %d, name: %s]", err.OrgID, err.Name)
  1105. }
  1106. //
  1107. // Two-factor authentication
  1108. //
  1109. // ErrTwoFactorNotEnrolled indicates that a user is not enrolled in two-factor authentication.
  1110. type ErrTwoFactorNotEnrolled struct {
  1111. UID int64
  1112. }
  1113. // IsErrTwoFactorNotEnrolled checks if an error is a ErrTwoFactorNotEnrolled.
  1114. func IsErrTwoFactorNotEnrolled(err error) bool {
  1115. _, ok := err.(ErrTwoFactorNotEnrolled)
  1116. return ok
  1117. }
  1118. func (err ErrTwoFactorNotEnrolled) Error() string {
  1119. return fmt.Sprintf("user not enrolled in 2FA [uid: %d]", err.UID)
  1120. }
  1121. // ____ ___ .__ .___
  1122. // | | \______ | | _________ __| _/
  1123. // | | /\____ \| | / _ \__ \ / __ |
  1124. // | | / | |_> > |_( <_> ) __ \_/ /_/ |
  1125. // |______/ | __/|____/\____(____ /\____ |
  1126. // |__| \/ \/
  1127. //
  1128. // ErrUploadNotExist represents a "UploadNotExist" kind of error.
  1129. type ErrUploadNotExist struct {
  1130. ID int64
  1131. UUID string
  1132. }
  1133. // IsErrUploadNotExist checks if an error is a ErrUploadNotExist.
  1134. func IsErrUploadNotExist(err error) bool {
  1135. _, ok := err.(ErrAttachmentNotExist)
  1136. return ok
  1137. }
  1138. func (err ErrUploadNotExist) Error() string {
  1139. return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID)
  1140. }
  1141. // ___________ __ .__ .____ .__ ____ ___
  1142. // \_ _____/__ ____/ |_ ___________ ____ _____ | | | | ____ ____ |__| ____ | | \______ ___________
  1143. // | __)_\ \/ /\ __\/ __ \_ __ \/ \\__ \ | | | | / _ \ / ___\| |/ \ | | / ___// __ \_ __ \
  1144. // | \> < | | \ ___/| | \/ | \/ __ \| |__ | |__( <_> ) /_/ > | | \ | | /\___ \\ ___/| | \/
  1145. // /_______ /__/\_ \ |__| \___ >__| |___| (____ /____/ |_______ \____/\___ /|__|___| / |______//____ >\___ >__|
  1146. // \/ \/ \/ \/ \/ \/ /_____/ \/ \/ \/
  1147. // ErrExternalLoginUserAlreadyExist represents a "ExternalLoginUserAlreadyExist" kind of error.
  1148. type ErrExternalLoginUserAlreadyExist struct {
  1149. ExternalID string
  1150. UserID int64
  1151. LoginSourceID int64
  1152. }
  1153. // IsErrExternalLoginUserAlreadyExist checks if an error is a ExternalLoginUserAlreadyExist.
  1154. func IsErrExternalLoginUserAlreadyExist(err error) bool {
  1155. _, ok := err.(ErrExternalLoginUserAlreadyExist)
  1156. return ok
  1157. }
  1158. func (err ErrExternalLoginUserAlreadyExist) Error() string {
  1159. return fmt.Sprintf("external login user already exists [externalID: %s, userID: %d, loginSourceID: %d]", err.ExternalID, err.UserID, err.LoginSourceID)
  1160. }
  1161. // ErrExternalLoginUserNotExist represents a "ExternalLoginUserNotExist" kind of error.
  1162. type ErrExternalLoginUserNotExist struct {
  1163. UserID int64
  1164. LoginSourceID int64
  1165. }
  1166. // IsErrExternalLoginUserNotExist checks if an error is a ExternalLoginUserNotExist.
  1167. func IsErrExternalLoginUserNotExist(err error) bool {
  1168. _, ok := err.(ErrExternalLoginUserNotExist)
  1169. return ok
  1170. }
  1171. func (err ErrExternalLoginUserNotExist) Error() string {
  1172. return fmt.Sprintf("external login user link does not exists [userID: %d, loginSourceID: %d]", err.UserID, err.LoginSourceID)
  1173. }
  1174. // ____ ________________________________ .__ __ __ .__
  1175. // | | \_____ \_ _____/\______ \ ____ ____ |__| _______/ |_____________ _/ |_|__| ____ ____
  1176. // | | // ____/| __) | _// __ \ / ___\| |/ ___/\ __\_ __ \__ \\ __\ |/ _ \ / \
  1177. // | | // \| \ | | \ ___// /_/ > |\___ \ | | | | \// __ \| | | ( <_> ) | \
  1178. // |______/ \_______ \___ / |____|_ /\___ >___ /|__/____ > |__| |__| (____ /__| |__|\____/|___| /
  1179. // \/ \/ \/ \/_____/ \/ \/ \/
  1180. // ErrU2FRegistrationNotExist represents a "ErrU2FRegistrationNotExist" kind of error.
  1181. type ErrU2FRegistrationNotExist struct {
  1182. ID int64
  1183. }
  1184. func (err ErrU2FRegistrationNotExist) Error() string {
  1185. return fmt.Sprintf("U2F registration does not exist [id: %d]", err.ID)
  1186. }
  1187. // IsErrU2FRegistrationNotExist checks if an error is a ErrU2FRegistrationNotExist.
  1188. func IsErrU2FRegistrationNotExist(err error) bool {
  1189. _, ok := err.(ErrU2FRegistrationNotExist)
  1190. return ok
  1191. }
  1192. // .___ ________ .___ .__
  1193. // | | ______ ________ __ ____ \______ \ ____ ______ ____ ____ __| _/____ ____ ____ |__| ____ ______
  1194. // | |/ ___// ___/ | \_/ __ \ | | \_/ __ \\____ \_/ __ \ / \ / __ |/ __ \ / \_/ ___\| |/ __ \ / ___/
  1195. // | |\___ \ \___ \| | /\ ___/ | ` \ ___/| |_> > ___/| | \/ /_/ \ ___/| | \ \___| \ ___/ \___ \
  1196. // |___/____ >____ >____/ \___ >_______ /\___ > __/ \___ >___| /\____ |\___ >___| /\___ >__|\___ >____ >
  1197. // \/ \/ \/ \/ \/|__| \/ \/ \/ \/ \/ \/ \/ \/
  1198. // ErrDependencyExists represents a "DependencyAlreadyExists" kind of error.
  1199. type ErrDependencyExists struct {
  1200. IssueID int64
  1201. DependencyID int64
  1202. }
  1203. // IsErrDependencyExists checks if an error is a ErrDependencyExists.
  1204. func IsErrDependencyExists(err error) bool {
  1205. _, ok := err.(ErrDependencyExists)
  1206. return ok
  1207. }
  1208. func (err ErrDependencyExists) Error() string {
  1209. return fmt.Sprintf("issue dependency does already exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1210. }
  1211. // ErrDependencyNotExists represents a "DependencyAlreadyExists" kind of error.
  1212. type ErrDependencyNotExists struct {
  1213. IssueID int64
  1214. DependencyID int64
  1215. }
  1216. // IsErrDependencyNotExists checks if an error is a ErrDependencyExists.
  1217. func IsErrDependencyNotExists(err error) bool {
  1218. _, ok := err.(ErrDependencyNotExists)
  1219. return ok
  1220. }
  1221. func (err ErrDependencyNotExists) Error() string {
  1222. return fmt.Sprintf("issue dependency does not exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1223. }
  1224. // ErrCircularDependency represents a "DependencyCircular" kind of error.
  1225. type ErrCircularDependency struct {
  1226. IssueID int64
  1227. DependencyID int64
  1228. }
  1229. // IsErrCircularDependency checks if an error is a ErrCircularDependency.
  1230. func IsErrCircularDependency(err error) bool {
  1231. _, ok := err.(ErrCircularDependency)
  1232. return ok
  1233. }
  1234. func (err ErrCircularDependency) Error() string {
  1235. return fmt.Sprintf("circular dependencies exists (two issues blocking each other) [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID)
  1236. }
  1237. // ErrDependenciesLeft represents an error where the issue you're trying to close still has dependencies left.
  1238. type ErrDependenciesLeft struct {
  1239. IssueID int64
  1240. }
  1241. // IsErrDependenciesLeft checks if an error is a ErrDependenciesLeft.
  1242. func IsErrDependenciesLeft(err error) bool {
  1243. _, ok := err.(ErrDependenciesLeft)
  1244. return ok
  1245. }
  1246. func (err ErrDependenciesLeft) Error() string {
  1247. return fmt.Sprintf("issue has open dependencies [issue id: %d]", err.IssueID)
  1248. }
  1249. // ErrUnknownDependencyType represents an error where an unknown dependency type was passed
  1250. type ErrUnknownDependencyType struct {
  1251. Type DependencyType
  1252. }
  1253. // IsErrUnknownDependencyType checks if an error is ErrUnknownDependencyType
  1254. func IsErrUnknownDependencyType(err error) bool {
  1255. _, ok := err.(ErrUnknownDependencyType)
  1256. return ok
  1257. }
  1258. func (err ErrUnknownDependencyType) Error() string {
  1259. return fmt.Sprintf("unknown dependency type [type: %d]", err.Type)
  1260. }
  1261. // __________ .__
  1262. // \______ \ _______ _|__| ______ _ __
  1263. // | _// __ \ \/ / |/ __ \ \/ \/ /
  1264. // | | \ ___/\ /| \ ___/\ /
  1265. // |____|_ /\___ >\_/ |__|\___ >\/\_/
  1266. // \/ \/ \/
  1267. // ErrReviewNotExist represents a "ReviewNotExist" kind of error.
  1268. type ErrReviewNotExist struct {
  1269. ID int64
  1270. }
  1271. // IsErrReviewNotExist checks if an error is a ErrReviewNotExist.
  1272. func IsErrReviewNotExist(err error) bool {
  1273. _, ok := err.(ErrReviewNotExist)
  1274. return ok
  1275. }
  1276. func (err ErrReviewNotExist) Error() string {
  1277. return fmt.Sprintf("review does not exist [id: %d]", err.ID)
  1278. }
  1279. // ________ _____ __ .__
  1280. // \_____ \ / _ \ __ ___/ |_| |__
  1281. // / | \ / /_\ \| | \ __\ | \
  1282. // / | \/ | \ | /| | | Y \
  1283. // \_______ /\____|__ /____/ |__| |___| /
  1284. // \/ \/ \/
  1285. // ErrOAuthClientIDInvalid will be thrown if client id cannot be found
  1286. type ErrOAuthClientIDInvalid struct {
  1287. ClientID string
  1288. }
  1289. // IsErrOauthClientIDInvalid checks if an error is a ErrReviewNotExist.
  1290. func IsErrOauthClientIDInvalid(err error) bool {
  1291. _, ok := err.(ErrOAuthClientIDInvalid)
  1292. return ok
  1293. }
  1294. // Error returns the error message
  1295. func (err ErrOAuthClientIDInvalid) Error() string {
  1296. return fmt.Sprintf("Client ID invalid [Client ID: %s]", err.ClientID)
  1297. }
  1298. // ErrOAuthApplicationNotFound will be thrown if id cannot be found
  1299. type ErrOAuthApplicationNotFound struct {
  1300. ID int64
  1301. }
  1302. // IsErrOAuthApplicationNotFound checks if an error is a ErrReviewNotExist.
  1303. func IsErrOAuthApplicationNotFound(err error) bool {
  1304. _, ok := err.(ErrOAuthApplicationNotFound)
  1305. return ok
  1306. }
  1307. // Error returns the error message
  1308. func (err ErrOAuthApplicationNotFound) Error() string {
  1309. return fmt.Sprintf("OAuth application not found [ID: %d]", err.ID)
  1310. }