From cda2c38f4a61ef7f448be3efab5420d9974c8474 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Thu, 13 Oct 2022 00:21:26 +0000 Subject: [PATCH 01/78] [skip ci] Updated translations via Crowdin --- options/locale/locale_pt-PT.ini | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 1a301ddde6..6c01a06f85 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -146,7 +146,7 @@ sqlite_helper=Localização do ficheiro da base de dados em SQLite3.
Insira u reinstall_error=Está a tentar instalar numa base de dados do Gitea já existente reinstall_confirm_message=Reinstalar com uma base de dados do Gitea já existente pode causar múltiplos problemas. Na maioria dos casos deve usar o seu "app.ini" existente para correr o Gitea. Se souber o que está a fazer, confirme o seguinte: reinstall_confirm_check_1=Os dados encriptados pela chave secreta (SECRET_KEY) no ficheiro app.ini poderão ser perdidos: utilizadores poderão não ser capazes de iniciar a sessão com autenticação em dois passos (2FA) ou com chaves de utilização única (OTP) e as réplicas poderão deixar de funcionar em condições. Ao marcar esta opção estará a confirmar que o ficheiro app.ini vigente contém a SECRET_KEY certa. -reinstall_confirm_check_2=Os repositórios e as configurações poderão ter de voltar a ser sincronizados. Ao marcar esta opção estará a confirmar que vai voltar a sincronizar os automatismos para os repositórios e o ficheiro authorized_keys manualmente. Estará também a confirmar que vai assegurar que as configurações do repositório e das réplicas estão em condições. +reinstall_confirm_check_2=Os repositórios e as configurações poderão ter de voltar a ser sincronizados. Ao marcar esta opção estará a confirmar que vai voltar a sincronizar manualmente os automatismos para os repositórios e o ficheiro authorized_keys. Estará também a confirmar que vai assegurar que as configurações do repositório e das réplicas estão em condições. reinstall_confirm_check_3=Você confirma que tem a certeza absoluta de que este Gitea está a correr com a localização certa do ficheiro app.ini e que tem a certeza de que tem de voltar a instalar. Você confirma que tomou conhecimento dos riscos acima descritos. err_empty_db_path=A localização da base de dados SQLite3 não pode estar vazia. no_admin_and_disable_registration=Não pode desabilitar a auto-inscrição de utilizadores sem criar uma conta de administrador. @@ -1788,16 +1788,16 @@ settings.collaboration.undefined=Não definido settings.hooks=Automatismos web settings.githooks=Automatismos do Git settings.basic_settings=Configurações básicas -settings.mirror_settings=Configurações da réplica +settings.mirror_settings=Configuração de réplicas settings.mirror_settings.docs=Configure o seu repositório para puxar e/ou enviar automaticamente as modificações de/para outro repositório. Ramos, etiquetas e cometimentos serão sincronizados automaticamente. Como é que eu faço uma réplica de outro repositório? settings.mirror_settings.mirrored_repository=Repositório replicado settings.mirror_settings.direction=Sentido settings.mirror_settings.direction.pull=Puxada settings.mirror_settings.direction.push=Envio settings.mirror_settings.last_update=Última modificação -settings.mirror_settings.push_mirror.none=Não foram configuradas quaisquer réplicas de envio +settings.mirror_settings.push_mirror.none=Não foram configuradas quaiquer réplicas deste repositório settings.mirror_settings.push_mirror.remote_url=URL do repositório remoto Git -settings.mirror_settings.push_mirror.add=Adicionar réplica de envio +settings.mirror_settings.push_mirror.add=Adicionar réplica deste repositório settings.sync_mirror=Sincronizar agora settings.mirror_sync_in_progress=A sincronização da réplica está em andamento. Volte a verificar daqui a um minuto. settings.site=Sítio web @@ -2862,7 +2862,7 @@ config.git_max_diff_line_characters=Número máximos de caracteres diff (por lin config.git_max_diff_files=Número máximo de ficheiros diff a serem apresentados config.git_gc_args=Argumentos da recolha de lixo config.git_migrate_timeout=Prazo da migração -config.git_mirror_timeout=Tempo limite da réplica +config.git_mirror_timeout=Prazo para sincronização da réplica config.git_clone_timeout=Prazo da operação de clonagem config.git_pull_timeout=Prazo da operação de puxar config.git_gc_timeout=Prazo da operação de recolha de lixo From c35531dd118ad8fe8ff0c7aa27bb925fb46f09af Mon Sep 17 00:00:00 2001 From: Neel <47709856+neel1996@users.noreply.github.com> Date: Thu, 13 Oct 2022 14:01:10 +0530 Subject: [PATCH 02/78] Fix #21406: Hide repo information from file view/blame mode (#21420) # Summary The repo information such as description, stats and topics are getting displayed in the top-bar when viewing a file. This has been fixed to display the repo information only while navigating the repo and not while viewing or blaming a file from the repo ## Before fix Screenshot from the issue ![image](https://user-images.githubusercontent.com/47709856/195278543-9afbb735-7bd3-4f42-b3ba-da514c6989d2.png) ## After the fix - **Repo homepage** The repo description, topics and summary will be displayed ![image](https://user-images.githubusercontent.com/47709856/195443913-2ca967cd-6694-4a97-98d0-4d0750692b5d.png) - **When opening a file** The repo description, topic and summary has been conditionally hidden from the view image - **When running blame on a file** > This was originally not part of the issue #21406. However the fix seems relevant for the blame view as well. image - **From within a directory** The repo description, topics and summary will not be displayed ![image](https://user-images.githubusercontent.com/47709856/195444080-ff5b2def-7e0f-47d7-b54a-7e9df5f9edd8.png) Supporting integration tests have also been added. --- routers/web/repo/view.go | 2 + templates/repo/home.tmpl | 2 + templates/repo/sub_menu.tmpl | 2 + tests/integration/repo_test.go | 79 +++++++++++++++++++++++++++++++++- 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index a43840467d..3e869376ee 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -119,6 +119,7 @@ func renderDirectory(ctx *context.Context, treeLink string) { } if ctx.Repo.TreePath != "" { + ctx.Data["HideRepoInfo"] = true ctx.Data["Title"] = ctx.Tr("repo.file.title", ctx.Repo.Repository.Name+"/"+path.Base(ctx.Repo.TreePath), ctx.Repo.RefName) } @@ -360,6 +361,7 @@ func renderReadmeFile(ctx *context.Context, readmeFile *namedBlob, readmeTreelin func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink string) { ctx.Data["IsViewFile"] = true + ctx.Data["HideRepoInfo"] = true blob := entry.Blob() dataRc, err := blob.DataAsync() if err != nil { diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index e1aa1c4f3b..9d4842579f 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -3,6 +3,7 @@ {{template "repo/header" .}}
{{template "base/alert" .}} + {{if and (not .HideRepoInfo) (not .IsBlame)}}
{{$description := .Repository.DescriptionHTML $.Context}} @@ -31,6 +32,7 @@ {{range .Topics}}{{.Name}}{{end}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}{{.locale.Tr "repo.topic.manage_topics"}}{{end}}
+ {{end}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}} diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 5b95d3d8e5..eb95674b13 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -413,7 +413,7 @@
{{svg "octicon-calendar" 16 "mr-3"}} - {{.Issue.DeadlineUnix.FormatDate}} +
{{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} diff --git a/templates/repo/settings/deploy_keys.tmpl b/templates/repo/settings/deploy_keys.tmpl index 2f8a4c6c1e..44c916eefb 100644 --- a/templates/repo/settings/deploy_keys.tmpl +++ b/templates/repo/settings/deploy_keys.tmpl @@ -64,7 +64,7 @@ {{.Fingerprint}}
- {{$.locale.Tr "settings.add_on"}} {{.CreatedUnix.FormatShort}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{.UpdatedUnix.FormatShort}}{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} - {{$.locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{$.locale.Tr "settings.can_write_info"}} {{end}} + {{$.locale.Tr "settings.add_on"}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} - {{$.locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{$.locale.Tr "settings.can_write_info"}} {{end}}
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 9030235e7c..3c5996e903 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -93,7 +93,7 @@ {{(MirrorRemoteAddress $.Context .Repository .Mirror.GetRemoteName false).Address}} {{$.locale.Tr "repo.settings.mirror_settings.direction.pull"}} - {{.Mirror.UpdatedUnix.AsTime}} +
{{.CsrfTokenHtml}} @@ -171,7 +171,7 @@ {{$address := MirrorRemoteAddress $.Context $.Repository .GetRemoteName true}} {{$address.Address}} {{$.locale.Tr "repo.settings.mirror_settings.direction.push"}} - {{if .LastUpdateUnix}}{{.LastUpdateUnix.AsTime}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}
{{$.locale.Tr "error"}}
{{end}} + {{if .LastUpdateUnix}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}
{{$.locale.Tr "error"}}
{{end}} {{$.CsrfTokenHtml}} diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl index eec31d8b50..efc8530820 100644 --- a/templates/repo/user_cards.tmpl +++ b/templates/repo/user_cards.tmpl @@ -18,7 +18,7 @@ {{else if .Location}} {{svg "octicon-location"}} {{.Location}} {{else}} - {{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{.CreatedUnix.FormatShort}} + {{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{end}}
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 066d34fe33..6fce412ffa 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -109,7 +109,7 @@ {{svg "octicon-calendar" 14 "mr-2"}} - {{.DeadlineUnix.FormatShort}} + {{end}} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index a4ac65db6a..3b776bc16d 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -53,7 +53,7 @@ {{end}} {{end}} -
  • {{svg "octicon-clock"}} {{.locale.Tr "user.join_on"}} {{.Owner.CreatedUnix.FormatShort}}
  • +
  • {{svg "octicon-clock"}} {{.locale.Tr "user.join_on"}}
  • {{if and .Orgs .HasOrgsVisible}}
    • diff --git a/templates/user/settings/applications.tmpl b/templates/user/settings/applications.tmpl index 9125f4bd00..e05cebb0e4 100644 --- a/templates/user/settings/applications.tmpl +++ b/templates/user/settings/applications.tmpl @@ -23,7 +23,7 @@
      {{.Name}}
      - {{$.locale.Tr "settings.add_on"}} {{.CreatedUnix.FormatShort}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{.UpdatedUnix.FormatShort}}{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} + {{$.locale.Tr "settings.add_on"}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}
      diff --git a/templates/user/settings/grants_oauth2.tmpl b/templates/user/settings/grants_oauth2.tmpl index e67fd2d222..878c258dd3 100644 --- a/templates/user/settings/grants_oauth2.tmpl +++ b/templates/user/settings/grants_oauth2.tmpl @@ -20,7 +20,7 @@
      {{$grant.Application.Name}}
      - {{$.locale.Tr "settings.add_on"}} {{$grant.CreatedUnix.FormatShort}} + {{$.locale.Tr "settings.add_on"}}
      diff --git a/templates/user/settings/keys_gpg.tmpl b/templates/user/settings/keys_gpg.tmpl index 5883508179..fe6c0bbeb1 100644 --- a/templates/user/settings/keys_gpg.tmpl +++ b/templates/user/settings/keys_gpg.tmpl @@ -68,9 +68,9 @@ {{$.locale.Tr "settings.subkeys"}}: {{range .SubsKey}} {{.PaddedKeyID}} {{end}}
      - {{$.locale.Tr "settings.add_on"}} {{.AddedUnix.FormatShort}} + {{$.locale.Tr "settings.add_on"}} - - {{if not .ExpiredUnix.IsZero}}{{$.locale.Tr "settings.valid_until"}} {{.ExpiredUnix.FormatShort}}{{else}}{{$.locale.Tr "settings.valid_forever"}}{{end}} + {{if not .ExpiredUnix.IsZero}}{{$.locale.Tr "settings.valid_until"}} {{else}}{{$.locale.Tr "settings.valid_forever"}}{{end}}
      diff --git a/templates/user/settings/keys_principal.tmpl b/templates/user/settings/keys_principal.tmpl index 5699214468..b0cacbe54c 100644 --- a/templates/user/settings/keys_principal.tmpl +++ b/templates/user/settings/keys_principal.tmpl @@ -25,7 +25,7 @@
      {{.Name}}
      - {{$.locale.Tr "settings.add_on"}} {{.CreatedUnix.FormatShort}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{.UpdatedUnix.FormatShort}}{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} + {{$.locale.Tr "settings.add_on"}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}
      diff --git a/templates/user/settings/keys_ssh.tmpl b/templates/user/settings/keys_ssh.tmpl index bcab968d59..0933953909 100644 --- a/templates/user/settings/keys_ssh.tmpl +++ b/templates/user/settings/keys_ssh.tmpl @@ -58,7 +58,7 @@ {{.Fingerprint}}
      - {{$.locale.Tr "settings.add_on"}} {{.CreatedUnix.FormatShort}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{.UpdatedUnix.FormatShort}}{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} + {{$.locale.Tr "settings.add_on"}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} {{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}
      diff --git a/web_src/js/features/formatting.js b/web_src/js/features/formatting.js index 5f4633bba2..c8f5db9e14 100644 --- a/web_src/js/features/formatting.js +++ b/web_src/js/features/formatting.js @@ -1,7 +1,10 @@ import {prettyNumber} from '../utils.js'; const {lang} = document.documentElement; + const dateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'long', day: 'numeric'}); +const shortDateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric'}); +const dateTimeFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'}); export function initFormattingReplacements() { // replace english formatted numbers with locale-specific separators @@ -13,9 +16,28 @@ export function initFormattingReplacements() { } } - // for each tag, if it has the data-format="date" attribute, format - // the text according to the user's chosen locale - for (const timeElement of document.querySelectorAll('time[data-format="date"]')) { - timeElement.textContent = dateFormatter.format(new Date(timeElement.dateTime)); + // for each tag, if it has the data-format attribute, format + // the text according to the user's chosen locale and formatter. + formatAllTimeElements(); +} + +function formatAllTimeElements() { + const timeElements = document.querySelectorAll('time[data-format]'); + for (const timeElement of timeElements) { + const formatter = getFormatter(timeElement.dataset.format); + timeElement.textContent = formatter.format(new Date(timeElement.dateTime)); + } +} + +function getFormatter(format) { + switch (format) { + case 'date': + return dateFormatter; + case 'short-date': + return shortDateFormatter; + case 'date-time': + return dateTimeFormatter; + default: + throw new Error('Unknown format'); } } From 11ac14cfe12703c56d0c118102ffc207013d4156 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 17 Oct 2022 12:58:20 +0800 Subject: [PATCH 31/78] Fix incorrect notification commit url (#21479) For normal commits the notification url was wrong because oldCommitID is received from the shrinked commits list. This PR moves the commits list shrinking after the oldCommitID assignment. --- services/repository/push.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/repository/push.go b/services/repository/push.go index f3f505aa00..d645928c43 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -219,10 +219,6 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { log.Error("updateIssuesCommit: %v", err) } - if len(commits.Commits) > setting.UI.FeedMaxCommitNum { - commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum] - } - oldCommitID := opts.OldCommitID if oldCommitID == git.EmptySHA && len(commits.Commits) > 0 { oldCommit, err := gitRepo.GetCommit(commits.Commits[len(commits.Commits)-1].Sha1) @@ -250,6 +246,10 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { commits.CompareURL = "" } + if len(commits.Commits) > setting.UI.FeedMaxCommitNum { + commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum] + } + notification.NotifyPushCommits(pusher, repo, opts, commits) if err = git_model.RemoveDeletedBranchByName(repo.ID, branch); err != nil { From 18622a07054e853731e1af96253d1387451b51e2 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 17 Oct 2022 16:40:37 +0200 Subject: [PATCH 32/78] probe if sha before exec git (#21467) --- modules/git/repo_commit.go | 4 ++-- modules/git/sha1_test.go | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 modules/git/sha1_test.go diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 78e037511e..ec72593b80 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -154,8 +154,8 @@ func (repo *Repository) searchCommits(id SHA1, opts SearchCommitsOptions) ([]*Co // then let's iterate over them if len(opts.Keywords) > 0 { for _, v := range opts.Keywords { - // ignore anything below 4 characters as too unspecific - if len(v) >= 4 { + // ignore anything not matching a valid sha pattern + if IsValidSHAPattern(v) { // create new git log command with 1 commit limit hashCmd := NewCommand(repo.Ctx, "log", "-1", prettyLogFormat) // add previous arguments except for --grep and --all diff --git a/modules/git/sha1_test.go b/modules/git/sha1_test.go new file mode 100644 index 0000000000..c5c00f5445 --- /dev/null +++ b/modules/git/sha1_test.go @@ -0,0 +1,21 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package git + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestIsValidSHAPattern(t *testing.T) { + assert.True(t, IsValidSHAPattern("fee1")) + assert.True(t, IsValidSHAPattern("abc000")) + assert.True(t, IsValidSHAPattern("9023902390239023902390239023902390239023")) + assert.False(t, IsValidSHAPattern("90239023902390239023902390239023902390239023")) + assert.False(t, IsValidSHAPattern("abc")) + assert.False(t, IsValidSHAPattern("123g")) + assert.False(t, IsValidSHAPattern("some random text")) +} From a577214760c8f495f315fc569f476d2e72f22ebb Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Mon, 17 Oct 2022 18:23:27 +0200 Subject: [PATCH 33/78] Add some api integration tests (#18872) depends on #18871 Added some api integration tests to help testing of #18798. Co-authored-by: Lunny Xiao Co-authored-by: wxiaoguang Co-authored-by: zeripath Co-authored-by: techknowlogick --- models/fixtures/attachment.yml | 36 + models/fixtures/issue.yml | 85 +- models/fixtures/label.yml | 5 +- models/fixtures/milestone.yml | 9 +- models/fixtures/repository.yml | 1019 ++++++++++++++++++--- models/fixtures/team.yml | 15 +- models/fixtures/topic.yml | 12 +- models/fixtures/user.yml | 924 +++++++++++++++---- models/fixtures/webauthn_credential.yml | 5 +- models/user/user_test.go | 2 +- routers/web/user/home_test.go | 2 +- tests/integration/api_admin_test.go | 44 + tests/integration/api_feed_user_test.go | 38 + tests/integration/api_user_follow_test.go | 111 +++ tests/integration/api_user_info_test.go | 51 ++ tests/integration/api_user_star_test.go | 78 ++ tests/integration/api_user_watch_test.go | 78 ++ 17 files changed, 2225 insertions(+), 289 deletions(-) create mode 100644 tests/integration/api_feed_user_test.go create mode 100644 tests/integration/api_user_follow_test.go create mode 100644 tests/integration/api_user_info_test.go create mode 100644 tests/integration/api_user_star_test.go create mode 100644 tests/integration/api_user_watch_test.go diff --git a/models/fixtures/attachment.yml b/models/fixtures/attachment.yml index 8612f6ece7..9ad43fa2b7 100644 --- a/models/fixtures/attachment.yml +++ b/models/fixtures/attachment.yml @@ -3,9 +3,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 repo_id: 1 issue_id: 1 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -13,9 +16,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12 repo_id: 2 issue_id: 4 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach2 download_count: 1 + size: 0 created_unix: 946684800 - @@ -23,9 +29,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a13 repo_id: 1 issue_id: 2 + release_id: 0 + uploader_id: 0 comment_id: 1 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -33,9 +42,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a14 repo_id: 1 issue_id: 3 + release_id: 0 + uploader_id: 0 comment_id: 1 name: attach2 download_count: 1 + size: 0 created_unix: 946684800 - @@ -43,9 +55,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a15 repo_id: 2 issue_id: 4 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -53,9 +68,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a16 repo_id: 1 issue_id: 5 + release_id: 0 + uploader_id: 0 comment_id: 2 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -63,9 +81,12 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a17 repo_id: 1 issue_id: 5 + release_id: 0 + uploader_id: 0 comment_id: 2 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - @@ -73,34 +94,49 @@ uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a18 repo_id: 3 issue_id: 6 + release_id: 0 + uploader_id: 0 comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - id: 9 uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a19 repo_id: 1 + issue_id: 0 release_id: 1 + uploader_id: 0 + comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - id: 10 uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a20 repo_id: 0 # TestGetAttachment/NotLinked + issue_id: 0 + release_id: 0 uploader_id: 8 + comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 - id: 11 uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a21 repo_id: 40 + issue_id: 0 release_id: 2 + uploader_id: 0 + comment_id: 0 name: attach1 download_count: 0 + size: 0 created_unix: 946684800 diff --git a/models/fixtures/issue.yml b/models/fixtures/issue.yml index 39dacc92ff..4dea8add13 100644 --- a/models/fixtures/issue.yml +++ b/models/fixtures/issue.yml @@ -3,208 +3,287 @@ repo_id: 1 index: 1 poster_id: 1 + original_author_id: 0 name: issue1 content: content for the first issue + milestone_id: 0 + priority: 0 is_closed: false is_pull: false num_comments: 2 created_unix: 946684800 updated_unix: 978307200 + is_locked: false - id: 2 repo_id: 1 index: 2 poster_id: 1 + original_author_id: 0 name: issue2 content: content for the second issue milestone_id: 1 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684810 updated_unix: 978307190 - + is_locked: false - id: 3 repo_id: 1 index: 3 poster_id: 1 + original_author_id: 0 name: issue3 content: content for the third issue milestone_id: 3 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684820 updated_unix: 978307180 + is_locked: false - id: 4 repo_id: 2 index: 1 poster_id: 2 + original_author_id: 0 name: issue4 content: content for the fourth issue + milestone_id: 0 + priority: 0 is_closed: true is_pull: false + num_comments: 0 created_unix: 946684830 updated_unix: 978307200 + is_locked: false - id: 5 repo_id: 1 index: 4 poster_id: 2 + original_author_id: 0 name: issue5 content: content for the fifth issue + milestone_id: 0 + priority: 0 is_closed: true is_pull: false + num_comments: 0 created_unix: 946684840 updated_unix: 978307200 + is_locked: false - id: 6 repo_id: 3 index: 1 poster_id: 1 + original_author_id: 0 name: issue6 content: content6 + milestone_id: 0 + priority: 0 is_closed: false is_pull: false num_comments: 0 created_unix: 946684850 updated_unix: 978307200 + is_locked: false - id: 7 repo_id: 2 index: 2 poster_id: 2 + original_author_id: 0 name: issue7 content: content for the seventh issue + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 946684830 updated_unix: 978307200 + is_locked: false - id: 8 repo_id: 10 index: 1 poster_id: 11 + original_author_id: 0 name: pr2 content: a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684820 updated_unix: 978307180 + is_locked: false - id: 9 repo_id: 48 index: 1 poster_id: 11 + original_author_id: 0 name: pr1 content: a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 946684820 updated_unix: 978307180 + is_locked: false - id: 10 repo_id: 42 index: 1 poster_id: 500 + original_author_id: 0 name: issue from deleted account content: content from deleted account + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 + deadline_unix: 1019307200 created_unix: 946684830 updated_unix: 999307200 - deadline_unix: 1019307200 + is_locked: false - id: 11 repo_id: 1 index: 5 poster_id: 1 + original_author_id: 0 name: pull5 content: content for the a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 1579194806 updated_unix: 1579194806 + is_locked: false - id: 12 repo_id: 3 index: 2 poster_id: 2 + original_author_id: 0 name: pull6 content: content for the a pull request + milestone_id: 0 + priority: 0 is_closed: false is_pull: true + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 - + is_locked: false - id: 13 repo_id: 50 index: 1 poster_id: 2 + original_author_id: 0 name: issue in active repo content: we'll be testing github issue 13171 with this. + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 14 repo_id: 51 index: 1 poster_id: 2 + original_author_id: 0 name: issue in archived repo content: we'll be testing github issue 13171 with this. + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 15 repo_id: 5 index: 1 poster_id: 2 + original_author_id: 0 name: issue in repo not linked to team1 content: content + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 16 repo_id: 32 index: 1 poster_id: 2 + original_author_id: 0 name: just a normal issue content: content + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false - id: 17 repo_id: 32 index: 2 poster_id: 15 + original_author_id: 0 name: a issue with a assignment content: content + milestone_id: 0 + priority: 0 is_closed: false is_pull: false + num_comments: 0 created_unix: 1602935696 updated_unix: 1602935696 + is_locked: false diff --git a/models/fixtures/label.yml b/models/fixtures/label.yml index 1b7ce74681..57bf804457 100644 --- a/models/fixtures/label.yml +++ b/models/fixtures/label.yml @@ -15,10 +15,11 @@ color: '#000000' num_issues: 1 num_closed_issues: 1 + - id: 3 repo_id: 0 - org_id: 3 + org_id: 3 name: orglabel3 color: '#abcdef' num_issues: 0 @@ -32,7 +33,7 @@ color: '#000000' num_issues: 1 num_closed_issues: 0 - + - id: 5 repo_id: 10 diff --git a/models/fixtures/milestone.yml b/models/fixtures/milestone.yml index 4dd3445940..87c30cc96c 100644 --- a/models/fixtures/milestone.yml +++ b/models/fixtures/milestone.yml @@ -6,6 +6,7 @@ is_closed: false num_issues: 1 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 - @@ -16,6 +17,7 @@ is_closed: false num_issues: 0 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 - @@ -26,6 +28,7 @@ is_closed: true num_issues: 1 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 - @@ -36,14 +39,16 @@ is_closed: false num_issues: 0 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 -- +- id: 5 repo_id: 10 - name: milestone of repo 10 + name: milestone of repo 10 content: for testing with PRs is_closed: false num_issues: 0 num_closed_issues: 0 + completeness: 0 deadline_unix: 253370764800 diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml index 82b3ed16dc..f09953be7e 100644 --- a/models/fixtures/repository.yml +++ b/models/fixtures/repository.yml @@ -4,19 +4,29 @@ owner_name: user2 lower_name: repo1 name: repo1 - is_archived: false - is_empty: false - is_private: false + num_watches: 4 + num_stars: 0 + num_forks: 0 num_issues: 2 num_closed_issues: 1 num_pulls: 3 num_closed_pulls: 0 num_milestones: 3 num_closed_milestones: 1 - num_watches: 4 num_projects: 1 num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 2 @@ -24,16 +34,29 @@ owner_name: user2 lower_name: repo2 name: repo2 - is_empty: false - is_archived: false - is_private: true + num_watches: 0 + num_stars: 1 + num_forks: 0 num_issues: 2 num_closed_issues: 1 num_pulls: 0 num_closed_pulls: 0 - num_stars: 1 - close_issues_via_commit_in_any_branch: true + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: true - id: 3 @@ -41,16 +64,29 @@ owner_name: user3 lower_name: repo3 name: repo3 - is_empty: false - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 1 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 num_projects: 1 num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 4 @@ -58,16 +94,29 @@ owner_name: user5 lower_name: repo4 name: repo4 - is_empty: false - is_private: false + num_watches: 0 + num_stars: 1 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_stars: 1 + num_milestones: 0 + num_closed_milestones: 0 num_projects: 0 num_closed_projects: 1 + is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 5 @@ -75,14 +124,29 @@ owner_name: user3 lower_name: repo5 name: repo5 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: true status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 6 @@ -90,13 +154,29 @@ owner_name: user10 lower_name: repo6 name: repo6 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 7 @@ -104,13 +184,29 @@ owner_name: user10 lower_name: repo7 name: repo7 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 8 @@ -118,13 +214,29 @@ owner_name: user10 lower_name: repo8 name: repo8 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 9 @@ -132,13 +244,29 @@ owner_name: user11 lower_name: repo9 name: repo9 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 10 @@ -146,32 +274,59 @@ owner_name: user12 lower_name: repo10 name: repo10 - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 1 num_issues: 0 num_closed_issues: 0 num_pulls: 1 num_closed_pulls: 0 num_milestones: 1 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false - num_forks: 1 status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 11 - fork_id: 10 owner_id: 13 owner_name: user13 lower_name: repo11 name: repo11 - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 10 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 12 @@ -179,13 +334,29 @@ owner_name: user14 lower_name: test_repo_12 name: test_repo_12 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 13 @@ -193,13 +364,29 @@ owner_name: user14 lower_name: test_repo_13 name: test_repo_13 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 14 @@ -208,13 +395,29 @@ lower_name: test_repo_14 name: test_repo_14 description: test_description_14 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 15 @@ -222,9 +425,29 @@ owner_name: user2 lower_name: repo15 name: repo15 - is_empty: false + num_watches: 0 + num_stars: 0 + num_forks: 0 + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 16 @@ -232,14 +455,29 @@ owner_name: user2 lower_name: repo16 name: repo16 - is_empty: false - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 17 @@ -247,15 +485,29 @@ owner_name: user15 lower_name: big_test_public_1 name: big_test_public_1 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 18 @@ -263,14 +515,29 @@ owner_name: user15 lower_name: big_test_public_2 name: big_test_public_2 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 19 @@ -278,14 +545,29 @@ owner_name: user15 lower_name: big_test_private_1 name: big_test_private_1 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 20 @@ -293,14 +575,29 @@ owner_name: user15 lower_name: big_test_private_2 name: big_test_private_2 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 21 @@ -308,14 +605,29 @@ owner_name: user16 lower_name: big_test_public_3 name: big_test_public_3 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 22 @@ -323,14 +635,29 @@ owner_name: user16 lower_name: big_test_private_3 name: big_test_private_3 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 23 @@ -338,14 +665,29 @@ owner_name: user17 lower_name: big_test_public_4 name: big_test_public_4 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 24 @@ -353,14 +695,29 @@ owner_name: user17 lower_name: big_test_private_4 name: big_test_private_4 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 25 @@ -368,15 +725,29 @@ owner_name: user20 lower_name: big_test_public_mirror_5 name: big_test_public_mirror_5 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: true - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 26 @@ -384,15 +755,29 @@ owner_name: user20 lower_name: big_test_private_mirror_5 name: big_test_private_mirror_5 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: true - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 27 @@ -400,16 +785,29 @@ owner_name: user19 lower_name: big_test_public_mirror_6 name: big_test_public_mirror_6 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 1 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: true - num_forks: 1 - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 28 @@ -417,48 +815,89 @@ owner_name: user19 lower_name: big_test_private_mirror_6 name: big_test_private_mirror_6 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 1 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 - num_watches: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: true - num_forks: 1 - is_fork: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 29 - fork_id: 27 owner_id: 20 owner_name: user20 lower_name: big_test_public_fork_7 name: big_test_public_fork_7 - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false - is_fork: true status: 0 + is_fork: true + fork_id: 27 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 30 - fork_id: 28 owner_id: 20 owner_name: user20 lower_name: big_test_private_fork_7 name: big_test_private_fork_7 - is_private: true + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 0 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false - is_fork: true status: 0 + is_fork: true + fork_id: 28 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 31 @@ -466,13 +905,29 @@ owner_name: user2 lower_name: repo20 name: repo20 - is_empty: false - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 32 # org public repo @@ -480,12 +935,29 @@ owner_name: user3 lower_name: repo21 name: repo21 - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 2 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 33 @@ -493,9 +965,29 @@ owner_name: user2 lower_name: utf8 name: utf8 - is_empty: false + num_watches: 0 + num_stars: 0 + num_forks: 0 + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 34 @@ -503,12 +995,29 @@ owner_name: user21 lower_name: golang name: golang - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 35 @@ -516,12 +1025,29 @@ owner_name: user21 lower_name: graphql name: graphql - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 36 @@ -529,13 +1055,29 @@ owner_name: user2 lower_name: commits_search_test name: commits_search_test - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 37 @@ -543,13 +1085,29 @@ owner_name: user2 lower_name: git_hooks_test name: git_hooks_test - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 38 @@ -557,13 +1115,29 @@ owner_name: limited_org lower_name: public_repo_on_limited_org name: public_repo_on_limited_org - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 39 @@ -571,13 +1145,29 @@ owner_name: limited_org lower_name: private_repo_on_limited_org name: private_repo_on_limited_org - is_empty: false - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 40 @@ -585,13 +1175,29 @@ owner_name: privated_org lower_name: public_repo_on_private_org name: public_repo_on_private_org - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 41 @@ -599,12 +1205,29 @@ owner_name: privated_org lower_name: private_repo_on_private_org name: private_repo_on_private_org - is_empty: false - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: false + is_archived: false is_mirror: false + status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 42 @@ -612,14 +1235,29 @@ owner_name: user2 lower_name: glob name: glob - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 1 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 num_milestones: 1 - is_mirror: + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false is_archived: false + is_mirror: false + status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 43 @@ -627,12 +1265,29 @@ owner_name: org26 lower_name: repo26 name: repo26 - is_private: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: true + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 44 @@ -640,14 +1295,29 @@ owner_name: user27 lower_name: template1 name: template1 - is_empty: false - is_private: false - is_template: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: true + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 45 @@ -655,13 +1325,29 @@ owner_name: user27 lower_name: template2 name: template2 - is_private: false - is_template: true + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: true + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: true + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 46 @@ -669,13 +1355,29 @@ owner_name: org26 lower_name: repo_external_tracker name: repo_external_tracker - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 47 @@ -683,13 +1385,29 @@ owner_name: org26 lower_name: repo_external_tracker_numeric name: repo_external_tracker_numeric - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 48 @@ -697,14 +1415,29 @@ owner_name: org26 lower_name: repo_external_tracker_alpha name: repo_external_tracker_alpha - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 num_pulls: 1 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 49 @@ -712,13 +1445,29 @@ owner_name: user27 lower_name: repo49 name: repo49 - is_empty: false - is_private: false + num_watches: 0 num_stars: 0 num_forks: 0 num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 50 @@ -726,19 +1475,29 @@ owner_name: user30 lower_name: repo50 name: repo50 - is_archived: false - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 num_milestones: 0 num_closed_milestones: 0 - num_watches: 0 num_projects: 0 num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 51 @@ -746,19 +1505,29 @@ owner_name: user30 lower_name: repo51 name: repo51 - is_archived: true - is_empty: false - is_private: false + num_watches: 0 + num_stars: 0 + num_forks: 0 num_issues: 1 num_closed_issues: 0 num_pulls: 0 num_closed_pulls: 0 num_milestones: 0 num_closed_milestones: 0 - num_watches: 0 num_projects: 0 num_closed_projects: 0 + is_private: false + is_empty: false + is_archived: true + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false - id: 52 @@ -766,6 +1535,26 @@ owner_name: user30 lower_name: empty name: empty - is_empty: true + num_watches: 0 + num_stars: 0 + num_forks: 0 + num_issues: 0 + num_closed_issues: 0 + num_pulls: 0 + num_closed_pulls: 0 + num_milestones: 0 + num_closed_milestones: 0 + num_projects: 0 + num_closed_projects: 0 is_private: true + is_empty: true + is_archived: false + is_mirror: false status: 0 + is_fork: false + fork_id: 0 + is_template: false + template_id: 0 + size: 0 + is_fsck_enabled: true + close_issues_via_commit_in_any_branch: false diff --git a/models/fixtures/team.yml b/models/fixtures/team.yml index 880f49dc90..ea47a33f1c 100644 --- a/models/fixtures/team.yml +++ b/models/fixtures/team.yml @@ -6,6 +6,7 @@ authorize: 4 # owner num_repos: 3 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -16,6 +17,7 @@ authorize: 2 # write num_repos: 1 num_members: 2 + includes_all_repositories: false can_create_org_repo: false - @@ -26,6 +28,7 @@ authorize: 4 # owner num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -36,6 +39,7 @@ authorize: 4 # owner num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -46,6 +50,7 @@ authorize: 4 # owner num_repos: 2 num_members: 2 + includes_all_repositories: false can_create_org_repo: true - @@ -56,6 +61,7 @@ authorize: 4 # owner num_repos: 2 num_members: 2 + includes_all_repositories: false can_create_org_repo: true - @@ -66,6 +72,7 @@ authorize: 2 # write num_repos: 1 num_members: 1 + includes_all_repositories: false can_create_org_repo: false - @@ -76,6 +83,7 @@ authorize: 2 # write num_repos: 1 num_members: 1 + includes_all_repositories: false can_create_org_repo: false - @@ -86,6 +94,7 @@ authorize: 1 # read num_repos: 1 num_members: 2 + includes_all_repositories: false can_create_org_repo: false - @@ -93,9 +102,10 @@ org_id: 25 lower_name: notowners name: NotOwners - authorize: 1 # owner + authorize: 1 # read num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: false - @@ -106,6 +116,7 @@ authorize: 1 # read num_repos: 0 num_members: 0 + includes_all_repositories: false can_create_org_repo: false - @@ -116,6 +127,7 @@ authorize: 3 # admin num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: true - @@ -126,4 +138,5 @@ authorize: 3 # admin num_repos: 0 num_members: 1 + includes_all_repositories: false can_create_org_repo: false diff --git a/models/fixtures/topic.yml b/models/fixtures/topic.yml index 6cd0b37fa1..055addf510 100644 --- a/models/fixtures/topic.yml +++ b/models/fixtures/topic.yml @@ -8,18 +8,22 @@ name: database repo_count: 1 -- id: 3 +- + id: 3 name: SQL repo_count: 1 -- id: 4 +- + id: 4 name: graphql repo_count: 1 -- id: 5 +- + id: 5 name: topicname1 repo_count: 1 -- id: 6 +- + id: 6 name: topicname2 repo_count: 2 diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index 790156189a..0e3348e146 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -4,611 +4,1219 @@ id: 1 lower_name: user1 name: user1 - login_name: user1 full_name: User One email: user1@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user1 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: true + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar1 avatar_email: user1@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 2 lower_name: user2 name: user2 - login_name: user2 - full_name: " < Ur Tw >< " + full_name: ' < Ur Tw >< ' email: user2@example.com keep_email_private: true email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user2 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar2 avatar_email: user2@example.com - num_repos: 9 - num_stars: 2 + use_custom_avatar: false num_followers: 2 num_following: 1 - is_active: true + num_stars: 2 + num_repos: 9 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 3 lower_name: user3 name: user3 - login_name: user3 - full_name: " <<<< >> >> > >> > >>> >> " + full_name: ' <<<< >> >> > >> > >>> >> ' email: user3@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user3 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar3 avatar_email: user3@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - num_members: 3 num_teams: 4 + num_members: 3 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 4 lower_name: user4 name: user4 - login_name: user4 - full_name: " " + full_name: ' ' email: user4@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user4 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar4 avatar_email: user4@example.com - num_repos: 0 + use_custom_avatar: false + num_followers: 0 num_following: 1 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 5 lower_name: user5 name: user5 - login_name: user5 full_name: User Five email: user5@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user5 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: false + prohibit_login: false avatar: avatar5 avatar_email: user5@example.com - num_repos: 1 - allow_create_organization: false - is_active: true + use_custom_avatar: false + num_followers: 0 num_following: 0 + num_stars: 0 + num_repos: 1 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 6 lower_name: user6 name: user6 - login_name: user6 full_name: User Six email: user6@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user6 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar6 avatar_email: user6@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - num_members: 2 num_teams: 2 + num_members: 2 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 7 lower_name: user7 name: user7 - login_name: user7 full_name: User Seven email: user7@example.com + keep_email_private: false email_notifications_preference: disabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user7 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar7 avatar_email: user7@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - num_members: 1 num_teams: 1 + num_members: 1 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 8 lower_name: user8 name: user8 - login_name: user8 full_name: User Eight email: user8@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user8 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar8 avatar_email: user8@example.com - num_repos: 0 - is_active: true + use_custom_avatar: false num_followers: 1 num_following: 1 + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 9 lower_name: user9 name: user9 - login_name: user9 full_name: User Nine email: user9@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user9 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar9 avatar_email: user9@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: false + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 10 lower_name: user10 name: user10 - login_name: user10 full_name: User Ten email: user10@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user10 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar10 avatar_email: user10@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 11 lower_name: user11 name: user11 - login_name: user11 full_name: User Eleven email: user11@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user11 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar11 avatar_email: user11@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 1 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 12 lower_name: user12 name: user12 - login_name: user12 full_name: User 12 email: user12@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user12 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar12 avatar_email: user12@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 1 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 13 lower_name: user13 name: user13 - login_name: user13 full_name: User 13 email: user13@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user13 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar13 avatar_email: user13@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 1 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 14 lower_name: user14 name: user14 - login_name: user14 full_name: User 14 email: user14@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user14 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar14 avatar_email: user13@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 15 lower_name: user15 name: user15 - login_name: user15 full_name: User 15 email: user15@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user15 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar15 avatar_email: user15@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 4 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 16 lower_name: user16 name: user16 - login_name: user16 full_name: User 16 email: user16@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user16 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar16 avatar_email: user16@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 17 lower_name: user17 name: user17 - login_name: user17 full_name: User 17 email: user17@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user17 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar17 avatar_email: user17@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 4 num_teams: 3 + num_members: 4 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 18 lower_name: user18 name: user18 - login_name: user18 full_name: User 18 email: user18@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user18 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar18 avatar_email: user18@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 19 lower_name: user19 name: user19 - login_name: user19 full_name: User 19 email: user19@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: user19 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar19 avatar_email: user19@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 2 num_teams: 1 + num_members: 2 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 20 lower_name: user20 name: user20 - login_name: user20 full_name: User 20 email: user20@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user20 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar20 avatar_email: user20@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 4 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 21 lower_name: user21 name: user21 - login_name: user21 full_name: User 21 email: user21@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user21 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar21 avatar_email: user21@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 22 lower_name: limited_org name: limited_org - login_name: limited_org full_name: Limited Org email: limited_org@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: limited_org + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar22 avatar_email: limited_org@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 0 num_teams: 0 + num_members: 0 visibility: 1 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 23 lower_name: privated_org name: privated_org - login_name: privated_org full_name: Privated Org email: privated_org@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: privated_org + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar23 avatar_email: privated_org@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 2 - is_active: true - num_members: 0 num_teams: 0 + num_members: 0 visibility: 2 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 24 lower_name: user24 name: user24 - login_name: user24 - full_name: "user24" + full_name: user24 email: user24@example.com keep_email_private: true + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user24 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar24 avatar_email: user24@example.com - num_repos: 0 - num_stars: 0 + use_custom_avatar: false num_followers: 0 num_following: 0 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 25 lower_name: org25 name: org25 - login_name: org25 - full_name: "org25" + full_name: org25 email: org25@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: org25 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar25 avatar_email: org25@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - num_members: 1 num_teams: 1 + num_members: 1 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 26 lower_name: org26 name: org26 - login_name: org26 - full_name: "Org26" + full_name: Org26 email: org26@example.com + keep_email_private: false email_notifications_preference: onmention + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 1 # organization + must_change_password: false + login_source: 0 + login_name: org26 + type: 1 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: false is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar26 avatar_email: org26@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 4 - num_members: 0 num_teams: 1 + num_members: 0 + visibility: 0 repo_admin_change_team_access: true + theme: "" + keep_activity_private: false - id: 27 lower_name: user27 name: user27 - login_name: user27 full_name: User Twenty-Seven email: user27@example.com + keep_email_private: false email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user27 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar27 avatar_email: user27@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 28 lower_name: user28 name: user28 - login_name: user28 - full_name: "user27" + full_name: user27 email: user28@example.com keep_email_private: true + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user28 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar28 avatar_email: user28@example.com - num_repos: 0 - num_stars: 0 + use_custom_avatar: false num_followers: 0 num_following: 0 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 29 lower_name: user29 name: user29 - login_name: user29 full_name: User 29 email: user29@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user29 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false is_restricted: true + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar29 avatar_email: user29@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 30 lower_name: user30 name: user30 - login_name: user30 full_name: User Thirty email: user30@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user30 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false is_restricted: true + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: true avatar: avatar29 avatar_email: user30@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 3 - is_active: true - prohibit_login: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 31 lower_name: user31 name: user31 - login_name: user31 - full_name: "user31" + full_name: user31 email: user31@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user31 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false - visibility: 2 + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar31 avatar_email: user31@example.com - num_repos: 0 + use_custom_avatar: false num_followers: 0 num_following: 1 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 2 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 32 lower_name: user32 name: user32 - login_name: user32 full_name: User 32 (U2F test) email: user32@example.com - passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a # password - type: 0 # individual + keep_email_private: false + email_notifications_preference: enabled + passwd: 7d93daa0d1e6f2305cc8fa496847d61dc7320bb16262f9c55dd753480207234cdd96a93194e408341971742f4701772a025a + passwd_hash_algo: argon2 + must_change_password: false + login_source: 0 + login_name: user32 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar32 avatar_email: user30@example.com + use_custom_avatar: false + num_followers: 0 + num_following: 0 + num_stars: 0 num_repos: 0 - is_active: true + num_teams: 0 + num_members: 0 + visibility: 0 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false - id: 33 lower_name: user33 name: user33 - login_name: user33 full_name: User 33 (Limited Visibility) email: user33@example.com + keep_email_private: false + email_notifications_preference: enabled + passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b passwd_hash_algo: argon2 - passwd: a3d5fcd92bae586c2e3dbe72daea7a0d27833a8d0227aa1704f4bbd775c1f3b03535b76dd93b0d4d8d22a519dca47df1547b # password - type: 0 # individual + must_change_password: false + login_source: 0 + login_name: user33 + type: 0 salt: ZogKvWdyEx + max_repo_creation: -1 + is_active: true is_admin: false - visibility: 1 + is_restricted: false + allow_git_hook: false + allow_import_local: false + allow_create_organization: true + prohibit_login: false avatar: avatar33 avatar_email: user33@example.com - num_repos: 0 + use_custom_avatar: false num_followers: 1 num_following: 0 - is_active: true + num_stars: 0 + num_repos: 0 + num_teams: 0 + num_members: 0 + visibility: 1 + repo_admin_change_team_access: false + theme: "" + keep_activity_private: false diff --git a/models/fixtures/webauthn_credential.yml b/models/fixtures/webauthn_credential.yml index b4109a03f2..bc43127fcd 100644 --- a/models/fixtures/webauthn_credential.yml +++ b/models/fixtures/webauthn_credential.yml @@ -1,5 +1,6 @@ -- id: 1 - name: "WebAuthn credential" +- + id: 1 + name: WebAuthn credential user_id: 32 attestation_type: none sign_count: 0 diff --git a/models/user/user_test.go b/models/user/user_test.go index 678d6c186c..5f2ac0a60c 100644 --- a/models/user/user_test.go +++ b/models/user/user_test.go @@ -102,7 +102,7 @@ func TestSearchUsers(t *testing.T) { []int64{9}) testUserSuccess(&user_model.SearchUserOptions{OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue}, - []int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 28, 29, 30, 32}) + []int64{1, 2, 4, 5, 8, 10, 11, 12, 13, 14, 15, 16, 18, 20, 21, 24, 27, 28, 29, 30, 32}) testUserSuccess(&user_model.SearchUserOptions{Keyword: "user1", OrderBy: "id ASC", ListOptions: db.ListOptions{Page: 1}, IsActive: util.OptionalBoolTrue}, []int64{1, 10, 11, 12, 13, 14, 15, 16, 18}) diff --git a/routers/web/user/home_test.go b/routers/web/user/home_test.go index 9ad0711dc0..36e99bba5e 100644 --- a/routers/web/user/home_test.go +++ b/routers/web/user/home_test.go @@ -76,7 +76,7 @@ func TestPulls(t *testing.T) { Pulls(ctx) assert.EqualValues(t, http.StatusOK, ctx.Resp.Status()) - assert.Len(t, ctx.Data["Issues"], 3) + assert.Len(t, ctx.Data["Issues"], 4) } func TestMilestones(t *testing.T) { diff --git a/tests/integration/api_admin_test.go b/tests/integration/api_admin_test.go index dea0bdd063..d6bc6016ff 100644 --- a/tests/integration/api_admin_test.go +++ b/tests/integration/api_admin_test.go @@ -167,6 +167,33 @@ func TestAPICreateUserInvalidEmail(t *testing.T) { session.MakeRequest(t, req, http.StatusUnprocessableEntity) } +func TestAPICreateAndDeleteUser(t *testing.T) { + defer tests.PrepareTestEnv(t)() + adminUsername := "user1" + session := loginUser(t, adminUsername) + token := getTokenForLoggedInUser(t, session) + + req := NewRequestWithValues( + t, + "POST", + fmt.Sprintf("/api/v1/admin/users?token=%s", token), + map[string]string{ + "email": "deleteme@domain.com", + "full_name": "delete me", + "login_name": "deleteme", + "must_change_password": "true", + "password": "password", + "send_notify": "true", + "source_id": "0", + "username": "deleteme", + }, + ) + MakeRequest(t, req, http.StatusCreated) + + req = NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/admin/users/deleteme?token=%s", token)) + MakeRequest(t, req, http.StatusNoContent) +} + func TestAPIEditUser(t *testing.T) { defer tests.PrepareTestEnv(t)() adminUsername := "user1" @@ -209,3 +236,20 @@ func TestAPIEditUser(t *testing.T) { user2 = unittest.AssertExistsAndLoadBean(t, &user_model.User{LoginName: "user2"}) assert.True(t, user2.IsRestricted) } + +func TestAPICreateRepoForUser(t *testing.T) { + defer tests.PrepareTestEnv(t)() + adminUsername := "user1" + session := loginUser(t, adminUsername) + token := getTokenForLoggedInUser(t, session) + + req := NewRequestWithJSON( + t, + "POST", + fmt.Sprintf("/api/v1/admin/users/%s/repos?token=%s", adminUsername, token), + &api.CreateRepoOption{ + Name: "admincreatedrepo", + }, + ) + MakeRequest(t, req, http.StatusCreated) +} diff --git a/tests/integration/api_feed_user_test.go b/tests/integration/api_feed_user_test.go new file mode 100644 index 0000000000..c137dd1209 --- /dev/null +++ b/tests/integration/api_feed_user_test.go @@ -0,0 +1,38 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestFeed(t *testing.T) { + t.Run("User", func(t *testing.T) { + t.Run("Atom", func(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/user2.atom") + resp := MakeRequest(t, req, http.StatusOK) + + data := resp.Body.String() + assert.Contains(t, data, ` Date: Mon, 17 Oct 2022 23:29:57 +0200 Subject: [PATCH 34/78] Docs: Update the feature comparison to other Git Hosting Services (#20933) This was drastically outdated recently. --- docs/content/doc/features/comparison.en-us.md | 186 +++++++++--------- 1 file changed, 97 insertions(+), 89 deletions(-) diff --git a/docs/content/doc/features/comparison.en-us.md b/docs/content/doc/features/comparison.en-us.md index 89d92b2565..9baa6d5123 100644 --- a/docs/content/doc/features/comparison.en-us.md +++ b/docs/content/doc/features/comparison.en-us.md @@ -21,7 +21,7 @@ menu: To help decide if Gitea is suited for your needs, here is how it compares to other Git self hosted options. -Be warned that we don't regularly check for feature changes in other products, so this list may be outdated. If you find anything that needs to be updated in the table below, please report it in an [issue on GitHub](https://github.com/go-gitea/gitea/issues). +Be warned that we don't regularly check for feature changes in other products, so this list may be outdated. If you find anything that needs to be updated in the table below, please [open an issue](https://github.com/go-gitea/gitea/issues/new/choose). _Symbols used in table:_ @@ -33,103 +33,111 @@ _Symbols used in table:_ ## General Features -| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -| ----------------------------------- | ---------------------------------------------------| ---- | --------- | --------- | --------- | -------------- | ------------ | -| Open source and free | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | -| Low resource usage (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | -| Multiple database support | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ | -| Multiple OS support | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | -| Easy upgrade process | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ | -| Markdown support | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Orgmode support | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ? | -| CSV support | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? | -| Third-party render tool support | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? | -| Static Git-powered pages | [✘](https://github.com/go-gitea/gitea/issues/302) | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Integrated Git-powered wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (cloud only) | ✘ | -| Deploy Tokens | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Repository Tokens with write rights | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Built-in Package/Container Registry | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| External git mirroring | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | -| WebAuthn (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ? | -| Built-in CI/CD | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Subgroups: groups within groups | [✘](https://github.com/go-gitea/gitea/issues/1872) | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ | -| Mermaid diagrams in Markdown | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Math syntax in Markdown | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ------------------------------------------------ | --------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ | +| Open source and free | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | +| Low RAM/ CPU usage | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | +| Multiple database support | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ | +| Multiple OS support | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | +| Easy upgrades | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ | +| Telemetry | **✘** | ✘ | ✓ | ✓ | ✓ | ✓ | ? | +| Third-party render tool support | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? | +| WebAuthn (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ? | +| Extensive API | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Built-in Package/Container Registry | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Sync commits to an external repo (push mirror) | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ | +| Sync commits from an external repo (pull mirror) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ? | +| Light and Dark Theme | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ? | +| Custom Theme Support | ✓ | ✓ | ✘ | ✘ | ✘ | ✓ | ✘ | +| Markdown support | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| CSV support | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? | +| 'GitHub / GitLab pages' | [✘](https://github.com/go-gitea/gitea/issues/302) | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Repo-specific wiki (as a repo itself) | ✓ | ✓ | ✓ | ✓ | ✓ | / | ✘ | +| Deploy Tokens | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Repository Tokens with write rights | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| RSS Feeds | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ✘ | +| Built-in CI/CD | [✘](https://github.com/go-gitea/gitea/issues/13539) | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Subgroups: groups within groups | [✘](https://github.com/go-gitea/gitea/issues/1872) | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ | +| Interaction with other instances | [/](https://github.com/go-gitea/gitea/issues/18240) | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | +| Mermaid diagrams in Markdown | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Math syntax in Markdown | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | ## Code management -| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -| -------------------------------------------- | ------------------------------------------------ | ---- | --------- | --------- | --------- | --------- | ------------ | -| Repository topics | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Repository code search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Global code search | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ | -| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Group Milestones | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| Granular user roles (Code, Issues, Wiki etc) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| Verified Committer | ⁄ | ✘ | ? | ✓ | ✓ | ✓ | ✘ | -| GPG Signed Commits | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| SSH Signed Commits | ✓ | ✘ | ✘ | ✘ | ✘ | ? | ? | -| Reject unsigned commits | [✓](https://github.com/go-gitea/gitea/pull/9708) | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Repository Activity page | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Branch manager | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Create new branches | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Web code editor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Commit graph | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Template Repositories | [✓](https://github.com/go-gitea/gitea/pull/8768) | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ | +| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ------------------------------------------- | --------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ | +| Repository topics | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Repository code search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Global code search | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ | +| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Group Milestones | [✘](https://github.com/go-gitea/gitea/issues/14622) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| Granular user roles (Code, Issues, Wiki, …) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| Verified Committer | ⁄ | ✘ | ? | ✓ | ✓ | ✓ | ✘ | +| GPG Signed Commits | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| SSH Signed Commits | ✓ | ✘ | ✓ | ✘ | ✘ | ? | ? | +| Reject unsigned commits | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Migrating repos from other services | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Repository Activity page | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Branch manager | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Create new branches | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Web code editor | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Commit graph | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Template Repositories | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✘ | +| Git Blame | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Visual comparison of image changes | ✓ | ✘ | ✓ | ? | ? | ? | ? | ## Issue Tracker -| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -| ------------------------------- | -------------------------------------------------- | --------------------------------------------- | --------- | ----------------------------------------------------------------------- | --------- | -------------- | ------------ | -| Issue tracker | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (cloud only) | ✘ | -| Issue templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Labels | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Time tracking | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Multiple assignees for issues | ✓ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ | -| Related issues | ✘ | ✘ | ⁄ | [✓](https://docs.gitlab.com/ce/user/project/issues/related_issues.html) | ✓ | ✘ | ✘ | -| Confidential issues | [✘](https://github.com/go-gitea/gitea/issues/3217) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| Comment reactions | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Lock Discussion | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Batch issue handling | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Issue Boards (Kanban) | [✓](https://github.com/go-gitea/gitea/pull/8346) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| Create new branches from issues | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| Issue search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Global issue search | [✘](https://github.com/go-gitea/gitea/issues/2434) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Issue dependency | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | -| Create issue via email | [✘](https://github.com/go-gitea/gitea/issues/6226) | [✘](https://github.com/gogs/gogs/issues/2602) | ✘ | ✘ | ✓ | ✓ | ✘ | -| Service Desk | [✘](https://github.com/go-gitea/gitea/issues/6219) | ✘ | ✘ | [✓](https://gitlab.com/groups/gitlab-org/-/epics/3103) | ✓ | ✘ | ✘ | +| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ----------------------------- | --------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ | +| Issue tracker | ✓ | ✓ | ✓ | ✓ | ✓ | / | ✘ | +| Issue templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Labels | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Time tracking | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Multiple assignees for issues | ✓ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ | +| Related issues | ✘ | ✘ | ⁄ | ✓ | ✓ | ✘ | ✘ | +| Confidential issues | [✘](https://github.com/go-gitea/gitea/issues/3217) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| Comment reactions | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Lock Discussion | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Batch issue handling | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Issue Boards (Kanban) | [/](https://github.com/go-gitea/gitea/issues/14710) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| Create branch from issue | [✘](https://github.com/go-gitea/gitea/issues/20226) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| Convert comment to new issue | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Issue search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Global issue search | [/](https://github.com/go-gitea/gitea/issues/2434) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Issue dependency | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | +| Create issue via email | [✘](https://github.com/go-gitea/gitea/issues/6226) | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | +| Service Desk | [✘](https://github.com/go-gitea/gitea/issues/6219) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | ## Pull/Merge requests -| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -| ----------------------------------------------- | -------------------------------------------------- | ---- | --------- | --------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------ | ------------ | -| Pull/Merge requests | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Squash merging | ✓ | ✘ | ✓ | [✓](https://docs.gitlab.com/ce/user/project/merge_requests/squash_and_merge.html) | ✓ | ✓ | ✓ | -| Rebase merging | ✓ | ✓ | ✓ | ✘ | ⁄ | ✘ | ✓ | -| Pull/Merge request inline comments | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Pull/Merge request approval | ✓ | ✘ | ⁄ | ✓ | ✓ | ✓ | ✓ | -| Merge conflict resolution | [✘](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Restrict push and merge access to certain users | ✓ | ✘ | ✓ | ⁄ | ✓ | ✓ | ✓ | -| Revert specific commits or a merge request | [✘](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Pull/Merge requests templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Cherry-picking changes | [✘](https://github.com/go-gitea/gitea/issues/5158) | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | -| Download Patch | ✓ | ✘ | ✓ | ✓ | ✓ | [/](https://jira.atlassian.com/plugins/servlet/mobile#issue/BCLOUD-8323) | ✘ | +| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ----------------------------------------------- | -------------------------------------------------- | ---- | --------- | --------- | --------- | --------- | ------------ | +| Pull/Merge requests | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Squash merging | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Rebase merging | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Pull/Merge request inline comments | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Pull/Merge request approval | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Merge conflict resolution | [✘](https://github.com/go-gitea/gitea/issues/9014) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Restrict push and merge access to certain users | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Revert specific commits | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Pull/Merge requests templates | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | +| Cherry-picking changes | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ | +| Download Patch | ✓ | ✘ | ✓ | ✓ | ✓ | / | ✘ | ## 3rd-party integrations -| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | -| ---------------------------------------------- | ------------------------------------------------ | ---- | --------- | --------- | --------- | --------- | ------------ | -| Webhook support | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Custom Git Hooks | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| AD / LDAP integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Multiple LDAP / AD server support | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | -| LDAP user synchronization | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | -| SAML 2.0 service provider | [✘](https://github.com/go-gitea/gitea/issues/5512) | [✘](https://github.com/gogs/gogs/issues/1221) | ✓ | ✓ | ✓ | ✓ | ✘ | -| OpenId Connect support | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ | -| OAuth 2.0 integration (external authorization) | ✓ | ✘ | ⁄ | ✓ | ✓ | ? | ✓ | -| Act as OAuth 2.0 provider | [✓](https://github.com/go-gitea/gitea/pull/5378) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Two factor authentication (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | -| Mattermost/Slack integration | ✓ | ✓ | ⁄ | ✓ | ✓ | ⁄ | ✓ | -| Discord integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ | -| Microsoft Teams integration | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | -| External CI/CD status display | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Feature | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE | +| ---------------------------------------------- | ------------------------------------------------ | ---- | --------- | --------- | --------- | --------- | ------------ | +| Webhooks | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Git Hooks | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| AD / LDAP integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | +| Multiple LDAP / AD server support | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ | +| LDAP user synchronization | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | +| SAML 2.0 service provider | [✘](https://github.com/go-gitea/gitea/issues/5512) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| OpenID Connect support | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ | +| OAuth 2.0 integration (external authorization) | ✓ | ✘ | ⁄ | ✓ | ✓ | ? | ✓ | +| Act as OAuth 2.0 provider | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Two factor authentication (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | +| Integration with the most common services | ✓ | / | ⁄ | ✓ | ✓ | ⁄ | ✓ | +| Incorporate external CI/CD | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ | From c0888def506f0ca74d3499bb6941a8743f6a5206 Mon Sep 17 00:00:00 2001 From: rock2dust Date: Tue, 18 Oct 2022 05:30:30 +0800 Subject: [PATCH 35/78] Update reverse-proxies.zh-cn.md (#21484) add proxy header to nginx config example ``` proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; ``` Signed-off-by: rock2dust Signed-off-by: rock2dust Co-authored-by: Lunny Xiao --- docs/content/doc/usage/reverse-proxies.zh-cn.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/content/doc/usage/reverse-proxies.zh-cn.md b/docs/content/doc/usage/reverse-proxies.zh-cn.md index 722b9c7c9d..f6d92e2a61 100644 --- a/docs/content/doc/usage/reverse-proxies.zh-cn.md +++ b/docs/content/doc/usage/reverse-proxies.zh-cn.md @@ -13,6 +13,12 @@ menu: identifier: "reverse-proxies" --- +# 反向代理 + +**目录** + +{{< toc >}} + ## 使用 Nginx 作为反向代理服务 如果您想使用 Nginx 作为 Gitea 的反向代理服务,您可以参照以下 `nginx.conf` 配置中 `server` 的 `http` 部分: @@ -24,6 +30,10 @@ server { location / { proxy_pass http://localhost:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } ``` @@ -41,6 +51,10 @@ server { location /git/ { # 注意: 反向代理后端 URL 的最后需要有一个路径符号 proxy_pass http://localhost:3000/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } ``` From a37e8b275d19c0daf160cc540d981ec4f3025a5a Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Mon, 17 Oct 2022 23:33:27 +0200 Subject: [PATCH 36/78] Do not send notifications for draft releases (#21451) Fixes #21448 Co-authored-by: wxiaoguang Co-authored-by: Lunny Xiao Co-authored-by: 6543 <6543@obermui.de> --- services/release/release.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/services/release/release.go b/services/release/release.go index 187ebeb486..af1b075232 100644 --- a/services/release/release.go +++ b/services/release/release.go @@ -271,13 +271,12 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod } } - if !isCreated { - notification.NotifyUpdateRelease(doer, rel) - return - } - if !rel.IsDraft { - notification.NotifyNewRelease(rel) + if isCreated { + notification.NotifyNewRelease(rel) + } else { + notification.NotifyUpdateRelease(doer, rel) + } } return err @@ -353,7 +352,9 @@ func DeleteReleaseByID(ctx context.Context, id int64, doer *user_model.User, del } } - notification.NotifyDeleteRelease(doer, rel) + if !rel.IsDraft { + notification.NotifyDeleteRelease(doer, rel) + } return nil } From ea0855904568efceec0997a4d9a0a0241488e700 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Tue, 18 Oct 2022 00:21:08 +0000 Subject: [PATCH 37/78] [skip ci] Updated translations via Crowdin --- options/locale/locale_bg-BG.ini | 1 + options/locale/locale_cs-CZ.ini | 1 + options/locale/locale_de-DE.ini | 1 + options/locale/locale_el-GR.ini | 1 + options/locale/locale_es-ES.ini | 1 + options/locale/locale_fa-IR.ini | 1 + options/locale/locale_fi-FI.ini | 1 + options/locale/locale_fr-FR.ini | 1 + options/locale/locale_hu-HU.ini | 1 + options/locale/locale_id-ID.ini | 1 + options/locale/locale_is-IS.ini | 1 + options/locale/locale_it-IT.ini | 1 + options/locale/locale_ja-JP.ini | 1 + options/locale/locale_ko-KR.ini | 1 + options/locale/locale_lv-LV.ini | 1 + options/locale/locale_ml-IN.ini | 1 + options/locale/locale_nl-NL.ini | 1 + options/locale/locale_pl-PL.ini | 1 + options/locale/locale_pt-BR.ini | 1 + options/locale/locale_pt-PT.ini | 3 +++ options/locale/locale_ru-RU.ini | 1 + options/locale/locale_si-LK.ini | 1 + options/locale/locale_sk-SK.ini | 1 + options/locale/locale_sv-SE.ini | 1 + options/locale/locale_tr-TR.ini | 1 + options/locale/locale_uk-UA.ini | 1 + options/locale/locale_zh-CN.ini | 3 +++ options/locale/locale_zh-HK.ini | 1 + options/locale/locale_zh-TW.ini | 1 + 29 files changed, 33 insertions(+) diff --git a/options/locale/locale_bg-BG.ini b/options/locale/locale_bg-BG.ini index 3a63f3cb81..10759528e5 100644 --- a/options/locale/locale_bg-BG.ini +++ b/options/locale/locale_bg-BG.ini @@ -1190,6 +1190,7 @@ config.log_config=Конфигурация на журнал config.log_mode=Режим на журнал config.disabled_logger=Изключено + monitor.cron=Cron задачи monitor.name=Име monitor.schedule=График diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index 80f0b12661..dcf99124c2 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -2871,6 +2871,7 @@ config.access_log_template=Šablona config.xorm_log_mode=Režim logování XORM config.xorm_log_sql=Logovat SQL + monitor.cron=Naplánované úlohy monitor.name=Název monitor.schedule=Rozvrh diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index 35cc9a1c53..86c442716d 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -2850,6 +2850,7 @@ config.access_log_template=Vorlage config.xorm_log_mode=XORM Log-Modus config.xorm_log_sql=SQL protokollieren + monitor.cron=Cron-Aufgaben monitor.name=Name monitor.schedule=Zeitplan diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index fa067484ff..abf504dda0 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -2870,6 +2870,7 @@ config.access_log_template=Πρότυπο config.xorm_log_mode=Λειτουργία Καταγραφών XORM config.xorm_log_sql=Καταγραφή SQL + monitor.cron=Προγραμματισμένες Εργασίες monitor.name=Όνομα monitor.schedule=Πρόγραμμα diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index 0726ed3ada..7588d53f1f 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -2877,6 +2877,7 @@ config.access_log_template=Plantilla config.xorm_log_mode=Modo de registro XORM config.xorm_log_sql=Registrar SQL + monitor.cron=Tareas de Cron monitor.name=Nombre monitor.schedule=Agenda diff --git a/options/locale/locale_fa-IR.ini b/options/locale/locale_fa-IR.ini index 0536bd42f2..9e012ff557 100644 --- a/options/locale/locale_fa-IR.ini +++ b/options/locale/locale_fa-IR.ini @@ -2634,6 +2634,7 @@ config.access_log_template=الگو config.xorm_log_mode=شیوه ثبت رخداد XORM config.xorm_log_sql=ثبت رخداد SQL + monitor.cron=وظایف Cron monitor.name=نام monitor.schedule=زمان بندی diff --git a/options/locale/locale_fi-FI.ini b/options/locale/locale_fi-FI.ini index ae95ac844d..faac82b0cf 100644 --- a/options/locale/locale_fi-FI.ini +++ b/options/locale/locale_fi-FI.ini @@ -1660,6 +1660,7 @@ config.log_mode=Loki tila config.disabled_logger=Pois käytöstä config.access_log_template=Malli + monitor.cron=Cron tehtävät monitor.name=Nimi monitor.schedule=Aikataulu diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index 9926f63de5..600f43049f 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -2666,6 +2666,7 @@ config.access_log_template=Modèle config.xorm_log_mode=Mode de journalisation de XORM config.xorm_log_sql=Activer la journalisation SQL + monitor.cron=Tâches récurrentes monitor.name=Nom monitor.schedule=Planification diff --git a/options/locale/locale_hu-HU.ini b/options/locale/locale_hu-HU.ini index bacaff9452..d3d31f30ef 100644 --- a/options/locale/locale_hu-HU.ini +++ b/options/locale/locale_hu-HU.ini @@ -1672,6 +1672,7 @@ config.disabled_logger=Letiltva config.access_log_template=Sablon config.xorm_log_sql=SQL naplózása + monitor.cron=Ütemezett Feladatok monitor.name=Név monitor.schedule=Ütemezés diff --git a/options/locale/locale_id-ID.ini b/options/locale/locale_id-ID.ini index 39818b81ee..53d6006c96 100644 --- a/options/locale/locale_id-ID.ini +++ b/options/locale/locale_id-ID.ini @@ -1283,6 +1283,7 @@ config.log_mode=Mode catat config.disabled_logger=Nonaktif config.xorm_log_sql=Catatan SQL + monitor.cron=Tugas Cron monitor.name=Nama monitor.schedule=Jadwal diff --git a/options/locale/locale_is-IS.ini b/options/locale/locale_is-IS.ini index eda95c1b6c..c6b747826a 100644 --- a/options/locale/locale_is-IS.ini +++ b/options/locale/locale_is-IS.ini @@ -1273,6 +1273,7 @@ config.https_only=Aðeins HTTPS + monitor.name=Heiti monitor.goroutines=%d Górútínur monitor.desc=Lýsing diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini index 027c7e0575..f002c534d7 100644 --- a/options/locale/locale_it-IT.ini +++ b/options/locale/locale_it-IT.ini @@ -2864,6 +2864,7 @@ config.access_log_template=Template config.xorm_log_mode=Modalità log XORM config.xorm_log_sql=Log SQL + monitor.cron=Incarichi Cron monitor.name=Nome monitor.schedule=Agenda diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 765347ec47..3b39236545 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -2879,6 +2879,7 @@ config.access_log_template=テンプレート config.xorm_log_mode=XORMログのモード config.xorm_log_sql=SQLのログ出力 + monitor.cron=Cronタスク monitor.name=名称 monitor.schedule=スケジュール diff --git a/options/locale/locale_ko-KR.ini b/options/locale/locale_ko-KR.ini index e80eea95f7..f4f682cb7a 100644 --- a/options/locale/locale_ko-KR.ini +++ b/options/locale/locale_ko-KR.ini @@ -1496,6 +1496,7 @@ config.git_gc_timeout=가비지 콜렉션 작업 시간 제한 config.log_config=로그 설정 config.log_mode=로그 모드 + monitor.cron=Cron 작업 monitor.name=이름 monitor.schedule=스케줄 diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index 5cc5323636..e06ff0a7ff 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -2855,6 +2855,7 @@ config.access_log_template=Šablons config.xorm_log_mode=XORM žurnalizēšanas veids config.xorm_log_sql=SQL žurnalizēšana + monitor.cron=Cron uzdevumi monitor.name=Nosaukums monitor.schedule=Grafiks diff --git a/options/locale/locale_ml-IN.ini b/options/locale/locale_ml-IN.ini index 6474abc59e..078b013ee1 100644 --- a/options/locale/locale_ml-IN.ini +++ b/options/locale/locale_ml-IN.ini @@ -785,6 +785,7 @@ repos.issues=ഇഷ്യൂകള്‍ + [action] diff --git a/options/locale/locale_nl-NL.ini b/options/locale/locale_nl-NL.ini index 9bcb0f7c75..e3f10451f4 100644 --- a/options/locale/locale_nl-NL.ini +++ b/options/locale/locale_nl-NL.ini @@ -2714,6 +2714,7 @@ config.access_log_template=Sjabloon config.xorm_log_mode=XORM Log-modus config.xorm_log_sql=Log SQL + monitor.cron=Cron-taken monitor.name=Naam monitor.schedule=Planning diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini index 5abf069c52..e5e5f31861 100644 --- a/options/locale/locale_pl-PL.ini +++ b/options/locale/locale_pl-PL.ini @@ -2552,6 +2552,7 @@ config.access_log_template=Szablon config.xorm_log_mode=Tryb dziennika XORM config.xorm_log_sql=Dziennik SQL + monitor.cron=Zadania cron monitor.name=Nazwa monitor.schedule=Harmonogram diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index eb63580cb5..04b9a43519 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -2857,6 +2857,7 @@ config.access_log_template=Modelo config.xorm_log_mode=Modo log XORM config.xorm_log_sql=Log SQL + monitor.cron=Tarefas cron monitor.name=Nome monitor.schedule=Cronograma diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 6c01a06f85..6f99e4d6e8 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -2879,6 +2879,9 @@ config.access_log_template=Modelo config.xorm_log_mode=Modo de registo XORM config.xorm_log_sql=Registo do SQL +config.get_setting_failed=Falha ao obter a configuração %s +config.set_setting_failed=Falha ao definir a configuração %s + monitor.cron=Tarefas Cron monitor.name=Nome monitor.schedule=Programação diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 348fa74329..fab3dfc6d9 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -2739,6 +2739,7 @@ config.access_log_template=Шаблон config.xorm_log_mode=Режим журнала XORM config.xorm_log_sql=Лог SQL + monitor.cron=Задачи cron monitor.name=Название monitor.schedule=Расписание diff --git a/options/locale/locale_si-LK.ini b/options/locale/locale_si-LK.ini index 9d19176daf..4ddf97356c 100644 --- a/options/locale/locale_si-LK.ini +++ b/options/locale/locale_si-LK.ini @@ -2566,6 +2566,7 @@ config.access_log_template=සැකිල්ල config.xorm_log_mode=XORM ලොග් ප්රකාරය config.xorm_log_sql=ලොග් SQL + monitor.cron=Con කාර්යයන් monitor.name=නම monitor.schedule=කාලසටහන diff --git a/options/locale/locale_sk-SK.ini b/options/locale/locale_sk-SK.ini index 9c4475ac5c..597b91cb1f 100644 --- a/options/locale/locale_sk-SK.ini +++ b/options/locale/locale_sk-SK.ini @@ -1288,6 +1288,7 @@ config.oauth_enabled=Povolené + monitor.process.cancel=Zrušiť proces monitor.queue.review=Konfigurácia revidovania monitor.queue.review_add=Revidovať/Pridať revidentov diff --git a/options/locale/locale_sv-SE.ini b/options/locale/locale_sv-SE.ini index f1d1872df3..08733692b5 100644 --- a/options/locale/locale_sv-SE.ini +++ b/options/locale/locale_sv-SE.ini @@ -2033,6 +2033,7 @@ config.disabled_logger=Inaktiverad config.access_log_template=Mall config.xorm_log_sql=Logga SQL + monitor.cron=Cron-jobb monitor.name=Namn monitor.schedule=Schemaläggning diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index 78303d515a..ea48962856 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -2879,6 +2879,7 @@ config.access_log_template=Şablon config.xorm_log_mode=XORM Günlük Kipi config.xorm_log_sql=SQL Günlüğü + monitor.cron=Cron Görevleri monitor.name=İsim monitor.schedule=Program diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index ef4f37562a..a98f35dd7f 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -2640,6 +2640,7 @@ config.access_log_template=Шаблон config.xorm_log_mode=XORM-режим запису журналу config.xorm_log_sql=Журнал SQL + monitor.cron=Завдання cron monitor.name=Ім'я monitor.schedule=Розклад diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 52abbd57e9..99202b9e17 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2879,6 +2879,9 @@ config.access_log_template=模板 config.xorm_log_mode=XORM 日志模式 config.xorm_log_sql=日志 SQL +config.get_setting_failed=获取设置 %s 失败 +config.set_setting_failed=设置 %s 失败 + monitor.cron=Cron 任务 monitor.name=任务名称 monitor.schedule=任务安排 diff --git a/options/locale/locale_zh-HK.ini b/options/locale/locale_zh-HK.ini index 0aa7cff23d..ba828365d5 100644 --- a/options/locale/locale_zh-HK.ini +++ b/options/locale/locale_zh-HK.ini @@ -798,6 +798,7 @@ config.git_gc_timeout=GC 操作超時 config.log_config=日誌設定 config.log_mode=日誌模式 + monitor.cron=Cron 任務 monitor.name=任務名稱 monitor.schedule=任務安排 diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini index 660596f093..0d6e6f617d 100644 --- a/options/locale/locale_zh-TW.ini +++ b/options/locale/locale_zh-TW.ini @@ -2877,6 +2877,7 @@ config.access_log_template=範本 config.xorm_log_mode=XORM 日誌模式 config.xorm_log_sql=記錄 SQL + monitor.cron=Cron 任務 monitor.name=任務名稱 monitor.schedule=任務安排 From 6af1a0c8c004aeb4ef1df1a0c74dcb1e1f874796 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Mon, 17 Oct 2022 21:55:57 -0400 Subject: [PATCH 38/78] inline gitpod image (#21494) fix #21492 Co-authored-by: 6543 <6543@obermui.de> --- .../doc/developers/hacking-on-gitea.en-us.md | 2 +- docs/static/open-in-gitpod.svg | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 docs/static/open-in-gitpod.svg diff --git a/docs/content/doc/developers/hacking-on-gitea.en-us.md b/docs/content/doc/developers/hacking-on-gitea.en-us.md index d8427b58f3..3283240c98 100644 --- a/docs/content/doc/developers/hacking-on-gitea.en-us.md +++ b/docs/content/doc/developers/hacking-on-gitea.en-us.md @@ -23,7 +23,7 @@ menu: To get a quick working development environment you could use Gitpod. -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/go-gitea/gitea) +[![Open in Gitpod](/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/go-gitea/gitea) ## Installing go diff --git a/docs/static/open-in-gitpod.svg b/docs/static/open-in-gitpod.svg new file mode 100644 index 0000000000..b97cd29487 --- /dev/null +++ b/docs/static/open-in-gitpod.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 716fcfcf72be6af854d800f3e2c885b9806577e6 Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 18 Oct 2022 06:50:37 +0100 Subject: [PATCH 39/78] Make every not exist error unwrappable to a fs.ErrNotExist (#20891) A lot of our code is repeatedly testing if individual errors are specific types of Not Exist errors. This is repetitative and unnecesary. `Unwrap() error` provides a common way of labelling an error as a NotExist error and we can/should use this. This PR has chosen to use the common `io/fs` errors e.g. `fs.ErrNotExist` for our errors. This is in some ways not completely correct as these are not filesystem errors but it seems like a reasonable thing to do and would allow us to simplify a lot of our code to `errors.Is(err, fs.ErrNotExist)` instead of `package.IsErr...NotExist(err)` I am open to suggestions to use a different base error - perhaps `models/db.ErrNotExist` if that would be felt to be better. Signed-off-by: Andrew Thornton Co-authored-by: delvh --- models/activities/notification.go | 2 +- models/admin/task.go | 4 ++ models/asymkey/error.go | 54 ++++++++++++++++++- models/auth/oauth2.go | 12 ++++- models/auth/source.go | 11 ++++ models/auth/token.go | 8 +++ models/auth/twofactor.go | 5 ++ models/auth/webauthn.go | 6 +++ models/db/engine.go | 2 +- models/db/error.go | 20 ++++++- models/db/name.go | 22 ++++++-- models/error.go | 85 +++++++++++++++++++++++++++++- models/foreignreference/error.go | 10 ++++ models/git/lfs.go | 20 ++++++- models/issues/comment.go | 5 ++ models/issues/content_history.go | 5 ++ models/issues/dependency.go | 13 +++++ models/issues/issue.go | 4 ++ models/issues/label.go | 12 +++++ models/issues/milestone.go | 5 ++ models/issues/pull.go | 8 +++ models/issues/reaction.go | 9 ++++ models/issues/review.go | 8 +++ models/issues/stopwatch.go | 8 +++ models/issues/tracked_time.go | 6 +-- models/organization/org.go | 9 ++++ models/organization/team.go | 9 ++++ models/project/project.go | 8 +++ models/pull/automerge.go | 2 +- models/repo/attachment.go | 5 ++ models/repo/redirect.go | 5 ++ models/repo/release.go | 8 +++ models/repo/repo.go | 9 ++++ models/repo/repo_unit.go | 5 ++ models/repo/topic.go | 5 ++ models/repo/update.go | 12 +++++ models/repo/upload.go | 4 ++ models/repo/wiki.go | 12 +++++ models/user/email_address.go | 20 +++++++ models/user/error.go | 22 ++++++++ models/user/external_login_user.go | 9 ++++ models/user/openid.go | 5 ++ models/user/redirect.go | 5 ++ models/webhook/webhook.go | 8 +++ modules/git/error.go | 10 ++++ modules/translation/i18n/errors.go | 8 +-- modules/util/error.go | 37 +++++++++++++ services/repository/fork.go | 4 ++ 48 files changed, 545 insertions(+), 20 deletions(-) create mode 100644 modules/util/error.go diff --git a/models/activities/notification.go b/models/activities/notification.go index 2f21dc74d1..0a61088167 100644 --- a/models/activities/notification.go +++ b/models/activities/notification.go @@ -806,7 +806,7 @@ func getNotificationByID(ctx context.Context, notificationID int64) (*Notificati } if !ok { - return nil, db.ErrNotExist{ID: notificationID} + return nil, db.ErrNotExist{Resource: "notification", ID: notificationID} } return notification, nil diff --git a/models/admin/task.go b/models/admin/task.go index 07eb61decc..4fa0f10394 100644 --- a/models/admin/task.go +++ b/models/admin/task.go @@ -167,6 +167,10 @@ func (err ErrTaskDoesNotExist) Error() string { err.ID, err.RepoID, err.Type) } +func (err ErrTaskDoesNotExist) Unwrap() error { + return util.ErrNotExist +} + // GetMigratingTask returns the migrating task by repo's id func GetMigratingTask(repoID int64) (*Task, error) { task := Task{ diff --git a/models/asymkey/error.go b/models/asymkey/error.go index 5d2be1f289..3ddeb0498a 100644 --- a/models/asymkey/error.go +++ b/models/asymkey/error.go @@ -4,7 +4,11 @@ package asymkey -import "fmt" +import ( + "fmt" + + "code.gitea.io/gitea/modules/util" +) // ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error. type ErrKeyUnableVerify struct { @@ -36,6 +40,10 @@ func (err ErrKeyNotExist) Error() string { return fmt.Sprintf("public key does not exist [id: %d]", err.ID) } +func (err ErrKeyNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrKeyAlreadyExist represents a "KeyAlreadyExist" kind of error. type ErrKeyAlreadyExist struct { OwnerID int64 @@ -54,6 +62,10 @@ func (err ErrKeyAlreadyExist) Error() string { err.OwnerID, err.Fingerprint, err.Content) } +func (err ErrKeyAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrKeyNameAlreadyUsed represents a "KeyNameAlreadyUsed" kind of error. type ErrKeyNameAlreadyUsed struct { OwnerID int64 @@ -70,6 +82,10 @@ func (err ErrKeyNameAlreadyUsed) Error() string { return fmt.Sprintf("public key already exists [owner_id: %d, name: %s]", err.OwnerID, err.Name) } +func (err ErrKeyNameAlreadyUsed) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrGPGNoEmailFound represents a "ErrGPGNoEmailFound" kind of error. type ErrGPGNoEmailFound struct { FailedEmails []string @@ -132,6 +148,10 @@ func (err ErrGPGKeyNotExist) Error() string { return fmt.Sprintf("public gpg key does not exist [id: %d]", err.ID) } +func (err ErrGPGKeyNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrGPGKeyImportNotExist represents a "GPGKeyImportNotExist" kind of error. type ErrGPGKeyImportNotExist struct { ID string @@ -147,6 +167,10 @@ func (err ErrGPGKeyImportNotExist) Error() string { return fmt.Sprintf("public gpg key import does not exist [id: %s]", err.ID) } +func (err ErrGPGKeyImportNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrGPGKeyIDAlreadyUsed represents a "GPGKeyIDAlreadyUsed" kind of error. type ErrGPGKeyIDAlreadyUsed struct { KeyID string @@ -162,6 +186,10 @@ func (err ErrGPGKeyIDAlreadyUsed) Error() string { return fmt.Sprintf("public key already exists [key_id: %s]", err.KeyID) } +func (err ErrGPGKeyIDAlreadyUsed) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrGPGKeyAccessDenied represents a "GPGKeyAccessDenied" kind of Error. type ErrGPGKeyAccessDenied struct { UserID int64 @@ -180,6 +208,10 @@ func (err ErrGPGKeyAccessDenied) Error() string { err.UserID, err.KeyID) } +func (err ErrGPGKeyAccessDenied) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error. type ErrKeyAccessDenied struct { UserID int64 @@ -198,6 +230,10 @@ func (err ErrKeyAccessDenied) Error() string { err.UserID, err.KeyID, err.Note) } +func (err ErrKeyAccessDenied) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrDeployKeyNotExist represents a "DeployKeyNotExist" kind of error. type ErrDeployKeyNotExist struct { ID int64 @@ -215,6 +251,10 @@ func (err ErrDeployKeyNotExist) Error() string { return fmt.Sprintf("Deploy key does not exist [id: %d, key_id: %d, repo_id: %d]", err.ID, err.KeyID, err.RepoID) } +func (err ErrDeployKeyNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrDeployKeyAlreadyExist represents a "DeployKeyAlreadyExist" kind of error. type ErrDeployKeyAlreadyExist struct { KeyID int64 @@ -231,6 +271,10 @@ func (err ErrDeployKeyAlreadyExist) Error() string { return fmt.Sprintf("public key already exists [key_id: %d, repo_id: %d]", err.KeyID, err.RepoID) } +func (err ErrDeployKeyAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrDeployKeyNameAlreadyUsed represents a "DeployKeyNameAlreadyUsed" kind of error. type ErrDeployKeyNameAlreadyUsed struct { RepoID int64 @@ -247,6 +291,10 @@ func (err ErrDeployKeyNameAlreadyUsed) Error() string { return fmt.Sprintf("public key with name already exists [repo_id: %d, name: %s]", err.RepoID, err.Name) } +func (err ErrDeployKeyNameAlreadyUsed) Unwrap() error { + return util.ErrNotExist +} + // ErrSSHInvalidTokenSignature represents a "ErrSSHInvalidTokenSignature" kind of error. type ErrSSHInvalidTokenSignature struct { Wrapped error @@ -262,3 +310,7 @@ func IsErrSSHInvalidTokenSignature(err error) bool { func (err ErrSSHInvalidTokenSignature) Error() string { return "the provided signature does not sign the token with the provided key" } + +func (err ErrSSHInvalidTokenSignature) Unwrap() error { + return util.ErrInvalidArgument +} diff --git a/models/auth/oauth2.go b/models/auth/oauth2.go index abcd9e1ca6..9fdce24253 100644 --- a/models/auth/oauth2.go +++ b/models/auth/oauth2.go @@ -486,7 +486,7 @@ type ErrOAuthClientIDInvalid struct { ClientID string } -// IsErrOauthClientIDInvalid checks if an error is a ErrReviewNotExist. +// IsErrOauthClientIDInvalid checks if an error is a ErrOAuthClientIDInvalid. func IsErrOauthClientIDInvalid(err error) bool { _, ok := err.(ErrOAuthClientIDInvalid) return ok @@ -497,6 +497,11 @@ func (err ErrOAuthClientIDInvalid) Error() string { return fmt.Sprintf("Client ID invalid [Client ID: %s]", err.ClientID) } +// Unwrap unwraps this as a ErrNotExist err +func (err ErrOAuthClientIDInvalid) Unwrap() error { + return util.ErrNotExist +} + // ErrOAuthApplicationNotFound will be thrown if id cannot be found type ErrOAuthApplicationNotFound struct { ID int64 @@ -513,6 +518,11 @@ func (err ErrOAuthApplicationNotFound) Error() string { return fmt.Sprintf("OAuth application not found [ID: %d]", err.ID) } +// Unwrap unwraps this as a ErrNotExist err +func (err ErrOAuthApplicationNotFound) Unwrap() error { + return util.ErrNotExist +} + // GetActiveOAuth2ProviderSources returns all actived LoginOAuth2 sources func GetActiveOAuth2ProviderSources() ([]*Source, error) { sources := make([]*Source, 0, 1) diff --git a/models/auth/source.go b/models/auth/source.go index 6f4f5addcb..f8be5398ae 100644 --- a/models/auth/source.go +++ b/models/auth/source.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/xorm" "xorm.io/xorm/convert" @@ -366,6 +367,11 @@ func (err ErrSourceNotExist) Error() string { return fmt.Sprintf("login source does not exist [id: %d]", err.ID) } +// Unwrap unwraps this as a ErrNotExist err +func (err ErrSourceNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrSourceAlreadyExist represents a "SourceAlreadyExist" kind of error. type ErrSourceAlreadyExist struct { Name string @@ -381,6 +387,11 @@ func (err ErrSourceAlreadyExist) Error() string { return fmt.Sprintf("login source already exists [name: %s]", err.Name) } +// Unwrap unwraps this as a ErrExist err +func (err ErrSourceAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrSourceInUse represents a "SourceInUse" kind of error. type ErrSourceInUse struct { ID int64 diff --git a/models/auth/token.go b/models/auth/token.go index 01654f2901..3afef832da 100644 --- a/models/auth/token.go +++ b/models/auth/token.go @@ -35,6 +35,10 @@ func (err ErrAccessTokenNotExist) Error() string { return fmt.Sprintf("access token does not exist [sha: %s]", err.Token) } +func (err ErrAccessTokenNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrAccessTokenEmpty represents a "AccessTokenEmpty" kind of error. type ErrAccessTokenEmpty struct{} @@ -48,6 +52,10 @@ func (err ErrAccessTokenEmpty) Error() string { return "access token is empty" } +func (err ErrAccessTokenEmpty) Unwrap() error { + return util.ErrInvalidArgument +} + var successfulAccessTokenCache *lru.Cache // AccessToken represents a personal access token. diff --git a/models/auth/twofactor.go b/models/auth/twofactor.go index c5bd972f91..736d4c340c 100644 --- a/models/auth/twofactor.go +++ b/models/auth/twofactor.go @@ -41,6 +41,11 @@ func (err ErrTwoFactorNotEnrolled) Error() string { return fmt.Sprintf("user not enrolled in 2FA [uid: %d]", err.UID) } +// Unwrap unwraps this as a ErrNotExist err +func (err ErrTwoFactorNotEnrolled) Unwrap() error { + return util.ErrNotExist +} + // TwoFactor represents a two-factor authentication token. type TwoFactor struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/auth/webauthn.go b/models/auth/webauthn.go index d3062342f5..1575b6cbab 100644 --- a/models/auth/webauthn.go +++ b/models/auth/webauthn.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "github.com/duo-labs/webauthn/webauthn" "xorm.io/xorm" @@ -29,6 +30,11 @@ func (err ErrWebAuthnCredentialNotExist) Error() string { return fmt.Sprintf("WebAuthn credential does not exist [credential_id: %x]", err.CredentialID) } +// Unwrap unwraps this as a ErrNotExist err +func (err ErrWebAuthnCredentialNotExist) Unwrap() error { + return util.ErrNotExist +} + // IsErrWebAuthnCredentialNotExist checks if an error is a ErrWebAuthnCredentialNotExist. func IsErrWebAuthnCredentialNotExist(err error) bool { _, ok := err.(ErrWebAuthnCredentialNotExist) diff --git a/models/db/engine.go b/models/db/engine.go index 2c329300e3..f0c9ec46e9 100755 --- a/models/db/engine.go +++ b/models/db/engine.go @@ -225,7 +225,7 @@ func NamesToBean(names ...string) ([]interface{}, error) { for _, name := range names { bean, ok := beanMap[strings.ToLower(strings.TrimSpace(name))] if !ok { - return nil, fmt.Errorf("No table found that matches: %s", name) + return nil, fmt.Errorf("no table found that matches: %s", name) } if !gotBean[bean] { beans = append(beans, bean) diff --git a/models/db/error.go b/models/db/error.go index 6557229943..9577fa55db 100644 --- a/models/db/error.go +++ b/models/db/error.go @@ -6,6 +6,8 @@ package db import ( "fmt" + + "code.gitea.io/gitea/modules/util" ) // ErrCancelled represents an error due to context cancellation @@ -45,7 +47,8 @@ func (err ErrSSHDisabled) Error() string { // ErrNotExist represents a non-exist error. type ErrNotExist struct { - ID int64 + Resource string + ID int64 } // IsErrNotExist checks if an error is an ErrNotExist @@ -55,5 +58,18 @@ func IsErrNotExist(err error) bool { } func (err ErrNotExist) Error() string { - return fmt.Sprintf("record does not exist [id: %d]", err.ID) + name := "record" + if err.Resource != "" { + name = err.Resource + } + + if err.ID != 0 { + return fmt.Sprintf("%s does not exist [id: %d]", name, err.ID) + } + return fmt.Sprintf("%s does not exist", name) +} + +// Unwrap unwraps this as a ErrNotExist err +func (err ErrNotExist) Unwrap() error { + return util.ErrNotExist } diff --git a/models/db/name.go b/models/db/name.go index 9c9d18f184..a05d1a789b 100644 --- a/models/db/name.go +++ b/models/db/name.go @@ -5,16 +5,17 @@ package db import ( - "errors" "fmt" "regexp" "strings" "unicode/utf8" + + "code.gitea.io/gitea/modules/util" ) var ( // ErrNameEmpty name is empty error - ErrNameEmpty = errors.New("Name is empty") + ErrNameEmpty = util.SilentWrap{Message: "name is empty", Err: util.ErrInvalidArgument} // AlphaDashDotPattern characters prohibited in a user name (anything except A-Za-z0-9_.-) AlphaDashDotPattern = regexp.MustCompile(`[^\w-\.]`) @@ -35,6 +36,11 @@ func (err ErrNameReserved) Error() string { return fmt.Sprintf("name is reserved [name: %s]", err.Name) } +// Unwrap unwraps this as a ErrInvalid err +func (err ErrNameReserved) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrNamePatternNotAllowed represents a "pattern not allowed" error. type ErrNamePatternNotAllowed struct { Pattern string @@ -50,6 +56,11 @@ func (err ErrNamePatternNotAllowed) Error() string { return fmt.Sprintf("name pattern is not allowed [pattern: %s]", err.Pattern) } +// Unwrap unwraps this as a ErrInvalid err +func (err ErrNamePatternNotAllowed) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrNameCharsNotAllowed represents a "character not allowed in name" error. type ErrNameCharsNotAllowed struct { Name string @@ -62,7 +73,12 @@ func IsErrNameCharsNotAllowed(err error) bool { } func (err ErrNameCharsNotAllowed) Error() string { - return fmt.Sprintf("User name is invalid [%s]: must be valid alpha or numeric or dash(-_) or dot characters", err.Name) + return fmt.Sprintf("name is invalid [%s]: must be valid alpha or numeric or dash(-_) or dot characters", err.Name) +} + +// Unwrap unwraps this as a ErrInvalid err +func (err ErrNameCharsNotAllowed) Unwrap() error { + return util.ErrInvalidArgument } // IsUsableName checks if name is reserved or pattern of name is not allowed diff --git a/models/error.go b/models/error.go index 873ed0ceaa..f4c4bc8f67 100644 --- a/models/error.go +++ b/models/error.go @@ -10,6 +10,7 @@ import ( repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/util" ) // ErrUserOwnRepos represents a "UserOwnRepos" kind of error. @@ -63,8 +64,8 @@ type ErrNoPendingRepoTransfer struct { RepoID int64 } -func (e ErrNoPendingRepoTransfer) Error() string { - return fmt.Sprintf("repository doesn't have a pending transfer [repo_id: %d]", e.RepoID) +func (err ErrNoPendingRepoTransfer) Error() string { + return fmt.Sprintf("repository doesn't have a pending transfer [repo_id: %d]", err.RepoID) } // IsErrNoPendingTransfer is an error type when a repository has no pending @@ -74,6 +75,10 @@ func IsErrNoPendingTransfer(err error) bool { return ok } +func (err ErrNoPendingRepoTransfer) Unwrap() error { + return util.ErrNotExist +} + // ErrRepoTransferInProgress represents the state of a repository that has an // ongoing transfer type ErrRepoTransferInProgress struct { @@ -91,6 +96,10 @@ func (err ErrRepoTransferInProgress) Error() string { return fmt.Sprintf("repository is already being transferred [uname: %s, name: %s]", err.Uname, err.Name) } +func (err ErrRepoTransferInProgress) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrInvalidCloneAddr represents a "InvalidCloneAddr" kind of error. type ErrInvalidCloneAddr struct { Host string @@ -124,6 +133,10 @@ func (err *ErrInvalidCloneAddr) Error() string { return fmt.Sprintf("migration/cloning from '%s' is not allowed", err.Host) } +func (err *ErrInvalidCloneAddr) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error. type ErrUpdateTaskNotExist struct { UUID string @@ -139,6 +152,10 @@ func (err ErrUpdateTaskNotExist) Error() string { return fmt.Sprintf("update task does not exist [uuid: %s]", err.UUID) } +func (err ErrUpdateTaskNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrInvalidTagName represents a "InvalidTagName" kind of error. type ErrInvalidTagName struct { TagName string @@ -154,6 +171,10 @@ func (err ErrInvalidTagName) Error() string { return fmt.Sprintf("release tag name is not valid [tag_name: %s]", err.TagName) } +func (err ErrInvalidTagName) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrProtectedTagName represents a "ProtectedTagName" kind of error. type ErrProtectedTagName struct { TagName string @@ -169,6 +190,10 @@ func (err ErrProtectedTagName) Error() string { return fmt.Sprintf("release tag name is protected [tag_name: %s]", err.TagName) } +func (err ErrProtectedTagName) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrRepoFileAlreadyExists represents a "RepoFileAlreadyExist" kind of error. type ErrRepoFileAlreadyExists struct { Path string @@ -184,6 +209,10 @@ func (err ErrRepoFileAlreadyExists) Error() string { return fmt.Sprintf("repository file already exists [path: %s]", err.Path) } +func (err ErrRepoFileAlreadyExists) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrRepoFileDoesNotExist represents a "RepoFileDoesNotExist" kind of error. type ErrRepoFileDoesNotExist struct { Path string @@ -200,6 +229,10 @@ func (err ErrRepoFileDoesNotExist) Error() string { return fmt.Sprintf("repository file does not exist [path: %s]", err.Path) } +func (err ErrRepoFileDoesNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrFilenameInvalid represents a "FilenameInvalid" kind of error. type ErrFilenameInvalid struct { Path string @@ -215,6 +248,10 @@ func (err ErrFilenameInvalid) Error() string { return fmt.Sprintf("path contains a malformed path component [path: %s]", err.Path) } +func (err ErrFilenameInvalid) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrUserCannotCommit represents "UserCannotCommit" kind of error. type ErrUserCannotCommit struct { UserName string @@ -230,6 +267,10 @@ func (err ErrUserCannotCommit) Error() string { return fmt.Sprintf("user cannot commit to repo [user: %s]", err.UserName) } +func (err ErrUserCannotCommit) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrFilePathInvalid represents a "FilePathInvalid" kind of error. type ErrFilePathInvalid struct { Message string @@ -251,6 +292,10 @@ func (err ErrFilePathInvalid) Error() string { return fmt.Sprintf("path is invalid [path: %s]", err.Path) } +func (err ErrFilePathInvalid) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrFilePathProtected represents a "FilePathProtected" kind of error. type ErrFilePathProtected struct { Message string @@ -270,6 +315,10 @@ func (err ErrFilePathProtected) Error() string { return fmt.Sprintf("path is protected and can not be changed [path: %s]", err.Path) } +func (err ErrFilePathProtected) Unwrap() error { + return util.ErrPermissionDenied +} + // __________ .__ // \______ \____________ ____ ____ | |__ // | | _/\_ __ \__ \ / \_/ ___\| | \ @@ -292,6 +341,10 @@ func (err ErrBranchDoesNotExist) Error() string { return fmt.Sprintf("branch does not exist [name: %s]", err.BranchName) } +func (err ErrBranchDoesNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrBranchAlreadyExists represents an error that branch with such name already exists. type ErrBranchAlreadyExists struct { BranchName string @@ -307,6 +360,10 @@ func (err ErrBranchAlreadyExists) Error() string { return fmt.Sprintf("branch already exists [name: %s]", err.BranchName) } +func (err ErrBranchAlreadyExists) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrBranchNameConflict represents an error that branch name conflicts with other branch. type ErrBranchNameConflict struct { BranchName string @@ -322,6 +379,10 @@ func (err ErrBranchNameConflict) Error() string { return fmt.Sprintf("branch conflicts with existing branch [name: %s]", err.BranchName) } +func (err ErrBranchNameConflict) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrBranchesEqual represents an error that branch name conflicts with other branch. type ErrBranchesEqual struct { BaseBranchName string @@ -338,6 +399,10 @@ func (err ErrBranchesEqual) Error() string { return fmt.Sprintf("branches are equal [head: %sm base: %s]", err.HeadBranchName, err.BaseBranchName) } +func (err ErrBranchesEqual) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrDisallowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it. type ErrDisallowedToMerge struct { Reason string @@ -353,6 +418,10 @@ func (err ErrDisallowedToMerge) Error() string { return fmt.Sprintf("not allowed to merge [reason: %s]", err.Reason) } +func (err ErrDisallowedToMerge) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrTagAlreadyExists represents an error that tag with such name already exists. type ErrTagAlreadyExists struct { TagName string @@ -368,6 +437,10 @@ func (err ErrTagAlreadyExists) Error() string { return fmt.Sprintf("tag already exists [name: %s]", err.TagName) } +func (err ErrTagAlreadyExists) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrSHADoesNotMatch represents a "SHADoesNotMatch" kind of error. type ErrSHADoesNotMatch struct { Path string @@ -400,6 +473,10 @@ func (err ErrSHANotFound) Error() string { return fmt.Sprintf("sha not found [%s]", err.SHA) } +func (err ErrSHANotFound) Unwrap() error { + return util.ErrNotExist +} + // ErrCommitIDDoesNotMatch represents a "CommitIDDoesNotMatch" kind of error. type ErrCommitIDDoesNotMatch struct { GivenCommitID string @@ -446,6 +523,10 @@ func (err ErrInvalidMergeStyle) Error() string { err.ID, err.Style) } +func (err ErrInvalidMergeStyle) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrMergeConflicts represents an error if merging fails with a conflict type ErrMergeConflicts struct { Style repo_model.MergeStyle diff --git a/models/foreignreference/error.go b/models/foreignreference/error.go index d783a08730..a1db773cd2 100644 --- a/models/foreignreference/error.go +++ b/models/foreignreference/error.go @@ -6,6 +6,8 @@ package foreignreference import ( "fmt" + + "code.gitea.io/gitea/modules/util" ) // ErrLocalIndexNotExist represents a "LocalIndexNotExist" kind of error. @@ -25,6 +27,10 @@ func (err ErrLocalIndexNotExist) Error() string { return fmt.Sprintf("repository %d has no LocalIndex for ForeignIndex %d of type %s", err.RepoID, err.ForeignIndex, err.Type) } +func (err ErrLocalIndexNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrForeignIndexNotExist represents a "ForeignIndexNotExist" kind of error. type ErrForeignIndexNotExist struct { RepoID int64 @@ -41,3 +47,7 @@ func IsErrForeignIndexNotExist(err error) bool { func (err ErrForeignIndexNotExist) Error() string { return fmt.Sprintf("repository %d has no ForeignIndex for LocalIndex %d of type %s", err.RepoID, err.LocalIndex, err.Type) } + +func (err ErrForeignIndexNotExist) Unwrap() error { + return util.ErrNotExist +} diff --git a/models/git/lfs.go b/models/git/lfs.go index 179da3120a..1dab31d5f9 100644 --- a/models/git/lfs.go +++ b/models/git/lfs.go @@ -6,7 +6,6 @@ package git import ( "context" - "errors" "fmt" "code.gitea.io/gitea/models/db" @@ -17,6 +16,7 @@ import ( "code.gitea.io/gitea/modules/lfs" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -38,6 +38,10 @@ func (err ErrLFSLockNotExist) Error() string { return fmt.Sprintf("lfs lock does not exist [id: %d, rid: %d, path: %s]", err.ID, err.RepoID, err.Path) } +func (err ErrLFSLockNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrLFSUnauthorizedAction represents a "LFSUnauthorizedAction" kind of error. type ErrLFSUnauthorizedAction struct { RepoID int64 @@ -58,6 +62,10 @@ func (err ErrLFSUnauthorizedAction) Error() string { return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID) } +func (err ErrLFSUnauthorizedAction) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrLFSLockAlreadyExist represents a "LFSLockAlreadyExist" kind of error. type ErrLFSLockAlreadyExist struct { RepoID int64 @@ -74,6 +82,10 @@ func (err ErrLFSLockAlreadyExist) Error() string { return fmt.Sprintf("lfs lock already exists [rid: %d, path: %s]", err.RepoID, err.Path) } +func (err ErrLFSLockAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrLFSFileLocked represents a "LFSFileLocked" kind of error. type ErrLFSFileLocked struct { RepoID int64 @@ -91,6 +103,10 @@ func (err ErrLFSFileLocked) Error() string { return fmt.Sprintf("File is lfs locked [repo: %d, locked by: %s, path: %s]", err.RepoID, err.UserName, err.Path) } +func (err ErrLFSFileLocked) Unwrap() error { + return util.ErrPermissionDenied +} + // LFSMetaObject stores metadata for LFS tracked files. type LFSMetaObject struct { ID int64 `xorm:"pk autoincr"` @@ -114,7 +130,7 @@ type LFSTokenResponse struct { // ErrLFSObjectNotExist is returned from lfs models functions in order // to differentiate between database and missing object errors. -var ErrLFSObjectNotExist = errors.New("LFS Meta object does not exist") +var ErrLFSObjectNotExist = db.ErrNotExist{Resource: "LFS Meta object"} // NewLFSMetaObject stores a given populated LFSMetaObject structure in the database // if it is not already present. diff --git a/models/issues/comment.go b/models/issues/comment.go index a71afda9e0..9ab6cab7d0 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -28,6 +28,7 @@ import ( "code.gitea.io/gitea/modules/references" "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" "xorm.io/xorm" @@ -49,6 +50,10 @@ func (err ErrCommentNotExist) Error() string { return fmt.Sprintf("comment does not exist [id: %d, issue_id: %d]", err.ID, err.IssueID) } +func (err ErrCommentNotExist) Unwrap() error { + return util.ErrNotExist +} + // CommentType defines whether a comment is just a simple comment, an action (like close) or a reference. type CommentType int diff --git a/models/issues/content_history.go b/models/issues/content_history.go index 3e321784bd..f5cfa65b8f 100644 --- a/models/issues/content_history.go +++ b/models/issues/content_history.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -201,6 +202,10 @@ func (err ErrIssueContentHistoryNotExist) Error() string { return fmt.Sprintf("issue content history does not exist [id: %d]", err.ID) } +func (err ErrIssueContentHistoryNotExist) Unwrap() error { + return util.ErrNotExist +} + // GetIssueContentHistoryByID get issue content history func GetIssueContentHistoryByID(dbCtx context.Context, id int64) (*ContentHistory, error) { h := &ContentHistory{} diff --git a/models/issues/dependency.go b/models/issues/dependency.go index d664c0758e..4754ed0f5f 100644 --- a/models/issues/dependency.go +++ b/models/issues/dependency.go @@ -11,6 +11,7 @@ import ( "code.gitea.io/gitea/models/db" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" ) // ErrDependencyExists represents a "DependencyAlreadyExists" kind of error. @@ -29,6 +30,10 @@ func (err ErrDependencyExists) Error() string { return fmt.Sprintf("issue dependency does already exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID) } +func (err ErrDependencyExists) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrDependencyNotExists represents a "DependencyAlreadyExists" kind of error. type ErrDependencyNotExists struct { IssueID int64 @@ -45,6 +50,10 @@ func (err ErrDependencyNotExists) Error() string { return fmt.Sprintf("issue dependency does not exist [issue id: %d, dependency id: %d]", err.IssueID, err.DependencyID) } +func (err ErrDependencyNotExists) Unwrap() error { + return util.ErrNotExist +} + // ErrCircularDependency represents a "DependencyCircular" kind of error. type ErrCircularDependency struct { IssueID int64 @@ -91,6 +100,10 @@ func (err ErrUnknownDependencyType) Error() string { return fmt.Sprintf("unknown dependency type [type: %d]", err.Type) } +func (err ErrUnknownDependencyType) Unwrap() error { + return util.ErrInvalidArgument +} + // IssueDependency represents an issue dependency type IssueDependency struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/issues/issue.go b/models/issues/issue.go index 786c969522..e56e43bd1a 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -52,6 +52,10 @@ func (err ErrIssueNotExist) Error() string { return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index) } +func (err ErrIssueNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrIssueIsClosed represents a "IssueIsClosed" kind of error. type ErrIssueIsClosed struct { ID int64 diff --git a/models/issues/label.go b/models/issues/label.go index 667a608687..be97454e26 100644 --- a/models/issues/label.go +++ b/models/issues/label.go @@ -38,6 +38,10 @@ func (err ErrRepoLabelNotExist) Error() string { return fmt.Sprintf("label does not exist [label_id: %d, repo_id: %d]", err.LabelID, err.RepoID) } +func (err ErrRepoLabelNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrOrgLabelNotExist represents a "OrgLabelNotExist" kind of error. type ErrOrgLabelNotExist struct { LabelID int64 @@ -54,6 +58,10 @@ func (err ErrOrgLabelNotExist) Error() string { return fmt.Sprintf("label does not exist [label_id: %d, org_id: %d]", err.LabelID, err.OrgID) } +func (err ErrOrgLabelNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrLabelNotExist represents a "LabelNotExist" kind of error. type ErrLabelNotExist struct { LabelID int64 @@ -69,6 +77,10 @@ func (err ErrLabelNotExist) Error() string { return fmt.Sprintf("label does not exist [label_id: %d]", err.LabelID) } +func (err ErrLabelNotExist) Unwrap() error { + return util.ErrNotExist +} + // LabelColorPattern is a regexp witch can validate LabelColor var LabelColorPattern = regexp.MustCompile("^#?(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})$") diff --git a/models/issues/milestone.go b/models/issues/milestone.go index 1021938b20..3ccade7411 100644 --- a/models/issues/milestone.go +++ b/models/issues/milestone.go @@ -15,6 +15,7 @@ import ( "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -39,6 +40,10 @@ func (err ErrMilestoneNotExist) Error() string { return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID) } +func (err ErrMilestoneNotExist) Unwrap() error { + return util.ErrNotExist +} + // Milestone represents a milestone of repository. type Milestone struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/issues/pull.go b/models/issues/pull.go index 69259c269f..18b67eb305 100644 --- a/models/issues/pull.go +++ b/models/issues/pull.go @@ -46,6 +46,10 @@ func (err ErrPullRequestNotExist) Error() string { err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch) } +func (err ErrPullRequestNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrPullRequestAlreadyExists represents a "PullRequestAlreadyExists"-error type ErrPullRequestAlreadyExists struct { ID int64 @@ -68,6 +72,10 @@ func (err ErrPullRequestAlreadyExists) Error() string { err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch) } +func (err ErrPullRequestAlreadyExists) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrPullRequestHeadRepoMissing represents a "ErrPullRequestHeadRepoMissing" error type ErrPullRequestHeadRepoMissing struct { ID int64 diff --git a/models/issues/reaction.go b/models/issues/reaction.go index ccda10be2c..02cffad3ba 100644 --- a/models/issues/reaction.go +++ b/models/issues/reaction.go @@ -15,6 +15,7 @@ import ( "code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -34,6 +35,10 @@ func (err ErrForbiddenIssueReaction) Error() string { return fmt.Sprintf("'%s' is not an allowed reaction", err.Reaction) } +func (err ErrForbiddenIssueReaction) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrReactionAlreadyExist is used when a existing reaction was try to created type ErrReactionAlreadyExist struct { Reaction string @@ -49,6 +54,10 @@ func (err ErrReactionAlreadyExist) Error() string { return fmt.Sprintf("reaction '%s' already exists", err.Reaction) } +func (err ErrReactionAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // Reaction represents a reactions on issues and comments. type Reaction struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/issues/review.go b/models/issues/review.go index 5835900801..26fcea9eef 100644 --- a/models/issues/review.go +++ b/models/issues/review.go @@ -39,6 +39,10 @@ func (err ErrReviewNotExist) Error() string { return fmt.Sprintf("review does not exist [id: %d]", err.ID) } +func (err ErrReviewNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrNotValidReviewRequest an not allowed review request modify type ErrNotValidReviewRequest struct { Reason string @@ -59,6 +63,10 @@ func (err ErrNotValidReviewRequest) Error() string { err.RepoID) } +func (err ErrNotValidReviewRequest) Unwrap() error { + return util.ErrInvalidArgument +} + // ReviewType defines the sort of feedback a review gives type ReviewType int diff --git a/models/issues/stopwatch.go b/models/issues/stopwatch.go index 0a7ad41f9c..a87fbfafa2 100644 --- a/models/issues/stopwatch.go +++ b/models/issues/stopwatch.go @@ -25,6 +25,10 @@ func (err ErrIssueStopwatchNotExist) Error() string { return fmt.Sprintf("issue stopwatch doesn't exist[uid: %d, issue_id: %d", err.UserID, err.IssueID) } +func (err ErrIssueStopwatchNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrIssueStopwatchAlreadyExist represents an error that stopwatch is already exist type ErrIssueStopwatchAlreadyExist struct { UserID int64 @@ -35,6 +39,10 @@ func (err ErrIssueStopwatchAlreadyExist) Error() string { return fmt.Sprintf("issue stopwatch already exists[uid: %d, issue_id: %d", err.UserID, err.IssueID) } +func (err ErrIssueStopwatchAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // Stopwatch represents a stopwatch for time tracking. type Stopwatch struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/issues/tracked_time.go b/models/issues/tracked_time.go index 9f8767362f..ca21eb5149 100644 --- a/models/issues/tracked_time.go +++ b/models/issues/tracked_time.go @@ -236,7 +236,7 @@ func DeleteIssueUserTimes(issue *Issue, user *user_model.User) error { return err } if removedTime == 0 { - return db.ErrNotExist{} + return db.ErrNotExist{Resource: "tracked_time"} } if err := issue.LoadRepo(ctx); err != nil { @@ -296,7 +296,7 @@ func deleteTimes(ctx context.Context, opts FindTrackedTimesOptions) (removedTime func deleteTime(ctx context.Context, t *TrackedTime) error { if t.Deleted { - return db.ErrNotExist{ID: t.ID} + return db.ErrNotExist{Resource: "tracked_time", ID: t.ID} } t.Deleted = true _, err := db.GetEngine(ctx).ID(t.ID).Cols("deleted").Update(t) @@ -310,7 +310,7 @@ func GetTrackedTimeByID(id int64) (*TrackedTime, error) { if err != nil { return nil, err } else if !has { - return nil, db.ErrNotExist{ID: id} + return nil, db.ErrNotExist{Resource: "tracked_time", ID: id} } return time, nil } diff --git a/models/organization/org.go b/models/organization/org.go index 044ea06563..fbbf6d04fa 100644 --- a/models/organization/org.go +++ b/models/organization/org.go @@ -18,6 +18,7 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -45,6 +46,10 @@ func (err ErrOrgNotExist) Error() string { return fmt.Sprintf("org does not exist [id: %d, name: %s]", err.ID, err.Name) } +func (err ErrOrgNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrLastOrgOwner represents a "LastOrgOwner" kind of error. type ErrLastOrgOwner struct { UID int64 @@ -73,6 +78,10 @@ func (err ErrUserNotAllowedCreateOrg) Error() string { return "user is not allowed to create organizations" } +func (err ErrUserNotAllowedCreateOrg) Unwrap() error { + return util.ErrPermissionDenied +} + // Organization represents an organization type Organization user_model.User diff --git a/models/organization/team.go b/models/organization/team.go index bd80b1a8c7..83e5bd6fe1 100644 --- a/models/organization/team.go +++ b/models/organization/team.go @@ -16,6 +16,7 @@ import ( "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -43,6 +44,10 @@ func (err ErrTeamAlreadyExist) Error() string { return fmt.Sprintf("team already exists [org_id: %d, name: %s]", err.OrgID, err.Name) } +func (err ErrTeamAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrTeamNotExist represents a "TeamNotExist" error type ErrTeamNotExist struct { OrgID int64 @@ -60,6 +65,10 @@ func (err ErrTeamNotExist) Error() string { return fmt.Sprintf("team does not exist [org_id %d, team_id %d, name: %s]", err.OrgID, err.TeamID, err.Name) } +func (err ErrTeamNotExist) Unwrap() error { + return util.ErrNotExist +} + // OwnerTeamName return the owner team name const OwnerTeamName = "Owners" diff --git a/models/project/project.go b/models/project/project.go index 86a77947d8..af2c8ac2af 100644 --- a/models/project/project.go +++ b/models/project/project.go @@ -55,6 +55,10 @@ func (err ErrProjectNotExist) Error() string { return fmt.Sprintf("projects does not exist [id: %d]", err.ID) } +func (err ErrProjectNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrProjectBoardNotExist represents a "ProjectBoardNotExist" kind of error. type ErrProjectBoardNotExist struct { BoardID int64 @@ -70,6 +74,10 @@ func (err ErrProjectBoardNotExist) Error() string { return fmt.Sprintf("project board does not exist [id: %d]", err.BoardID) } +func (err ErrProjectBoardNotExist) Unwrap() error { + return util.ErrNotExist +} + // Project represents a project board type Project struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/pull/automerge.go b/models/pull/automerge.go index d0aca2e85f..16ab5af093 100644 --- a/models/pull/automerge.go +++ b/models/pull/automerge.go @@ -90,7 +90,7 @@ func DeleteScheduledAutoMerge(ctx context.Context, pullID int64) error { if err != nil { return err } else if !exist { - return db.ErrNotExist{ID: pullID} + return db.ErrNotExist{Resource: "auto_merge", ID: pullID} } _, err = db.GetEngine(ctx).ID(scheduledPRM.ID).Delete(&AutoMerge{}) diff --git a/models/repo/attachment.go b/models/repo/attachment.go index afec78a425..5d4e11ae72 100644 --- a/models/repo/attachment.go +++ b/models/repo/attachment.go @@ -14,6 +14,7 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/storage" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" ) // Attachment represent a attachment of issue/comment/release. @@ -83,6 +84,10 @@ func (err ErrAttachmentNotExist) Error() string { return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID) } +func (err ErrAttachmentNotExist) Unwrap() error { + return util.ErrNotExist +} + // GetAttachmentByID returns attachment by given id func GetAttachmentByID(ctx context.Context, id int64) (*Attachment, error) { attach := &Attachment{} diff --git a/models/repo/redirect.go b/models/repo/redirect.go index 88fad6f3e3..f28220c2af 100644 --- a/models/repo/redirect.go +++ b/models/repo/redirect.go @@ -10,6 +10,7 @@ import ( "strings" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/modules/util" ) // ErrRedirectNotExist represents a "RedirectNotExist" kind of error. @@ -28,6 +29,10 @@ func (err ErrRedirectNotExist) Error() string { return fmt.Sprintf("repository redirect does not exist [uid: %d, name: %s]", err.OwnerID, err.RepoName) } +func (err ErrRedirectNotExist) Unwrap() error { + return util.ErrNotExist +} + // Redirect represents that a repo name should be redirected to another type Redirect struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/repo/release.go b/models/repo/release.go index 2b484c9b84..2e7bc6d322 100644 --- a/models/repo/release.go +++ b/models/repo/release.go @@ -37,6 +37,10 @@ func (err ErrReleaseAlreadyExist) Error() string { return fmt.Sprintf("release tag already exist [tag_name: %s]", err.TagName) } +func (err ErrReleaseAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrReleaseNotExist represents a "ReleaseNotExist" kind of error. type ErrReleaseNotExist struct { ID int64 @@ -53,6 +57,10 @@ func (err ErrReleaseNotExist) Error() string { return fmt.Sprintf("release tag does not exist [id: %d, tag_name: %s]", err.ID, err.TagName) } +func (err ErrReleaseNotExist) Unwrap() error { + return util.ErrNotExist +} + // Release represents a release of repository. type Release struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/repo/repo.go b/models/repo/repo.go index 4fd97dcd1b..ce698baaef 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -43,6 +43,10 @@ func (err ErrUserDoesNotHaveAccessToRepo) Error() string { return fmt.Sprintf("user doesn't have access to repo [user_id: %d, repo_name: %s]", err.UserID, err.RepoName) } +func (err ErrUserDoesNotHaveAccessToRepo) Unwrap() error { + return util.ErrPermissionDenied +} + var ( reservedRepoNames = []string{".", "..", "-"} reservedRepoPatterns = []string{"*.git", "*.wiki", "*.rss", "*.atom"} @@ -643,6 +647,11 @@ func (err ErrRepoNotExist) Error() string { err.ID, err.UID, err.OwnerName, err.Name) } +// Unwrap unwraps this error as a ErrNotExist error +func (err ErrRepoNotExist) Unwrap() error { + return util.ErrNotExist +} + // GetRepositoryByOwnerAndNameCtx returns the repository by given owner name and repo name func GetRepositoryByOwnerAndNameCtx(ctx context.Context, ownerName, repoName string) (*Repository, error) { var repo Repository diff --git a/models/repo/repo_unit.go b/models/repo/repo_unit.go index da3e19dece..dd85ca9186 100644 --- a/models/repo/repo_unit.go +++ b/models/repo/repo_unit.go @@ -13,6 +13,7 @@ import ( "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/xorm" "xorm.io/xorm/convert" @@ -33,6 +34,10 @@ func (err ErrUnitTypeNotExist) Error() string { return fmt.Sprintf("Unit type does not exist: %s", err.UT.String()) } +func (err ErrUnitTypeNotExist) Unwrap() error { + return util.ErrNotExist +} + // RepoUnit describes all units of a repository type RepoUnit struct { //revive:disable-line:exported ID int64 diff --git a/models/repo/topic.go b/models/repo/topic.go index 7ba9a49e89..33bbb05af9 100644 --- a/models/repo/topic.go +++ b/models/repo/topic.go @@ -13,6 +13,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -55,6 +56,10 @@ func (err ErrTopicNotExist) Error() string { return fmt.Sprintf("topic is not exist [name: %s]", err.Name) } +func (err ErrTopicNotExist) Unwrap() error { + return util.ErrNotExist +} + // ValidateTopic checks a topic by length and match pattern rules func ValidateTopic(topic string) bool { return len(topic) <= 35 && topicPattern.MatchString(topic) diff --git a/models/repo/update.go b/models/repo/update.go index 07776ebc01..64a225d2f5 100644 --- a/models/repo/update.go +++ b/models/repo/update.go @@ -63,6 +63,10 @@ func (err ErrReachLimitOfRepo) Error() string { return fmt.Sprintf("user has reached maximum limit of repositories [limit: %d]", err.Limit) } +func (err ErrReachLimitOfRepo) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrRepoAlreadyExist represents a "RepoAlreadyExist" kind of error. type ErrRepoAlreadyExist struct { Uname string @@ -79,6 +83,10 @@ func (err ErrRepoAlreadyExist) Error() string { return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name) } +func (err ErrRepoAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrRepoFilesAlreadyExist represents a "RepoFilesAlreadyExist" kind of error. type ErrRepoFilesAlreadyExist struct { Uname string @@ -95,6 +103,10 @@ func (err ErrRepoFilesAlreadyExist) Error() string { return fmt.Sprintf("repository files already exist [uname: %s, name: %s]", err.Uname, err.Name) } +func (err ErrRepoFilesAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // CheckCreateRepository check if could created a repository func CheckCreateRepository(doer, u *user_model.User, name string, overwriteOrAdopt bool) error { if !doer.CanCreateRepo() { diff --git a/models/repo/upload.go b/models/repo/upload.go index 24544910b1..e3ce7e458f 100644 --- a/models/repo/upload.go +++ b/models/repo/upload.go @@ -36,6 +36,10 @@ func (err ErrUploadNotExist) Error() string { return fmt.Sprintf("attachment does not exist [id: %d, uuid: %s]", err.ID, err.UUID) } +func (err ErrUploadNotExist) Unwrap() error { + return util.ErrNotExist +} + // Upload represent a uploaded file to a repo to be deleted when moved type Upload struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/repo/wiki.go b/models/repo/wiki.go index 72ec7c394b..c8886eaa34 100644 --- a/models/repo/wiki.go +++ b/models/repo/wiki.go @@ -30,6 +30,10 @@ func (err ErrWikiAlreadyExist) Error() string { return fmt.Sprintf("wiki page already exists [title: %s]", err.Title) } +func (err ErrWikiAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrWikiReservedName represents a reserved name error. type ErrWikiReservedName struct { Title string @@ -45,6 +49,10 @@ func (err ErrWikiReservedName) Error() string { return fmt.Sprintf("wiki title is reserved: %s", err.Title) } +func (err ErrWikiReservedName) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrWikiInvalidFileName represents an invalid wiki file name. type ErrWikiInvalidFileName struct { FileName string @@ -60,6 +68,10 @@ func (err ErrWikiInvalidFileName) Error() string { return fmt.Sprintf("Invalid wiki filename: %s", err.FileName) } +func (err ErrWikiInvalidFileName) Unwrap() error { + return util.ErrInvalidArgument +} + // WikiCloneLink returns clone URLs of repository wiki. func (repo *Repository) WikiCloneLink() *CloneLink { return repo.cloneLink(true) diff --git a/models/user/email_address.go b/models/user/email_address.go index d87b945706..964e7ae08c 100644 --- a/models/user/email_address.go +++ b/models/user/email_address.go @@ -40,6 +40,10 @@ func (err ErrEmailCharIsNotSupported) Error() string { return fmt.Sprintf("e-mail address contains unsupported character [email: %s]", err.Email) } +func (err ErrEmailCharIsNotSupported) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrEmailInvalid represents an error where the email address does not comply with RFC 5322 // or has a leading '-' character type ErrEmailInvalid struct { @@ -56,6 +60,10 @@ func (err ErrEmailInvalid) Error() string { return fmt.Sprintf("e-mail invalid [email: %s]", err.Email) } +func (err ErrEmailInvalid) Unwrap() error { + return util.ErrInvalidArgument +} + // ErrEmailAlreadyUsed represents a "EmailAlreadyUsed" kind of error. type ErrEmailAlreadyUsed struct { Email string @@ -71,6 +79,10 @@ func (err ErrEmailAlreadyUsed) Error() string { return fmt.Sprintf("e-mail already in use [email: %s]", err.Email) } +func (err ErrEmailAlreadyUsed) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrEmailAddressNotExist email address not exist type ErrEmailAddressNotExist struct { Email string @@ -86,6 +98,10 @@ func (err ErrEmailAddressNotExist) Error() string { return fmt.Sprintf("Email address does not exist [email: %s]", err.Email) } +func (err ErrEmailAddressNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrPrimaryEmailCannotDelete primary email address cannot be deleted type ErrPrimaryEmailCannotDelete struct { Email string @@ -101,6 +117,10 @@ func (err ErrPrimaryEmailCannotDelete) Error() string { return fmt.Sprintf("Primary email address cannot be deleted [email: %s]", err.Email) } +func (err ErrPrimaryEmailCannotDelete) Unwrap() error { + return util.ErrInvalidArgument +} + // EmailAddress is the list of all email addresses of a user. It also contains the // primary email address which is saved in user table. type EmailAddress struct { diff --git a/models/user/error.go b/models/user/error.go index 25e0d8ea8a..3fe4ee6657 100644 --- a/models/user/error.go +++ b/models/user/error.go @@ -6,6 +6,8 @@ package user import ( "fmt" + + "code.gitea.io/gitea/modules/util" ) // ____ ___ @@ -30,6 +32,11 @@ func (err ErrUserAlreadyExist) Error() string { return fmt.Sprintf("user already exists [name: %s]", err.Name) } +// Unwrap unwraps this error as a ErrExist error +func (err ErrUserAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrUserNotExist represents a "UserNotExist" kind of error. type ErrUserNotExist struct { UID int64 @@ -47,6 +54,11 @@ func (err ErrUserNotExist) Error() string { return fmt.Sprintf("user does not exist [uid: %d, name: %s, keyid: %d]", err.UID, err.Name, err.KeyID) } +// Unwrap unwraps this error as a ErrNotExist error +func (err ErrUserNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrUserProhibitLogin represents a "ErrUserProhibitLogin" kind of error. type ErrUserProhibitLogin struct { UID int64 @@ -63,6 +75,11 @@ func (err ErrUserProhibitLogin) Error() string { return fmt.Sprintf("user is not allowed login [uid: %d, name: %s]", err.UID, err.Name) } +// Unwrap unwraps this error as a ErrPermission error +func (err ErrUserProhibitLogin) Unwrap() error { + return util.ErrPermissionDenied +} + // ErrUserInactive represents a "ErrUserInactive" kind of error. type ErrUserInactive struct { UID int64 @@ -78,3 +95,8 @@ func IsErrUserInactive(err error) bool { func (err ErrUserInactive) Error() string { return fmt.Sprintf("user is inactive [uid: %d, name: %s]", err.UID, err.Name) } + +// Unwrap unwraps this error as a ErrPermission error +func (err ErrUserInactive) Unwrap() error { + return util.ErrPermissionDenied +} diff --git a/models/user/external_login_user.go b/models/user/external_login_user.go index 422823b89c..496717c57b 100644 --- a/models/user/external_login_user.go +++ b/models/user/external_login_user.go @@ -10,6 +10,7 @@ import ( "time" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/modules/util" "xorm.io/builder" ) @@ -31,6 +32,10 @@ func (err ErrExternalLoginUserAlreadyExist) Error() string { return fmt.Sprintf("external login user already exists [externalID: %s, userID: %d, loginSourceID: %d]", err.ExternalID, err.UserID, err.LoginSourceID) } +func (err ErrExternalLoginUserAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ErrExternalLoginUserNotExist represents a "ExternalLoginUserNotExist" kind of error. type ErrExternalLoginUserNotExist struct { UserID int64 @@ -47,6 +52,10 @@ func (err ErrExternalLoginUserNotExist) Error() string { return fmt.Sprintf("external login user link does not exists [userID: %d, loginSourceID: %d]", err.UserID, err.LoginSourceID) } +func (err ErrExternalLoginUserNotExist) Unwrap() error { + return util.ErrNotExist +} + // ExternalLoginUser makes the connecting between some existing user and additional external login sources type ExternalLoginUser struct { ExternalID string `xorm:"pk NOT NULL"` diff --git a/models/user/openid.go b/models/user/openid.go index 8ef0ce5ed7..f8e8a787e6 100644 --- a/models/user/openid.go +++ b/models/user/openid.go @@ -10,6 +10,7 @@ import ( "fmt" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/modules/util" ) // ErrOpenIDNotExist openid is not known @@ -65,6 +66,10 @@ func (err ErrOpenIDAlreadyUsed) Error() string { return fmt.Sprintf("OpenID already in use [oid: %s]", err.OpenID) } +func (err ErrOpenIDAlreadyUsed) Unwrap() error { + return util.ErrAlreadyExist +} + // AddUserOpenID adds an pre-verified/normalized OpenID URI to given user. // NOTE: make sure openid.URI is normalized already func AddUserOpenID(ctx context.Context, openid *UserOpenID) error { diff --git a/models/user/redirect.go b/models/user/redirect.go index 49370218db..af8d6439ad 100644 --- a/models/user/redirect.go +++ b/models/user/redirect.go @@ -10,6 +10,7 @@ import ( "strings" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/modules/util" ) // ErrUserRedirectNotExist represents a "UserRedirectNotExist" kind of error. @@ -27,6 +28,10 @@ func (err ErrUserRedirectNotExist) Error() string { return fmt.Sprintf("user redirect does not exist [name: %s]", err.Name) } +func (err ErrUserRedirectNotExist) Unwrap() error { + return util.ErrNotExist +} + // Redirect represents that a user name should be redirected to another type Redirect struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/webhook/webhook.go b/models/webhook/webhook.go index ac09220630..83200a3d1c 100644 --- a/models/webhook/webhook.go +++ b/models/webhook/webhook.go @@ -41,6 +41,10 @@ func (err ErrWebhookNotExist) Error() string { return fmt.Sprintf("webhook does not exist [id: %d]", err.ID) } +func (err ErrWebhookNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrHookTaskNotExist represents a "HookTaskNotExist" kind of error. type ErrHookTaskNotExist struct { HookID int64 @@ -57,6 +61,10 @@ func (err ErrHookTaskNotExist) Error() string { return fmt.Sprintf("hook task does not exist [hook: %d, uuid: %s]", err.HookID, err.UUID) } +func (err ErrHookTaskNotExist) Unwrap() error { + return util.ErrNotExist +} + // HookContentType is the content type of a web hook type HookContentType int diff --git a/modules/git/error.go b/modules/git/error.go index 387dd724e5..40c4106414 100644 --- a/modules/git/error.go +++ b/modules/git/error.go @@ -8,6 +8,8 @@ import ( "fmt" "strings" "time" + + "code.gitea.io/gitea/modules/util" ) // ErrExecTimeout error when exec timed out @@ -41,6 +43,10 @@ func (err ErrNotExist) Error() string { return fmt.Sprintf("object does not exist [id: %s, rel_path: %s]", err.ID, err.RelPath) } +func (err ErrNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrBadLink entry.FollowLink error type ErrBadLink struct { Name string @@ -87,6 +93,10 @@ func (err ErrBranchNotExist) Error() string { return fmt.Sprintf("branch does not exist [name: %s]", err.Name) } +func (err ErrBranchNotExist) Unwrap() error { + return util.ErrNotExist +} + // ErrPushOutOfDate represents an error if merging fails due to unrelated histories type ErrPushOutOfDate struct { StdOut string diff --git a/modules/translation/i18n/errors.go b/modules/translation/i18n/errors.go index b485badd1d..a81b0bc1ac 100644 --- a/modules/translation/i18n/errors.go +++ b/modules/translation/i18n/errors.go @@ -4,9 +4,11 @@ package i18n -import "errors" +import ( + "code.gitea.io/gitea/modules/util" +) var ( - ErrLocaleAlreadyExist = errors.New("lang already exists") - ErrUncertainArguments = errors.New("arguments to i18n should not contain uncertain slices") + ErrLocaleAlreadyExist = util.SilentWrap{Message: "lang already exists", Err: util.ErrAlreadyExist} + ErrUncertainArguments = util.SilentWrap{Message: "arguments to i18n should not contain uncertain slices", Err: util.ErrInvalidArgument} ) diff --git a/modules/util/error.go b/modules/util/error.go new file mode 100644 index 0000000000..08e491dbaf --- /dev/null +++ b/modules/util/error.go @@ -0,0 +1,37 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package util + +import ( + "errors" +) + +// Common Errors forming the base of our error system +// +// Many Errors returned by Gitea can be tested against these errors +// using errors.Is. +var ( + ErrInvalidArgument = errors.New("invalid argument") + ErrPermissionDenied = errors.New("permission denied") + ErrAlreadyExist = errors.New("resource already exists") + ErrNotExist = errors.New("resource does not exist") +) + +// SilentWrap provides a simple wrapper for a wrapped error where the wrapped error message plays no part in the error message +// Especially useful for "untyped" errors created with "errors.New(…)" that can be classified as 'invalid argument', 'permission denied', 'exists already', or 'does not exist' +type SilentWrap struct { + Message string + Err error +} + +// Error returns the message +func (w SilentWrap) Error() string { + return w.Message +} + +// Unwrap returns the underlying error +func (w SilentWrap) Unwrap() error { + return w.Err +} diff --git a/services/repository/fork.go b/services/repository/fork.go index 96c391e715..32a516b79f 100644 --- a/services/repository/fork.go +++ b/services/repository/fork.go @@ -39,6 +39,10 @@ func (err ErrForkAlreadyExist) Error() string { return fmt.Sprintf("repository is already forked by user [uname: %s, repo path: %s, fork path: %s]", err.Uname, err.RepoName, err.ForkName) } +func (err ErrForkAlreadyExist) Unwrap() error { + return util.ErrAlreadyExist +} + // ForkRepoOptions contains the fork repository options type ForkRepoOptions struct { BaseRepo *repo_model.Repository From 20a5452ea64e73b921b56d39195c71514c14f3c3 Mon Sep 17 00:00:00 2001 From: zenofile Date: Tue, 18 Oct 2022 10:01:02 +0200 Subject: [PATCH 40/78] Fix viewing user subscriptions (#21482) Fix enumeration of user subscriptions. `watch.mode` is not a boolean but a smallint. Fixes #21447 Regression of #17156 --- models/issues/issue.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/issues/issue.go b/models/issues/issue.go index e56e43bd1a..f77166db11 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -1496,7 +1496,8 @@ func applySubscribedCondition(sess *xorm.Session, subscriberID int64) *xorm.Sess builder.In("issue.repo_id", builder. Select("id"). From("watch"). - Where(builder.Eq{"user_id": subscriberID, "mode": true}), + Where(builder.And(builder.Eq{"user_id": subscriberID}, + builder.In("mode", repo_model.WatchModeNormal, repo_model.WatchModeAuto))), ), ), ) From f0182d88402c68c4032bd5314680ef4bee1f16ea Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 18 Oct 2022 23:16:58 +0800 Subject: [PATCH 41/78] Fix read system configuration bug when installing (#21489) Fix https://github.com/go-gitea/gitea/pull/18058#issuecomment-1280944311 Co-authored-by: 6543 <6543@obermui.de> --- routers/install/install.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/routers/install/install.go b/routers/install/install.go index 8a0d34d976..962dee8c86 100644 --- a/routers/install/install.go +++ b/routers/install/install.go @@ -149,19 +149,9 @@ func Install(ctx *context.Context) { // Server and other services settings form.OfflineMode = setting.OfflineMode - disableGravatarSetting, _ := system_model.GetSetting(system_model.KeyPictureDisableGravatar) - if disableGravatarSetting != nil { - form.DisableGravatar = disableGravatarSetting.GetValueBool() - } else { - form.DisableGravatar = false - } + form.DisableGravatar = false // when installing, there is no database connection so that given a default value + form.EnableFederatedAvatar = false // when installing, there is no database connection so that given a default value - enableFederatedAvatarSetting, _ := system_model.GetSetting(system_model.KeyPictureEnableFederatedAvatar) - if enableFederatedAvatarSetting != nil { - form.EnableFederatedAvatar = enableFederatedAvatarSetting.GetValueBool() - } else { - form.EnableFederatedAvatar = false - } form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp form.DisableRegistration = setting.Service.DisableRegistration @@ -385,7 +375,6 @@ func SubmitInstall(ctx *context.Context) { ctx.RenderWithErr(ctx.Tr("install.invalid_db_setting", err), tplInstall, &form) return } - db.UnsetDefaultEngine() // Save settings. cfg := ini.Empty() @@ -518,6 +507,9 @@ func SubmitInstall(ctx *context.Context) { return } + // unset default engine before reload database setting + db.UnsetDefaultEngine() + // ---- All checks are passed // Reload settings (and re-initialize database connection) From 0614ae1c446e6a4ddaed4cca5a43ce7a2003d890 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 19 Oct 2022 00:52:25 +0800 Subject: [PATCH 42/78] Remove unnecessary misspell ignore pattern (#21475) It doesn't make sense to ignore the pattern again and again. --- Makefile | 2 +- modules/paginator/paginator.go | 2 +- modules/paginator/paginator_test.go | 2 +- modules/references/references_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 5170436d83..f1b6790dc5 100644 --- a/Makefile +++ b/Makefile @@ -280,7 +280,7 @@ fmt-check: fmt .PHONY: misspell-check misspell-check: - go run $(MISSPELL_PACKAGE) -error -i unknwon $(GO_DIRS) $(WEB_DIRS) + go run $(MISSPELL_PACKAGE) -error $(GO_DIRS) $(WEB_DIRS) .PHONY: vet vet: diff --git a/modules/paginator/paginator.go b/modules/paginator/paginator.go index 873cfe49d4..342ee8929c 100644 --- a/modules/paginator/paginator.go +++ b/modules/paginator/paginator.go @@ -1,5 +1,5 @@ // Copyright 2022 The Gitea Authors. -// Copyright 2015 Unknwon. Licensed under the Apache License, Version 2.0 +// Copyright 2015 https://github.com/unknwon. Licensed under the Apache License, Version 2.0 package paginator diff --git a/modules/paginator/paginator_test.go b/modules/paginator/paginator_test.go index ce7b7275e1..404f76f6c4 100644 --- a/modules/paginator/paginator_test.go +++ b/modules/paginator/paginator_test.go @@ -1,5 +1,5 @@ // Copyright 2022 The Gitea Authors. -// Copyright 2015 Unknwon. Licensed under the Apache License, Version 2.0 +// Copyright 2015 https://github.com/unknwon. Licensed under the Apache License, Version 2.0 package paginator diff --git a/modules/references/references_test.go b/modules/references/references_test.go index adf86a3c6c..507adadb1f 100644 --- a/modules/references/references_test.go +++ b/modules/references/references_test.go @@ -309,7 +309,7 @@ func TestRegExp_mentionPattern(t *testing.T) { pat string exp string }{ - {"@Unknwon", "@Unknwon"}, + {"@User", "@User"}, {"@ANT_123", "@ANT_123"}, {"@xxx-DiN0-z-A..uru..s-xxx", "@xxx-DiN0-z-A..uru..s-xxx"}, {" @lol ", "@lol"}, From 522dfd542511641b84331c989860cc46cf02d385 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 19 Oct 2022 00:21:12 +0000 Subject: [PATCH 43/78] [skip ci] Updated translations via Crowdin --- options/locale/locale_cs-CZ.ini | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index dcf99124c2..654a9480f0 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -268,8 +268,11 @@ users=Uživatelé organizations=Organizace search=Vyhledat code=Zdrojový kód +search.type.tooltip=Druh vyhledávání search.fuzzy=Fuzzy +search.fuzzy.tooltip=Zahrnout výsledky, které také úzce odpovídají hledanému výrazu search.match=Shoda +search.match.tooltip=Zahrnout pouze výsledky, které odpovídají přesnému hledanému výrazu code_search_unavailable=V současné době není vyhledávání kódu dostupné. Obraťte se na správce webu. repo_no_results=Nebyly nalezeny žádné odpovídající repozitáře. user_no_results=Nebyly nalezeni žádní odpovídající uživatelé. @@ -507,6 +510,7 @@ activity=Veřejná aktivita followers=Sledující starred=Oblíbené repozitáře watched=Sledované repozitáře +code=Kód projects=Projekty following=Sledovaní follow=Sledovat @@ -1763,8 +1767,11 @@ activity.git_stats_deletion_n=%d odebrání search=Vyhledat search.search_repo=Hledat repozitář +search.type.tooltip=Druh vyhledávání search.fuzzy=Fuzzy +search.fuzzy.tooltip=Zahrnout výsledky, které také úzce odpovídají hledanému výrazu search.match=Shoda +search.match.tooltip=Zahrnout pouze výsledky, které odpovídají přesnému hledanému výrazu search.results=Výsledky hledání „%s“ v %s search.code_no_results=Nebyl nalezen žádný zdrojový kód odpovídající hledanému výrazu. search.code_search_unavailable=V současné době není vyhledávání kódu dostupné. Obraťte se na správce webu. @@ -2310,6 +2317,7 @@ create_org=Vytvořit organizaci repo_updated=Upraveno people=Lidé teams=Týmy +code=Kód lower_members=členové lower_repositories=repozitáře create_new_team=Nový tým @@ -2871,6 +2879,8 @@ config.access_log_template=Šablona config.xorm_log_mode=Režim logování XORM config.xorm_log_sql=Logovat SQL +config.get_setting_failed=Získání nastavení %s se nezdařilo +config.set_setting_failed=Nastavení %s se nezdařilo monitor.cron=Naplánované úlohy monitor.name=Název @@ -3035,6 +3045,9 @@ pin=Připnout upozornění mark_as_read=Označit jako přečtené mark_as_unread=Označit jako nepřečtené mark_all_as_read=Označit vše jako přečtené +subscriptions=Odběry +watching=Sledované +no_subscriptions=Žádné odběry [gpg] default_key=Podepsáno výchozím klíčem From e27d52b2766ba83e583940401a8f20c3b2a7ff5e Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 19 Oct 2022 07:39:55 +0200 Subject: [PATCH 44/78] Fix branch dropdown shifting on page load (#21428) Removed the "tag/branch" prefix and did some misc tweaks like changing to `
      From 37ca4cb7d61c0460d5d8e3dce35964ffc72a9f9d Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 19 Oct 2022 08:50:19 +0200 Subject: [PATCH 45/78] Remove vitest globals (#21505) Explicitly import them instead which is cleaner and enables better editor integration. Co-authored-by: Lunny Xiao Co-authored-by: wxiaoguang --- .eslintrc.yaml | 3 --- vitest.config.js | 1 - web_src/js/features/repo-findfile.test.js | 1 + web_src/js/svg.test.js | 1 + web_src/js/utils.test.js | 1 + 5 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 66d4452ec5..4dafc8f492 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -35,9 +35,6 @@ overrides: rules: import/no-unresolved: [0] import/no-extraneous-dependencies: [0] - - files: ["*.test.js"] - env: - jest: true - files: ["*.config.js"] rules: import/no-unused-modules: [0] diff --git a/vitest.config.js b/vitest.config.js index d17abd26c3..838360970f 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -24,7 +24,6 @@ export default defineConfig({ open: false, allowOnly: true, passWithNoTests: true, - globals: true, watch: false, }, plugins: [ diff --git a/web_src/js/features/repo-findfile.test.js b/web_src/js/features/repo-findfile.test.js index 2d96ed4463..a90b0bf0a2 100644 --- a/web_src/js/features/repo-findfile.test.js +++ b/web_src/js/features/repo-findfile.test.js @@ -1,3 +1,4 @@ +import {describe, expect, test} from 'vitest'; import {strSubMatch, calcMatchedWeight, filterRepoFilesWeighted} from './repo-findfile.js'; describe('Repo Find Files', () => { diff --git a/web_src/js/svg.test.js b/web_src/js/svg.test.js index 9f2836b667..c5d6d07535 100644 --- a/web_src/js/svg.test.js +++ b/web_src/js/svg.test.js @@ -1,3 +1,4 @@ +import {expect, test} from 'vitest'; import {svg} from './svg.js'; test('svg', () => { diff --git a/web_src/js/utils.test.js b/web_src/js/utils.test.js index b56d80ac7a..7bf5bb7eb6 100644 --- a/web_src/js/utils.test.js +++ b/web_src/js/utils.test.js @@ -1,3 +1,4 @@ +import {expect, test} from 'vitest'; import { basename, extname, isObject, uniq, stripTags, joinPaths, parseIssueHref, prettyNumber, parseUrl, From 7d1aed83f4d0cdf096ec8758ff8a85ddccf1328d Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 19 Oct 2022 10:08:33 +0200 Subject: [PATCH 46/78] Disable the 'Add File' button when not able to edit repo (#21503) Previously, the button would render a dropdown with zero items when `.CanEnableEditor` was false (for example on a mirror repo). Now it disables the button instead which is better UX. image image Co-authored-by: Lauris BH Co-authored-by: Lunny Xiao --- templates/repo/home.tmpl | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index c523ce3556..39e58d8e0f 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -77,25 +77,23 @@ {{svg "octicon-file-moved" 15}} {{end}} {{if or .CanAddFile .CanUploadFile}} - + +
      + + + +{{template "base/footer" .}} diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index ecb7830f18..1a58dc5339 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -13,7 +13,7 @@ {{.CsrfTokenHtml}}
      - + {{if and .Invites $.IsOrganizationOwner}} +

      {{$.locale.Tr "org.teams.invite_team_member.list"}}

      +
      + {{range .Invites}} +
      +
      + {{$.CsrfTokenHtml}} + + +
      + {{.Email}} +
      + {{end}} +
      + {{end}}
      diff --git a/tests/integration/org_team_invite_test.go b/tests/integration/org_team_invite_test.go new file mode 100644 index 0000000000..470478589a --- /dev/null +++ b/tests/integration/org_team_invite_test.go @@ -0,0 +1,72 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package integration + +import ( + "fmt" + "net/http" + "testing" + + "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/models/organization" + "code.gitea.io/gitea/models/unittest" + user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/test" + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestOrgTeamEmailInvite(t *testing.T) { + if setting.MailService == nil { + t.Skip() + return + } + + defer tests.PrepareTestEnv(t)() + + org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 3}) + team := unittest.AssertExistsAndLoadBean(t, &organization.Team{ID: 2}) + user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 5}) + + isMember, err := organization.IsTeamMember(db.DefaultContext, team.OrgID, team.ID, user.ID) + assert.NoError(t, err) + assert.False(t, isMember) + + session := loginUser(t, "user1") + + url := fmt.Sprintf("/org/%s/teams/%s", org.Name, team.Name) + csrf := GetCSRF(t, session, url) + req := NewRequestWithValues(t, "POST", url+"/action/add", map[string]string{ + "_csrf": csrf, + "uid": "1", + "uname": user.Email, + }) + resp := session.MakeRequest(t, req, http.StatusSeeOther) + req = NewRequest(t, "GET", test.RedirectURL(resp)) + session.MakeRequest(t, req, http.StatusOK) + + // get the invite token + invites, err := organization.GetInvitesByTeamID(db.DefaultContext, team.ID) + assert.NoError(t, err) + assert.Len(t, invites, 1) + + session = loginUser(t, user.Name) + + // join the team + url = fmt.Sprintf("/org/invite/%s", invites[0].Token) + csrf = GetCSRF(t, session, url) + req = NewRequestWithValues(t, "POST", url, map[string]string{ + "_csrf": csrf, + }) + resp = session.MakeRequest(t, req, http.StatusSeeOther) + req = NewRequest(t, "GET", test.RedirectURL(resp)) + session.MakeRequest(t, req, http.StatusOK) + + isMember, err = organization.IsTeamMember(db.DefaultContext, team.OrgID, team.ID, user.ID) + assert.NoError(t, err) + assert.True(t, isMember) +} diff --git a/web_src/js/features/comp/SearchUserBox.js b/web_src/js/features/comp/SearchUserBox.js index 08f97595af..46ecb8ebf4 100644 --- a/web_src/js/features/comp/SearchUserBox.js +++ b/web_src/js/features/comp/SearchUserBox.js @@ -3,15 +3,20 @@ import {htmlEscape} from 'escape-goat'; const {appSubUrl} = window.config; +const looksLikeEmailAddressCheck = /^\S+@\S+$/; + export function initCompSearchUserBox() { const $searchUserBox = $('#search-user-box'); + const allowEmailInput = $searchUserBox.attr('data-allow-email') === 'true'; + const allowEmailDescription = $searchUserBox.attr('data-allow-email-description'); $searchUserBox.search({ minCharacters: 2, apiSettings: { url: `${appSubUrl}/user/search?q={query}`, onResponse(response) { const items = []; - const searchQueryUppercase = $searchUserBox.find('input').val().toUpperCase(); + const searchQuery = $searchUserBox.find('input').val(); + const searchQueryUppercase = searchQuery.toUpperCase(); $.each(response.data, (_i, item) => { let title = item.login; if (item.full_name && item.full_name.length > 0) { @@ -28,6 +33,14 @@ export function initCompSearchUserBox() { } }); + if (allowEmailInput && items.length === 0 && looksLikeEmailAddressCheck.test(searchQuery)) { + const resultItem = { + title: searchQuery, + description: allowEmailDescription + }; + items.push(resultItem); + } + return {results: items}; } }, diff --git a/web_src/less/_organization.less b/web_src/less/_organization.less index b80739671f..c52753e29b 100644 --- a/web_src/less/_organization.less +++ b/web_src/less/_organization.less @@ -119,6 +119,11 @@ margin-top: -3px; } } + + .ui.avatar { + width: 100%; + height: 100%; + } } &.members { From 6b712465a815d0da51ca7d33289610eaef0887ad Mon Sep 17 00:00:00 2001 From: Gusted Date: Wed, 19 Oct 2022 14:48:29 +0000 Subject: [PATCH 48/78] Revert increased width on pull pages (#21470) - Revert a behavior from #21012, which liberally added `fluid padded` to non-split style pull pages, this caused it to take up the whole screen(such in split-style pull pages) on pull pages where the diff was shown. - Resolves #21460 ### Before ![image](https://user-images.githubusercontent.com/25481501/196005545-bb8370c1-330d-4d47-be52-6d0c93e61583.png) ![image](https://user-images.githubusercontent.com/25481501/196005546-0022198e-6ef7-45d1-958c-77a042e5f80b.png) ### After ![image](https://user-images.githubusercontent.com/25481501/196005572-76a38309-9a41-412a-854f-24eae2b9ae4f.png) ![image](https://user-images.githubusercontent.com/25481501/196005551-2495b93d-ad08-4f59-abba-c327dadcc915.png) --- templates/repo/commit_page.tmpl | 2 +- templates/repo/diff/compare.tmpl | 2 +- templates/repo/pulls/files.tmpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index da37aaa9b3..8ece768832 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}}
      {{template "repo/header" .}} -
      +
      {{$class := ""}} {{if .Commit.Signature}} {{$class = (printf "%s%s" $class " isSigned")}} diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index e0e6837203..029e7717a4 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}}
      {{template "repo/header" .}} -
      +

      {{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}} diff --git a/templates/repo/pulls/files.tmpl b/templates/repo/pulls/files.tmpl index 7b72f7f815..9b24000002 100644 --- a/templates/repo/pulls/files.tmpl +++ b/templates/repo/pulls/files.tmpl @@ -5,7 +5,7 @@
      {{template "repo/header" .}} -
      +
      {{end}} + {{else}} + + {{svg "octicon-rss"}} {{.locale.Tr "user.activity"}} + + {{if not .DisableStars}} + + {{svg "octicon-star"}} {{.locale.Tr "user.starred"}} + {{if .Owner.NumStars}} +
      {{.Owner.NumStars}}
      + {{end}} +
      + {{else}} + + {{svg "octicon-eye"}} {{.locale.Tr "user.watched"}} + + {{end}} {{end}}