mirror of https://github.com/go-gitea/gitea.git
Merge branch 'main' into fix/interpolate_runs_on_with_vars
This commit is contained in:
commit
1170e6eef2
|
@ -270,7 +270,7 @@ func CountRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
|
||||||
// Only affect action runners were a owner ID is set, as actions runners
|
// Only affect action runners were a owner ID is set, as actions runners
|
||||||
// could also be created on a repository.
|
// could also be created on a repository.
|
||||||
return db.GetEngine(ctx).Table("action_runner").
|
return db.GetEngine(ctx).Table("action_runner").
|
||||||
Join("LEFT", "user", "`action_runner`.owner_id = `user`.id").
|
Join("LEFT", "`user`", "`action_runner`.owner_id = `user`.id").
|
||||||
Where("`action_runner`.owner_id != ?", 0).
|
Where("`action_runner`.owner_id != ?", 0).
|
||||||
And(builder.IsNull{"`user`.id"}).
|
And(builder.IsNull{"`user`.id"}).
|
||||||
Count(new(ActionRunner))
|
Count(new(ActionRunner))
|
||||||
|
@ -279,7 +279,7 @@ func CountRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
|
||||||
func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
|
func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
|
||||||
subQuery := builder.Select("`action_runner`.id").
|
subQuery := builder.Select("`action_runner`.id").
|
||||||
From("`action_runner`").
|
From("`action_runner`").
|
||||||
Join("LEFT", "user", "`action_runner`.owner_id = `user`.id").
|
Join("LEFT", "`user`", "`action_runner`.owner_id = `user`.id").
|
||||||
Where(builder.Neq{"`action_runner`.owner_id": 0}).
|
Where(builder.Neq{"`action_runner`.owner_id": 0}).
|
||||||
And(builder.IsNull{"`user`.id"})
|
And(builder.IsNull{"`user`.id"})
|
||||||
b := builder.Delete(builder.In("id", subQuery)).From("`action_runner`")
|
b := builder.Delete(builder.In("id", subQuery)).From("`action_runner`")
|
||||||
|
@ -289,3 +289,25 @@ func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
|
||||||
}
|
}
|
||||||
return res.RowsAffected()
|
return res.RowsAffected()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CountRunnersWithoutBelongingRepo(ctx context.Context) (int64, error) {
|
||||||
|
return db.GetEngine(ctx).Table("action_runner").
|
||||||
|
Join("LEFT", "`repository`", "`action_runner`.repo_id = `repository`.id").
|
||||||
|
Where("`action_runner`.repo_id != ?", 0).
|
||||||
|
And(builder.IsNull{"`repository`.id"}).
|
||||||
|
Count(new(ActionRunner))
|
||||||
|
}
|
||||||
|
|
||||||
|
func FixRunnersWithoutBelongingRepo(ctx context.Context) (int64, error) {
|
||||||
|
subQuery := builder.Select("`action_runner`.id").
|
||||||
|
From("`action_runner`").
|
||||||
|
Join("LEFT", "`repository`", "`action_runner`.repo_id = `repository`.id").
|
||||||
|
Where(builder.Neq{"`action_runner`.repo_id": 0}).
|
||||||
|
And(builder.IsNull{"`repository`.id"})
|
||||||
|
b := builder.Delete(builder.In("id", subQuery)).From("`action_runner`")
|
||||||
|
res, err := db.GetEngine(ctx).Exec(b)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return res.RowsAffected()
|
||||||
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
//////////////////// Application
|
|
||||||
|
|
||||||
func TestOAuth2Application_GenerateClientSecret(t *testing.T) {
|
func TestOAuth2Application_GenerateClientSecret(t *testing.T) {
|
||||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||||
app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})
|
app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})
|
||||||
|
|
|
@ -584,6 +584,8 @@ var migrations = []Migration{
|
||||||
NewMigration("Add missing field of commit status summary table", v1_23.AddCommitStatusSummary2),
|
NewMigration("Add missing field of commit status summary table", v1_23.AddCommitStatusSummary2),
|
||||||
// v297 -> v298
|
// v297 -> v298
|
||||||
NewMigration("Add everyone_access_mode for repo_unit", v1_23.AddRepoUnitEveryoneAccessMode),
|
NewMigration("Add everyone_access_mode for repo_unit", v1_23.AddRepoUnitEveryoneAccessMode),
|
||||||
|
// v298 -> v299
|
||||||
|
NewMigration("Drop wrongly created table o_auth2_application", v1_23.DropWronglyCreatedTable),
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCurrentDBVersion returns the current db version
|
// GetCurrentDBVersion returns the current db version
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
|
|
||||||
// AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true
|
// AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true
|
||||||
func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
|
func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
|
||||||
type OAuth2Application struct {
|
type oauth2Application struct {
|
||||||
|
ID int64
|
||||||
ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"`
|
ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"`
|
||||||
}
|
}
|
||||||
|
return x.Sync(new(oauth2Application))
|
||||||
return x.Sync(new(OAuth2Application))
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,12 @@ import (
|
||||||
|
|
||||||
func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
|
func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
|
||||||
// premigration
|
// premigration
|
||||||
type OAuth2Application struct {
|
type oauth2Application struct {
|
||||||
ID int64
|
ID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare and load the testing database
|
// Prepare and load the testing database
|
||||||
x, deferable := base.PrepareTestEnv(t, 0, new(OAuth2Application))
|
x, deferable := base.PrepareTestEnv(t, 0, new(oauth2Application))
|
||||||
defer deferable()
|
defer deferable()
|
||||||
if x == nil || t.Failed() {
|
if x == nil || t.Failed() {
|
||||||
return
|
return
|
||||||
|
@ -36,7 +36,7 @@ func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
got := []ExpectedOAuth2Application{}
|
got := []ExpectedOAuth2Application{}
|
||||||
if err := x.Table("o_auth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
|
if err := x.Table("oauth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package v1_23 //nolint
|
||||||
|
|
||||||
|
import "xorm.io/xorm"
|
||||||
|
|
||||||
|
func DropWronglyCreatedTable(x *xorm.Engine) error {
|
||||||
|
return x.DropTables("o_auth2_application")
|
||||||
|
}
|
|
@ -68,7 +68,7 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
|
||||||
searchOpt.Paginator = opts.Paginator
|
searchOpt.Paginator = opts.Paginator
|
||||||
|
|
||||||
switch opts.SortType {
|
switch opts.SortType {
|
||||||
case "":
|
case "", "latest":
|
||||||
searchOpt.SortBy = SortByCreatedDesc
|
searchOpt.SortBy = SortByCreatedDesc
|
||||||
case "oldest":
|
case "oldest":
|
||||||
searchOpt.SortBy = SortByCreatedAsc
|
searchOpt.SortBy = SortByCreatedAsc
|
||||||
|
@ -86,7 +86,7 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
|
||||||
searchOpt.SortBy = SortByDeadlineDesc
|
searchOpt.SortBy = SortByDeadlineDesc
|
||||||
case "priority", "priorityrepo", "project-column-sorting":
|
case "priority", "priorityrepo", "project-column-sorting":
|
||||||
// Unsupported sort type for search
|
// Unsupported sort type for search
|
||||||
searchOpt.SortBy = SortByUpdatedDesc
|
fallthrough
|
||||||
default:
|
default:
|
||||||
searchOpt.SortBy = SortByUpdatedDesc
|
searchOpt.SortBy = SortByUpdatedDesc
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
|
|
||||||
// CompareDiff compare two branches or commits
|
// CompareDiff compare two branches or commits
|
||||||
func CompareDiff(ctx *context.APIContext) {
|
func CompareDiff(ctx *context.APIContext) {
|
||||||
// swagger:operation GET /repos/{owner}/{repo}/compare/{basehead} Get commit comparison information
|
// swagger:operation GET /repos/{owner}/{repo}/compare/{basehead} repository repoCompareDiff
|
||||||
// ---
|
// ---
|
||||||
// summary: Get commit comparison information
|
// summary: Get commit comparison information
|
||||||
// produces:
|
// produces:
|
||||||
|
|
|
@ -152,6 +152,12 @@ func prepareDBConsistencyChecks() []consistencyCheck {
|
||||||
Fixer: actions_model.FixRunnersWithoutBelongingOwner,
|
Fixer: actions_model.FixRunnersWithoutBelongingOwner,
|
||||||
FixedMessage: "Removed",
|
FixedMessage: "Removed",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "Action Runners without existing repository",
|
||||||
|
Counter: actions_model.CountRunnersWithoutBelongingRepo,
|
||||||
|
Fixer: actions_model.FixRunnersWithoutBelongingRepo,
|
||||||
|
FixedMessage: "Removed",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "Topics with empty repository count",
|
Name: "Topics with empty repository count",
|
||||||
Counter: repo_model.CountOrphanedTopics,
|
Counter: repo_model.CountOrphanedTopics,
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
{{template "base/head" .ctxData}}
|
{{template "base/head" .ctxData}}
|
||||||
<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}">
|
<div role="main" aria-label="{{.ctxData.Title}}" class="page-content {{.pageClass}}">
|
||||||
<div class="ui container">
|
|
||||||
{{template "base/alert" .ctxData}}
|
|
||||||
</div>
|
|
||||||
<div class="ui container fluid padded flex-container">
|
<div class="ui container fluid padded flex-container">
|
||||||
{{template "admin/navbar" .ctxData}}
|
{{template "admin/navbar" .ctxData}}
|
||||||
<div class="flex-container-main">
|
<div class="flex-container-main">
|
||||||
|
{{template "base/alert" .ctxData}}
|
||||||
{{/* block: admin-setting-content */}}
|
{{/* block: admin-setting-content */}}
|
||||||
|
|
||||||
{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}}
|
{{if false}}{{/* to make html structure "likely" complete to prevent IDE warnings */}}
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
<div class="milestone-list">
|
<div class="milestone-list">
|
||||||
{{range .Projects}}
|
{{range .Projects}}
|
||||||
<li class="milestone-card">
|
<li class="milestone-card">
|
||||||
<h3 class="flex-text-block tw-m-0">
|
<h3 class="flex-text-block tw-m-0 tw-gap-3">
|
||||||
{{svg .IconName 16}}
|
{{svg .IconName 16}}
|
||||||
<a class="muted" href="{{.Link ctx}}">{{.Title}}</a>
|
<a class="muted tw-break-anywhere" href="{{.Link ctx}}">{{.Title}}</a>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="milestone-toolbar">
|
<div class="milestone-toolbar">
|
||||||
<div class="group">
|
<div class="group">
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}
|
{{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}
|
||||||
|
|
||||||
<div class="ui container">
|
<div class="ui container tw-max-w-full">
|
||||||
<div class="tw-flex tw-justify-between tw-items-center tw-mb-4">
|
<div class="tw-flex tw-justify-between tw-items-center tw-mb-4 tw-gap-3">
|
||||||
<h2 class="tw-mb-0">{{.Project.Title}}</h2>
|
<h2 class="tw-mb-0 tw-flex-1 tw-break-anywhere">{{.Project.Title}}</h2>
|
||||||
{{if $canWriteProject}}
|
{{if $canWriteProject}}
|
||||||
<div class="ui compact mini menu">
|
<div class="ui compact mini menu">
|
||||||
<a class="item" href="{{.Link}}/edit?redirect=project">
|
<a class="item" href="{{.Link}}/edit?redirect=project">
|
||||||
|
|
|
@ -5346,12 +5346,10 @@
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"Get",
|
"repository"
|
||||||
"commit",
|
|
||||||
"comparison"
|
|
||||||
],
|
],
|
||||||
"summary": "Get commit comparison information",
|
"summary": "Get commit comparison information",
|
||||||
"operationId": "information",
|
"operationId": "repoCompareDiff",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
<div role="main" aria-label="{{.Title}}" class="page-content dashboard feeds">
|
<div role="main" aria-label="{{.Title}}" class="page-content dashboard feeds">
|
||||||
{{template "user/dashboard/navbar" .}}
|
{{template "user/dashboard/navbar" .}}
|
||||||
{{template "base/alert" .}}
|
|
||||||
<div class="ui container flex-container">
|
<div class="ui container flex-container">
|
||||||
<div class="flex-container-main">
|
<div class="flex-container-main">
|
||||||
|
{{template "base/alert" .}}
|
||||||
{{template "user/heatmap" .}}
|
{{template "user/heatmap" .}}
|
||||||
{{template "user/dashboard/feeds" .}}
|
{{template "user/dashboard/feeds" .}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -495,12 +495,6 @@ img.ui.avatar,
|
||||||
margin-top: calc(var(--page-spacing) - 1rem);
|
margin-top: calc(var(--page-spacing) - 1rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add horizontal margin to elements that are outside top-level of .flex-container or .ui.container */
|
|
||||||
.page-content > .flash-message {
|
|
||||||
margin-left: var(--page-margin-x);
|
|
||||||
margin-right: var(--page-margin-x);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ui.form .fields.error .field textarea,
|
.ui.form .fields.error .field textarea,
|
||||||
.ui.form .fields.error .field select,
|
.ui.form .fields.error .field select,
|
||||||
.ui.form .fields.error .field input:not([type]),
|
.ui.form .fields.error .field input:not([type]),
|
||||||
|
|
Loading…
Reference in New Issue