forked from mirror/gitea
Compare commits
4 Commits
0db554fa63
...
eb505b128c
Author | SHA1 | Date | |
---|---|---|---|
KN4CK3R | eb505b128c | ||
silverwind | 944c76e784 | ||
Lunny Xiao | b482567059 | ||
GiteaBot | 8a5c597c1d |
|
@ -139,13 +139,7 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
|
|||
}
|
||||
}
|
||||
|
||||
keyID := ""
|
||||
if sig.IssuerKeyId != nil && (*sig.IssuerKeyId) != 0 {
|
||||
keyID = fmt.Sprintf("%X", *sig.IssuerKeyId)
|
||||
}
|
||||
if keyID == "" && sig.IssuerFingerprint != nil && len(sig.IssuerFingerprint) > 0 {
|
||||
keyID = fmt.Sprintf("%X", sig.IssuerFingerprint[12:20])
|
||||
}
|
||||
keyID := tryGetKeyIDFromSignature(sig)
|
||||
defaultReason := NoKeyFound
|
||||
|
||||
// First check if the sig has a keyID and if so just look at that
|
||||
|
|
|
@ -134,3 +134,13 @@ func extractSignature(s string) (*packet.Signature, error) {
|
|||
}
|
||||
return sig, nil
|
||||
}
|
||||
|
||||
func tryGetKeyIDFromSignature(sig *packet.Signature) string {
|
||||
if sig.IssuerKeyId != nil && (*sig.IssuerKeyId) != 0 {
|
||||
return fmt.Sprintf("%016X", *sig.IssuerKeyId)
|
||||
}
|
||||
if sig.IssuerFingerprint != nil && len(sig.IssuerFingerprint) > 0 {
|
||||
return fmt.Sprintf("%016X", sig.IssuerFingerprint[12:20])
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@ import (
|
|||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"github.com/keybase/go-crypto/openpgp/packet"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
@ -391,3 +393,13 @@ epiDVQ==
|
|||
assert.Equal(t, time.Unix(1586105389, 0), expire)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTryGetKeyIDFromSignature(t *testing.T) {
|
||||
assert.Empty(t, tryGetKeyIDFromSignature(&packet.Signature{}))
|
||||
assert.Equal(t, "038D1A3EADDBEA9C", tryGetKeyIDFromSignature(&packet.Signature{
|
||||
IssuerKeyId: util.ToPointer(uint64(0x38D1A3EADDBEA9C)),
|
||||
}))
|
||||
assert.Equal(t, "038D1A3EADDBEA9C", tryGetKeyIDFromSignature(&packet.Signature{
|
||||
IssuerFingerprint: []uint8{0xb, 0x23, 0x24, 0xc7, 0xe6, 0xfe, 0x4f, 0x3a, 0x6, 0x26, 0xc1, 0x21, 0x3, 0x8d, 0x1a, 0x3e, 0xad, 0xdb, 0xea, 0x9c},
|
||||
}))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
-
|
||||
id: 1
|
||||
project_id: 1
|
||||
issue_id: 1
|
||||
|
||||
-
|
||||
id: 2
|
||||
project_id: 1
|
||||
issue_id: 1
|
|
@ -21,6 +21,7 @@ import (
|
|||
"code.gitea.io/gitea/models/migrations/v1_20"
|
||||
"code.gitea.io/gitea/models/migrations/v1_21"
|
||||
"code.gitea.io/gitea/models/migrations/v1_22"
|
||||
"code.gitea.io/gitea/models/migrations/v1_23"
|
||||
"code.gitea.io/gitea/models/migrations/v1_6"
|
||||
"code.gitea.io/gitea/models/migrations/v1_7"
|
||||
"code.gitea.io/gitea/models/migrations/v1_8"
|
||||
|
@ -572,6 +573,10 @@ var migrations = []Migration{
|
|||
NewMigration("Ensure every project has exactly one default column - No Op", noopMigration),
|
||||
// v293 -> v294
|
||||
NewMigration("Ensure every project has exactly one default column", v1_22.CheckProjectColumnsConsistency),
|
||||
|
||||
// Gitea 1.22.0 ends at 294
|
||||
|
||||
NewMigration("Add unique index for project issue table", v1_23.AddUniqueIndexForProjectIssue),
|
||||
}
|
||||
|
||||
// GetCurrentDBVersion returns the current db version
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_23 //nolint
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
base.MainTest(m)
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_23 //nolint
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
// AddUniqueIndexForProjectIssue adds unique indexes for project issue table
|
||||
func AddUniqueIndexForProjectIssue(x *xorm.Engine) error {
|
||||
// remove possible duplicated records in table project_issue
|
||||
type result struct {
|
||||
IssueID int64
|
||||
ProjectID int64
|
||||
Cnt int
|
||||
}
|
||||
var results []result
|
||||
if err := x.Select("issue_id, project_id, count(*) as cnt").
|
||||
Table("project_issue").
|
||||
GroupBy("issue_id, project_id").
|
||||
Having("count(*) > 1").
|
||||
Find(&results); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, r := range results {
|
||||
if x.Dialect().URI().DBType == schemas.MSSQL {
|
||||
if _, err := x.Exec(fmt.Sprintf("delete from project_issue where id in (SELECT top %d id FROM project_issue WHERE issue_id = ? and project_id = ?)", r.Cnt-1), r.IssueID, r.ProjectID); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
var ids []int64
|
||||
if err := x.SQL("SELECT id FROM project_issue WHERE issue_id = ? and project_id = ? limit ?", r.IssueID, r.ProjectID, r.Cnt-1).Find(&ids); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := x.Table("project_issue").In("id", ids).Delete(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add unique index for project_issue table
|
||||
type ProjectIssue struct { //revive:disable-line:exported
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IssueID int64 `xorm:"INDEX unique(s)"`
|
||||
ProjectID int64 `xorm:"INDEX unique(s)"`
|
||||
}
|
||||
|
||||
return x.Sync(new(ProjectIssue))
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_23 //nolint
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
func Test_AddUniqueIndexForProjectIssue(t *testing.T) {
|
||||
type ProjectIssue struct { //revive:disable-line:exported
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IssueID int64 `xorm:"INDEX"`
|
||||
ProjectID int64 `xorm:"INDEX"`
|
||||
}
|
||||
|
||||
// Prepare and load the testing database
|
||||
x, deferable := base.PrepareTestEnv(t, 0, new(ProjectIssue))
|
||||
defer deferable()
|
||||
if x == nil || t.Failed() {
|
||||
return
|
||||
}
|
||||
|
||||
cnt, err := x.Table("project_issue").Where("project_id=1 AND issue_id=1").Count()
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 2, cnt)
|
||||
|
||||
assert.NoError(t, AddUniqueIndexForProjectIssue(x))
|
||||
|
||||
cnt, err = x.Table("project_issue").Where("project_id=1 AND issue_id=1").Count()
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, cnt)
|
||||
|
||||
tables, err := x.DBMetas()
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, len(tables))
|
||||
found := false
|
||||
for _, index := range tables[0].Indexes {
|
||||
if index.Type == schemas.UniqueType {
|
||||
found = true
|
||||
slices.Equal(index.Cols, []string{"project_id", "issue_id"})
|
||||
break
|
||||
}
|
||||
}
|
||||
assert.True(t, found)
|
||||
}
|
|
@ -2790,7 +2790,6 @@ settings=Nastavení správce
|
|||
|
||||
dashboard.new_version_hint=Gitea %s je nyní k dispozici, právě u vás běži %s. Podívej se na <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">blogu</a> pro více informací.
|
||||
dashboard.statistic=Souhrn
|
||||
dashboard.operations=Operace údržby
|
||||
dashboard.system_status=Status systému
|
||||
dashboard.operation_name=Název operace
|
||||
dashboard.operation_switch=Přepnout
|
||||
|
|
|
@ -2798,7 +2798,6 @@ settings=Administratoreinstellungen
|
|||
|
||||
dashboard.new_version_hint=Gitea %s ist jetzt verfügbar, deine derzeitige Version ist %s. Weitere Details findest du im <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">Blog</a>.
|
||||
dashboard.statistic=Übersicht
|
||||
dashboard.operations=Wartungsoperationen
|
||||
dashboard.system_status=System-Status
|
||||
dashboard.operation_name=Name der Operation
|
||||
dashboard.operation_switch=Wechseln
|
||||
|
|
|
@ -2687,7 +2687,6 @@ settings=Ρυθμίσεις Διαχειριστή
|
|||
|
||||
dashboard.new_version_hint=Το Gitea %s είναι διαθέσιμο, τώρα εκτελείτε το %s. Ανατρέξτε <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">στο blog</a> για περισσότερες λεπτομέρειες.
|
||||
dashboard.statistic=Περίληψη
|
||||
dashboard.operations=Λειτουργίες Συντήρησης
|
||||
dashboard.system_status=Κατάσταση Συστήματος
|
||||
dashboard.operation_name=Όνομα Λειτουργίας
|
||||
dashboard.operation_switch=Αλλαγή
|
||||
|
|
|
@ -2672,7 +2672,6 @@ settings=Configuración de Admin
|
|||
|
||||
dashboard.new_version_hint=Gitea %s ya está disponible, estás ejecutando %s. Revisa <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">el blog</a> para más detalles.
|
||||
dashboard.statistic=Resumen
|
||||
dashboard.operations=Operaciones de mantenimiento
|
||||
dashboard.system_status=Estado del sistema
|
||||
dashboard.operation_name=Nombre de la operación
|
||||
dashboard.operation_switch=Interruptor
|
||||
|
|
|
@ -2064,7 +2064,6 @@ last_page=واپسین
|
|||
total=مجموع: %d
|
||||
|
||||
dashboard.statistic=چکیده
|
||||
dashboard.operations=عملیاتهای نگهداری
|
||||
dashboard.system_status=وضعیت سامانه
|
||||
dashboard.operation_name=نام عملیات
|
||||
dashboard.operation_switch=تعویض
|
||||
|
|
|
@ -1407,7 +1407,6 @@ last_page=Viimeisin
|
|||
total=Yhteensä: %d
|
||||
|
||||
dashboard.statistic=Yhteenveto
|
||||
dashboard.operations=Huoltotoimet
|
||||
dashboard.system_status=Järjestelmän tila
|
||||
dashboard.operation_name=Toiminnon nimi
|
||||
dashboard.operation_switch=Vaihda
|
||||
|
|
|
@ -2712,7 +2712,6 @@ settings=Paramètres administrateur
|
|||
|
||||
dashboard.new_version_hint=Gitea %s est maintenant disponible, vous utilisez %s. Consultez <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">le blog</a> pour plus de détails.
|
||||
dashboard.statistic=Résumé
|
||||
dashboard.operations=Opérations de maintenance
|
||||
dashboard.system_status=État du système
|
||||
dashboard.operation_name=Nom de l'Opération
|
||||
dashboard.operation_switch=Basculer
|
||||
|
|
|
@ -1266,7 +1266,6 @@ last_page=Utolsó
|
|||
total=Összesen: %d
|
||||
|
||||
dashboard.statistic=Összefoglaló
|
||||
dashboard.operations=Karbantartási műveletek
|
||||
dashboard.system_status=Rendszer Állapota
|
||||
dashboard.operation_name=Művelet Neve
|
||||
dashboard.operation_switch=Váltás
|
||||
|
|
|
@ -2233,7 +2233,6 @@ last_page=Ultima
|
|||
total=Totale: %d
|
||||
|
||||
dashboard.statistic=Riepilogo
|
||||
dashboard.operations=Operazioni di manutenzione
|
||||
dashboard.system_status=Stato del sistema
|
||||
dashboard.operation_name=Nome Operazione
|
||||
dashboard.operation_switch=Cambia
|
||||
|
|
|
@ -2719,7 +2719,6 @@ settings=管理設定
|
|||
|
||||
dashboard.new_version_hint=Gitea %s が入手可能になりました。 現在実行しているのは %s です。 詳細は <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">ブログ</a> を確認してください。
|
||||
dashboard.statistic=サマリー
|
||||
dashboard.operations=メンテナンス操作
|
||||
dashboard.system_status=システム状況
|
||||
dashboard.operation_name=操作の名称
|
||||
dashboard.operation_switch=切り替え
|
||||
|
|
|
@ -2693,7 +2693,6 @@ settings=Administratora iestatījumi
|
|||
|
||||
dashboard.new_version_hint=Ir pieejama Gitea versija %s, pašreizējā versija %s. Papildus informācija par jauno versiju ir pieejama <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">mājas lapā</a>.
|
||||
dashboard.statistic=Kopsavilkums
|
||||
dashboard.operations=Uzturēšanas darbības
|
||||
dashboard.system_status=Sistēmas statuss
|
||||
dashboard.operation_name=Darbības nosaukums
|
||||
dashboard.operation_switch=Pārslēgt
|
||||
|
|
|
@ -2135,7 +2135,6 @@ last_page=Laatste
|
|||
total=Totaal: %d
|
||||
|
||||
dashboard.statistic=Overzicht
|
||||
dashboard.operations=Onderhoudswerkzaamheden
|
||||
dashboard.system_status=Systeemtatus
|
||||
dashboard.operation_name=Bewerking naam
|
||||
dashboard.operation_switch=Omschakelen
|
||||
|
|
|
@ -2010,7 +2010,6 @@ last_page=Ostatnia
|
|||
total=Ogółem: %d
|
||||
|
||||
dashboard.statistic=Podsumowanie
|
||||
dashboard.operations=Operacje konserwacji
|
||||
dashboard.system_status=Status strony
|
||||
dashboard.operation_name=Nazwa operacji
|
||||
dashboard.operation_switch=Przełącz
|
||||
|
|
|
@ -2648,7 +2648,6 @@ settings=Configurações de Administrador
|
|||
|
||||
dashboard.new_version_hint=Uma nova versão está disponível: %s. Versão atual: %s. Visite <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">o blog</a> para mais informações.
|
||||
dashboard.statistic=Resumo
|
||||
dashboard.operations=Operações de manutenção
|
||||
dashboard.system_status=Status do sistema
|
||||
dashboard.operation_name=Nome da operação
|
||||
dashboard.operation_switch=Trocar
|
||||
|
|
|
@ -2775,6 +2775,7 @@ teams.invite.by=Convidado(a) por %s
|
|||
teams.invite.description=Clique no botão abaixo para se juntar à equipa.
|
||||
|
||||
[admin]
|
||||
maintenance=Manutenção
|
||||
dashboard=Painel de controlo
|
||||
self_check=Auto-verificação
|
||||
identity_access=Identidade e acesso
|
||||
|
@ -2798,7 +2799,7 @@ settings=Configurações de administração
|
|||
|
||||
dashboard.new_version_hint=O Gitea %s está disponível, você está a correr a versão %s. Verifique o <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">blog</a> para mais detalhes.
|
||||
dashboard.statistic=Resumo
|
||||
dashboard.operations=Operações de manutenção
|
||||
dashboard.maintenance_operations=Operações de manutenção
|
||||
dashboard.system_status=Estado do sistema
|
||||
dashboard.operation_name=Nome da operação
|
||||
dashboard.operation_switch=Comutar
|
||||
|
@ -3305,6 +3306,7 @@ notices.op=Op.
|
|||
notices.delete_success=As notificações do sistema foram eliminadas.
|
||||
|
||||
self_check.no_problem_found=Nenhum problema encontrado até agora.
|
||||
self_check.startup_warnings=Alertas do arranque:
|
||||
self_check.database_collation_mismatch=Supor que a base de dados usa a colação: %s
|
||||
self_check.database_collation_case_insensitive=A base de dados está a usar a colação %s, que é insensível à diferença entre maiúsculas e minúsculas. Embora o Gitea possa trabalhar com ela, pode haver alguns casos raros que não funcionem como esperado.
|
||||
self_check.database_inconsistent_collation_columns=A base de dados está a usar a colação %s, mas estas colunas estão a usar colações diferentes. Isso poderá causar alguns problemas inesperados.
|
||||
|
|
|
@ -2634,7 +2634,6 @@ total=Всего: %d
|
|||
|
||||
dashboard.new_version_hint=Доступна новая версия Gitea %s, вы используете %s. Более подробную информацию читайте в <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">блоге</a>.
|
||||
dashboard.statistic=Статистика
|
||||
dashboard.operations=Операции
|
||||
dashboard.system_status=Состояние системы
|
||||
dashboard.operation_name=Имя операции
|
||||
dashboard.operation_switch=Переключить
|
||||
|
|
|
@ -2024,7 +2024,6 @@ last_page=පසුගිය
|
|||
total=මුළු: %d
|
||||
|
||||
dashboard.statistic=සාරාංශය
|
||||
dashboard.operations=නඩත්තු මෙහෙයුම්
|
||||
dashboard.system_status=පද්ධතියේ තත්වය
|
||||
dashboard.operation_name=මෙහෙයුමේ නම
|
||||
dashboard.operation_switch=මාරුවන්න
|
||||
|
|
|
@ -1647,7 +1647,6 @@ last_page=Sista
|
|||
total=Totalt: %d
|
||||
|
||||
dashboard.statistic=Översikt
|
||||
dashboard.operations=Operationer för underhåll
|
||||
dashboard.system_status=Status
|
||||
dashboard.operation_name=Operationsnamn
|
||||
dashboard.operation_switch=Byt till
|
||||
|
|
|
@ -2687,7 +2687,6 @@ settings=Yönetici Ayarları
|
|||
|
||||
dashboard.new_version_hint=Gitea %s şimdi hazır, %s çalıştırıyorsunuz. Ayrıntılar için <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">blog</a>'a bakabilirsiniz.
|
||||
dashboard.statistic=Özet
|
||||
dashboard.operations=Bakım İşlemleri
|
||||
dashboard.system_status=Sistem Durumu
|
||||
dashboard.operation_name=İşlem Adı
|
||||
dashboard.operation_switch=Geç
|
||||
|
|
|
@ -2074,7 +2074,6 @@ last_page=Остання
|
|||
total=Разом: %d
|
||||
|
||||
dashboard.statistic=Підсумок
|
||||
dashboard.operations=Технічне обслуговування
|
||||
dashboard.system_status=Статус системи
|
||||
dashboard.operation_name=Назва операції
|
||||
dashboard.operation_switch=Перемкнути
|
||||
|
|
|
@ -2711,7 +2711,6 @@ settings=管理设置
|
|||
|
||||
dashboard.new_version_hint=Gitea %s 现已可用,您正在运行 %s。查看 <a target="_blank" rel="noreferrer" href="https://blog.gitea.io">博客</a> 了解详情。
|
||||
dashboard.statistic=摘要
|
||||
dashboard.operations=维护操作
|
||||
dashboard.system_status=系统状态
|
||||
dashboard.operation_name=操作名称
|
||||
dashboard.operation_switch=开关
|
||||
|
|
|
@ -2439,7 +2439,6 @@ total=總計:%d
|
|||
|
||||
dashboard.new_version_hint=現已推出 Gitea %s,您正在執行 %s。詳情請參閱<a target="_blank" rel="noreferrer" href="https://blog.gitea.io">部落格</a>的說明。
|
||||
dashboard.statistic=摘要
|
||||
dashboard.operations=維護作業
|
||||
dashboard.system_status=系統狀態
|
||||
dashboard.operation_name=作業名稱
|
||||
dashboard.operation_switch=開關
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
{{template "base/alert" .}}
|
||||
<div class="navbar">
|
||||
<div class="issue-navbar">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div role="main" aria-label="{{.Title}}" class="page-content repository labels">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
<div class="navbar tw-mb-4">
|
||||
<div class="issue-navbar tw-mb-4">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}}
|
||||
<button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div role="main" aria-label="{{.Title}}" class="page-content repository new milestone">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
<div class="navbar">
|
||||
<div class="issue-navbar">
|
||||
{{template "repo/issue/navbar" .}}
|
||||
{{if and (or .CanWriteIssues .CanWritePulls) .PageIsEditMilestone}}
|
||||
<div class="ui right floated secondary menu">
|
||||
|
|
|
@ -140,3 +140,8 @@
|
|||
.secondary-nav {
|
||||
background: var(--color-secondary-nav-bg) !important; /* important because of .ui.secondary.menu */
|
||||
}
|
||||
|
||||
.issue-navbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue