From 4d5c803f8b71ccf3182d89584196783e2338e365 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 26 Apr 2023 07:31:50 +0200 Subject: [PATCH 01/81] Fix Monaco IOS keyboard button (#24341) Fix https://github.com/go-gitea/gitea/issues/16188. Turns out the element was completely misaligned by fomantic styles. Add most of the original styles in `!important` form to fix. Tapping the button doesn't do anything useful in Simulator.app, but I guess it's still better to not outright hide it in case it has a possiblity to work. image Co-authored-by: Giteabot --- web_src/css/features/codeeditor.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web_src/css/features/codeeditor.css b/web_src/css/features/codeeditor.css index f7e7777409..8666ad2f85 100644 --- a/web_src/css/features/codeeditor.css +++ b/web_src/css/features/codeeditor.css @@ -31,3 +31,18 @@ .monaco-scrollable-element > .scrollbar > .slider:active { background: var(--color-primary-dark-2) !important; } + +/* fomantic styles destroy this element only visible on IOS, restore it */ +.monaco-editor .iPadShowKeyboard { + border: none !important; + width: 58px !important; + min-width: 0 !important; + height: 36px !important; + min-height: 0 !important; + margin: 0 !important; + padding: 0 !important; + position: absolute !important; + resize: none !important; + overflow: hidden !important; + border-radius: 4px !important; +} From fb37eefa282543fd8ce63c361cd4cf0dfac9943c Mon Sep 17 00:00:00 2001 From: JakobDev Date: Wed, 26 Apr 2023 08:08:28 +0200 Subject: [PATCH 02/81] Add API for License templates (#23009) This adds a API for getting License templates. This tries to be as close to the [GitHub API](https://docs.github.com/en/rest/licenses?apiVersion=2022-11-28) as possible, but Gitea does not support all features that GitHub has. I think they should been added, but this out f the scope of this PR. You should merge #23006 before this PR for security reasons. --- modules/structs/miscellaneous.go | 16 +++ routers/api/v1/api.go | 2 + routers/api/v1/misc/licenses.go | 76 +++++++++++++ routers/api/v1/swagger/misc.go | 14 +++ templates/swagger/v1_json.tmpl | 107 ++++++++++++++++++ .../integration/api_license_templates_test.go | 55 +++++++++ 6 files changed, 270 insertions(+) create mode 100644 routers/api/v1/misc/licenses.go create mode 100644 tests/integration/api_license_templates_test.go diff --git a/modules/structs/miscellaneous.go b/modules/structs/miscellaneous.go index 8acea84d6c..53d10a9907 100644 --- a/modules/structs/miscellaneous.go +++ b/modules/structs/miscellaneous.go @@ -72,6 +72,22 @@ type ServerVersion struct { Version string `json:"version"` } +// LicensesListEntry is used for the API +type LicensesTemplateListEntry struct { + Key string `json:"key"` + Name string `json:"name"` + URL string `json:"url"` +} + +// LicensesInfo contains information about a License +type LicenseTemplateInfo struct { + Key string `json:"key"` + Name string `json:"name"` + URL string `json:"url"` + Implementation string `json:"implementation"` + Body string `json:"body"` +} + // APIError is an api error with a message type APIError struct { Message string `json:"message"` diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index ad68a33d6b..0af095b2bb 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -719,6 +719,8 @@ func Routes(ctx gocontext.Context) *web.Route { m.Post("/markup", bind(api.MarkupOption{}), misc.Markup) m.Post("/markdown", bind(api.MarkdownOption{}), misc.Markdown) m.Post("/markdown/raw", misc.MarkdownRaw) + m.Get("/licenses", misc.ListLicenseTemplates) + m.Get("/licenses/{name}", misc.GetLicenseTemplateInfo) m.Group("/settings", func() { m.Get("/ui", settings.GetGeneralUISettings) m.Get("/api", settings.GetGeneralAPISettings) diff --git a/routers/api/v1/misc/licenses.go b/routers/api/v1/misc/licenses.go new file mode 100644 index 0000000000..65f63468cf --- /dev/null +++ b/routers/api/v1/misc/licenses.go @@ -0,0 +1,76 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package misc + +import ( + "fmt" + "net/http" + "net/url" + + "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/options" + repo_module "code.gitea.io/gitea/modules/repository" + "code.gitea.io/gitea/modules/setting" + api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/util" +) + +// Returns a list of all License templates +func ListLicenseTemplates(ctx *context.APIContext) { + // swagger:operation GET /licenses miscellaneous listLicenseTemplates + // --- + // summary: Returns a list of all license templates + // produces: + // - application/json + // responses: + // "200": + // "$ref": "#/responses/LicenseTemplateList" + response := make([]api.LicensesTemplateListEntry, len(repo_module.Licenses)) + for i, license := range repo_module.Licenses { + response[i] = api.LicensesTemplateListEntry{ + Key: license, + Name: license, + URL: fmt.Sprintf("%sapi/v1/licenses/%s", setting.AppURL, url.PathEscape(license)), + } + } + ctx.JSON(http.StatusOK, response) +} + +// Returns information about a gitignore template +func GetLicenseTemplateInfo(ctx *context.APIContext) { + // swagger:operation GET /licenses/{name} miscellaneous getLicenseTemplateInfo + // --- + // summary: Returns information about a license template + // produces: + // - application/json + // parameters: + // - name: name + // in: path + // description: name of the license + // type: string + // required: true + // responses: + // "200": + // "$ref": "#/responses/LicenseTemplateInfo" + // "404": + // "$ref": "#/responses/notFound" + name := util.PathJoinRelX(ctx.Params("name")) + + text, err := options.License(name) + if err != nil { + ctx.NotFound() + return + } + + response := api.LicenseTemplateInfo{ + Key: name, + Name: name, + URL: fmt.Sprintf("%sapi/v1/licenses/%s", setting.AppURL, url.PathEscape(name)), + Body: string(text), + // This is for combatibilty with the GitHub API. This Text is for some reason added to each License response. + Implementation: "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file", + } + + ctx.JSON(http.StatusOK, response) +} diff --git a/routers/api/v1/swagger/misc.go b/routers/api/v1/swagger/misc.go index a4052a6a76..322bad0c1c 100644 --- a/routers/api/v1/swagger/misc.go +++ b/routers/api/v1/swagger/misc.go @@ -14,6 +14,20 @@ type swaggerResponseServerVersion struct { Body api.ServerVersion `json:"body"` } +// LicenseTemplateList +// swagger:response LicenseTemplateList +type swaggerResponseLicensesTemplateList struct { + // in:body + Body []api.LicensesTemplateListEntry `json:"body"` +} + +// LicenseTemplateInfo +// swagger:response LicenseTemplateInfo +type swaggerResponseLicenseTemplateInfo struct { + // in:body + Body api.LicenseTemplateInfo `json:"body"` +} + // StringSlice // swagger:response StringSlice type swaggerResponseStringSlice struct { diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index e3f87d703e..bc403be446 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -883,6 +883,52 @@ } } }, + "/licenses": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns a list of all license templates", + "operationId": "listLicenseTemplates", + "responses": { + "200": { + "$ref": "#/responses/LicenseTemplateList" + } + } + } + }, + "/licenses/{name}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "miscellaneous" + ], + "summary": "Returns information about a license template", + "operationId": "getLicenseTemplateInfo", + "parameters": [ + { + "type": "string", + "description": "name of the license", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/LicenseTemplateInfo" + }, + "404": { + "$ref": "#/responses/notFound" + } + } + } + }, "/markdown": { "post": { "consumes": [ @@ -18704,6 +18750,52 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "LicenseTemplateInfo": { + "description": "LicensesInfo contains information about a License", + "type": "object", + "properties": { + "body": { + "type": "string", + "x-go-name": "Body" + }, + "implementation": { + "type": "string", + "x-go-name": "Implementation" + }, + "key": { + "type": "string", + "x-go-name": "Key" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, + "LicensesTemplateListEntry": { + "description": "LicensesListEntry is used for the API", + "type": "object", + "properties": { + "key": { + "type": "string", + "x-go-name": "Key" + }, + "name": { + "type": "string", + "x-go-name": "Name" + }, + "url": { + "type": "string", + "x-go-name": "URL" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "MarkdownOption": { "description": "MarkdownOption markdown options", "type": "object", @@ -21587,6 +21679,21 @@ } } }, + "LicenseTemplateInfo": { + "description": "LicenseTemplateInfo", + "schema": { + "$ref": "#/definitions/LicenseTemplateInfo" + } + }, + "LicenseTemplateList": { + "description": "LicenseTemplateList", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/LicensesTemplateListEntry" + } + } + }, "MarkdownRender": { "description": "MarkdownRender is a rendered markdown document", "schema": { diff --git a/tests/integration/api_license_templates_test.go b/tests/integration/api_license_templates_test.go new file mode 100644 index 0000000000..e12aab7c2c --- /dev/null +++ b/tests/integration/api_license_templates_test.go @@ -0,0 +1,55 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package integration + +import ( + "fmt" + "net/http" + "net/url" + "testing" + + "code.gitea.io/gitea/modules/options" + repo_module "code.gitea.io/gitea/modules/repository" + api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestAPIListLicenseTemplates(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/api/v1/licenses") + resp := MakeRequest(t, req, http.StatusOK) + + // This tests if the API returns a list of strings + var licenseList []api.LicensesTemplateListEntry + DecodeJSON(t, resp, &licenseList) +} + +func TestAPIGetLicenseTemplateInfo(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + // If Gitea has for some reason no License templates, we need to skip this test + if len(repo_module.Licenses) == 0 { + return + } + + // Use the first template for the test + licenseName := repo_module.Licenses[0] + + urlStr := fmt.Sprintf("/api/v1/licenses/%s", url.PathEscape(licenseName)) + req := NewRequest(t, "GET", urlStr) + resp := MakeRequest(t, req, http.StatusOK) + + var licenseInfo api.LicenseTemplateInfo + DecodeJSON(t, resp, &licenseInfo) + + // We get the text of the template here + text, _ := options.License(licenseName) + + assert.Equal(t, licenseInfo.Key, licenseName) + assert.Equal(t, licenseInfo.Name, licenseName) + assert.Equal(t, licenseInfo.Body, string(text)) +} From eea23bbc8ebb7589b4291d23b37106a32d81a834 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Wed, 26 Apr 2023 09:52:50 +0300 Subject: [PATCH 03/81] Remove unnecessary helper function `DateFmtLong` (#24343) After #24317 this function is only used in one place where it is not needed. I confirmed the timestamp still renders correctly Signed-off-by: Yarden Shoham --- modules/templates/helper.go | 3 --- templates/admin/cron.tmpl | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index b7bef20560..a290d38979 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -141,9 +141,6 @@ func NewFuncMap() []template.FuncMap { "TimeSinceUnix": timeutil.TimeSinceUnix, "DateTime": timeutil.DateTime, "Sec2Time": util.SecToTime, - "DateFmtLong": func(t time.Time) string { - return t.Format(time.RFC3339) - }, "LoadTimes": func(startTime time.Time) string { return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms" }, diff --git a/templates/admin/cron.tmpl b/templates/admin/cron.tmpl index 267da00759..6ab37ca354 100644 --- a/templates/admin/cron.tmpl +++ b/templates/admin/cron.tmpl @@ -21,7 +21,7 @@ {{$.locale.Tr (printf "admin.dashboard.%s" .Name)}} {{.Spec}} - {{DateTime "full" (DateFmtLong .Next)}} + {{DateTime "full" .Next}} {{if gt .Prev.Year 1}}{{DateTime "full" .Prev}}{{else}}N/A{{end}} {{.ExecTimes}} {{if eq .Status ""}}—{{else if eq .Status "finished"}}{{svg "octicon-check" 16}}{{else}}{{svg "octicon-x" 16}}{{end}} From 62eafea3f9b57fa1cac419b4347f31578fc0deb7 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 26 Apr 2023 16:46:25 +0900 Subject: [PATCH 04/81] Add missed column title in runner management page (#24328) ![image](https://user-images.githubusercontent.com/18380374/234214706-315a8465-8931-4693-8015-e50279db53ab.png) --- templates/shared/actions/runner_list.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/shared/actions/runner_list.tmpl b/templates/shared/actions/runner_list.tmpl index 572bc5e34a..e738a581c3 100644 --- a/templates/shared/actions/runner_list.tmpl +++ b/templates/shared/actions/runner_list.tmpl @@ -52,7 +52,7 @@ {{.locale.Tr "actions.runners.owner_type"}} {{.locale.Tr "actions.runners.labels"}} {{.locale.Tr "actions.runners.last_online"}} - + {{.locale.Tr "edit"}} From 61d08f446a5677933465c39d19a28fb2ea056e13 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Wed, 26 Apr 2023 17:14:35 +0900 Subject: [PATCH 05/81] Fix wrong error info in RepoRefForAPI (#24344) Co-authored-by: Giteabot --- modules/context/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/context/api.go b/modules/context/api.go index f7a3384691..d405c9972b 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -337,7 +337,7 @@ func RepoRefForAPI(next http.Handler) http.Handler { if git.IsErrNotExist(err) { ctx.NotFound() } else { - ctx.Error(http.StatusInternalServerError, "GetBlobByPath", err) + ctx.Error(http.StatusInternalServerError, "GetCommit", err) } return } From c41bc4f1279c9e1e6e11d7b5fcfe7ef089fc7577 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Wed, 26 Apr 2023 16:46:26 +0200 Subject: [PATCH 06/81] Display when a repo was archived (#22664) This adds the date a repo is archived to Gitea and shows it in the UI and API. A feature, that GitHub has been [introduced recently](https://github.blog/changelog/2022-11-23-repository-archive-date-now-shown-in-ui/). I currently don't know how to correctly deal with the Date in the template, as different languages have different ways of writing a date. ![grafik](https://user-images.githubusercontent.com/15185051/234315187-7db5763e-d96e-4080-b894-9be178bfb6e1.png) --------- Co-authored-by: silverwind Co-authored-by: Lunny Xiao --- models/migrations/migrations.go | 2 ++ models/migrations/v1_20/v255.go | 23 +++++++++++++++++++++++ models/repo/archiver.go | 9 ++++++++- models/repo/repo.go | 5 +++-- modules/structs/repo.go | 1 + options/locale/locale_en-US.ini | 1 + services/convert/repository.go | 1 + templates/repo/diff/compare.tmpl | 6 +++++- templates/repo/empty.tmpl | 6 +++++- templates/repo/home.tmpl | 6 +++++- templates/swagger/v1_json.tmpl | 5 +++++ 11 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 models/migrations/v1_20/v255.go diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 9de5931d71..1f1f43796c 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -487,6 +487,8 @@ var migrations = []Migration{ NewMigration("Fix ExternalTracker and ExternalWiki accessMode in owner and admin team", v1_20.FixExternalTrackerAndExternalWikiAccessModeInOwnerAndAdminTeam), // v254 -> v255 NewMigration("Add ActionTaskOutput table", v1_20.AddActionTaskOutputTable), + // v255 -> v256 + NewMigration("Add ArchivedUnix Column", v1_20.AddArchivedUnixToRepository), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v1_20/v255.go b/models/migrations/v1_20/v255.go new file mode 100644 index 0000000000..14b70f8f96 --- /dev/null +++ b/models/migrations/v1_20/v255.go @@ -0,0 +1,23 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_20 //nolint + +import ( + "code.gitea.io/gitea/modules/timeutil" + + "xorm.io/xorm" +) + +func AddArchivedUnixToRepository(x *xorm.Engine) error { + type Repository struct { + ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT 0"` + } + + if err := x.Sync(new(Repository)); err != nil { + return err + } + + _, err := x.Exec("UPDATE repository SET archived_unix = updated_unix WHERE is_archived = ? AND archived_unix = 0", true) + return err +} diff --git a/models/repo/archiver.go b/models/repo/archiver.go index 11ecaff34c..70f53cfe15 100644 --- a/models/repo/archiver.go +++ b/models/repo/archiver.go @@ -146,6 +146,13 @@ func FindRepoArchives(opts FindRepoArchiversOption) ([]*RepoArchiver, error) { // SetArchiveRepoState sets if a repo is archived func SetArchiveRepoState(repo *Repository, isArchived bool) (err error) { repo.IsArchived = isArchived - _, err = db.GetEngine(db.DefaultContext).Where("id = ?", repo.ID).Cols("is_archived").NoAutoTime().Update(repo) + + if isArchived { + repo.ArchivedUnix = timeutil.TimeStampNow() + } else { + repo.ArchivedUnix = timeutil.TimeStamp(0) + } + + _, err = db.GetEngine(db.DefaultContext).ID(repo.ID).Cols("is_archived", "archived_unix").NoAutoTime().Update(repo) return err } diff --git a/models/repo/repo.go b/models/repo/repo.go index 266cbc288c..f9de6d493d 100644 --- a/models/repo/repo.go +++ b/models/repo/repo.go @@ -174,8 +174,9 @@ type Repository struct { // Avatar: ID(10-20)-md5(32) - must fit into 64 symbols Avatar string `xorm:"VARCHAR(64)"` - CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` - UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` + CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` + UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` + ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT 0"` } func init() { diff --git a/modules/structs/repo.go b/modules/structs/repo.go index 6d3e2c2909..259c230571 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -80,6 +80,7 @@ type Repository struct { Created time.Time `json:"created_at"` // swagger:strfmt date-time Updated time.Time `json:"updated_at"` + ArchivedAt time.Time `json:"archived_at"` Permissions *Permission `json:"permissions,omitempty"` HasIssues bool `json:"has_issues"` InternalTracker *InternalTracker `json:"internal_tracker,omitempty"` diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index ef9990d265..1fb68ff775 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -992,6 +992,7 @@ template.one_item = Must select at least one template item template.invalid = Must select a template repository archive.title = This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests. +archive.title_date = This repository has been archived on %s. You can view files and clone it, but cannot push or open issues/pull-requests. archive.issue.nocomment = This repo is archived. You cannot comment on issues. archive.pull.nocomment = This repo is archived. You cannot comment on pull requests. diff --git a/services/convert/repository.go b/services/convert/repository.go index a2a8570cc9..f470fd1656 100644 --- a/services/convert/repository.go +++ b/services/convert/repository.go @@ -183,6 +183,7 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, mode perm.Acc DefaultBranch: repo.DefaultBranch, Created: repo.CreatedUnix.AsTime(), Updated: repo.UpdatedUnix.AsTime(), + ArchivedAt: repo.ArchivedUnix.AsTime(), Permissions: permission, HasIssues: hasIssues, ExternalTracker: externalTracker, diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl index c7538a7969..3ec08b00ac 100644 --- a/templates/repo/diff/compare.tmpl +++ b/templates/repo/diff/compare.tmpl @@ -219,7 +219,11 @@ {{else if .Repository.IsArchived}}
- {{.locale.Tr "repo.archive.title"}} + {{if .Repository.ArchivedUnix.IsZero}} + {{.locale.Tr "repo.archive.title"}} + {{else}} + {{.locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix) | Safe}} + {{end}}
{{end}} {{if $.IsSigned}} diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index fbe61afeaa..ed726db512 100644 --- a/templates/repo/empty.tmpl +++ b/templates/repo/empty.tmpl @@ -7,7 +7,11 @@ {{template "base/alert" .}} {{if .Repository.IsArchived}}
- {{.locale.Tr "repo.archive.title"}} + {{if .Repository.ArchivedUnix.IsZero}} + {{.locale.Tr "repo.archive.title"}} + {{else}} + {{.locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix) | Safe}} + {{end}}
{{end}} {{if .Repository.IsBroken}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 69f7f03880..c47fa9d9ca 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -53,7 +53,11 @@ {{end}} {{if .Repository.IsArchived}}
- {{.locale.Tr "repo.archive.title"}} + {{if .Repository.ArchivedUnix.IsZero}} + {{.locale.Tr "repo.archive.title"}} + {{else}} + {{.locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix) | Safe}} + {{end}}
{{end}} {{template "repo/sub_menu" .}} diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index bc403be446..19b5179927 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -20221,6 +20221,11 @@ "type": "boolean", "x-go-name": "Archived" }, + "archived_at": { + "type": "string", + "format": "date-time", + "x-go-name": "ArchivedAt" + }, "avatar_url": { "type": "string", "x-go-name": "AvatarURL" From 58caf422e67c78f87327bc9b00f89083a2432940 Mon Sep 17 00:00:00 2001 From: contra-bit Date: Wed, 26 Apr 2023 17:22:54 +0200 Subject: [PATCH 07/81] Add .livemd as a markdown extension (#22730) ## Needs and benefits [Livebook](https://livebook.dev/) notebooks are used for code documentation and for deep dives and note-taking in the elixir ecosystem. Rendering these in these as Markdown on frogejo has many benefits, since livemd is a subset of markdown. Some of the benefits are: - New users of elixir and livebook are scared by unformated .livemd files, but are shown what they expect - Sharing a notebook is as easy as sharing a link, no need to install the software in order to see the results. [goldmark-meraid ](https://github.com/abhinav/goldmark-mermaid) is a mermaid-js parser already included in gitea. This makes the .livemd rendering integration feature complete. With this PR class diagrams, ER Diagrams, flow charts and much more will be rendered perfectly. With the additional functionality gitea will be an ideal tool for sharing resources with fellow software engineers working in the elixir ecosystem. Allowing the git forge to be used without needing to install any software. ## Feature Description This issue requests the .livemd extension to be added as a Markdown language extension. - `.livemd` is the extension of Livebook which is an Elixir version of Jupyter Notebook. - `.livemd` is` a subset of Markdown. This would require the .livemd to be recognized as a markdown file. The Goldmark the markdown parser should handle the parsing and rendering automatically. Here is the corresponding commit for GitHub linguist: https://github.com/github/linguist/pull/5672 Here is a sample page of a livemd file: https://github.com/github/linguist/blob/master/samples/Markdown/livebook.livemd ## Screenshots The first screenshot shows how github shows the sample .livemd in the browser. The second screenshot shows how mermaid js, renders my development notebook and its corresponding ER Diagram. The source code can be found here: https://codeberg.org/lgh/Termi/src/commit/79615f74281789a1f2967b57bad0c67c356cef1f/termiNotes.livemd ## Testing I just changed the file extension from `.livemd`to `.md`and the document already renders perfectly on codeberg. Check you can it out [here](https://codeberg.org/lgh/Termi/src/branch/livemd2md/termiNotes.md) --------- Co-authored-by: techknowlogick --- custom/conf/app.example.ini | 4 ++-- docs/content/doc/administration/config-cheat-sheet.en-us.md | 3 ++- modules/setting/markup.go | 2 +- modules/setting/repository.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 144691c00c..3687e0fbd4 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -992,7 +992,7 @@ ROUTER = console ;; ;; List of file extensions for which lines should be wrapped in the Monaco editor ;; Separate extensions with a comma. To line wrap files without an extension, just put a comma -;LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd, +;LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd,.livemd, ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1334,7 +1334,7 @@ ROUTER = console ;; ;; List of file extensions that should be rendered/edited as Markdown ;; Separate the extensions with a comma. To render files without any extension as markdown, just put a comma -;FILE_EXTENSIONS = .md,.markdown,.mdown,.mkd +;FILE_EXTENSIONS = .md,.markdown,.mdown,.mkd,.livemd ;; ;; Enables math inline and block detection ;ENABLE_MATH = true diff --git a/docs/content/doc/administration/config-cheat-sheet.en-us.md b/docs/content/doc/administration/config-cheat-sheet.en-us.md index 74110ea443..be97edadb5 100644 --- a/docs/content/doc/administration/config-cheat-sheet.en-us.md +++ b/docs/content/doc/administration/config-cheat-sheet.en-us.md @@ -117,7 +117,7 @@ In addition there is _`StaticRootPath`_ which can be set as a built-in at build ### Repository - Editor (`repository.editor`) -- `LINE_WRAP_EXTENSIONS`: **.txt,.md,.markdown,.mdown,.mkd,**: List of file extensions for which lines should be wrapped in the Monaco editor. Separate extensions with a comma. To line wrap files without an extension, just put a comma +- `LINE_WRAP_EXTENSIONS`: **.txt,.md,.markdown,.mdown,.mkd,.livemd,**: List of file extensions for which lines should be wrapped in the Monaco editor. Separate extensions with a comma. To line wrap files without an extension, just put a comma - `PREVIEWABLE_FILE_MODES`: **markdown**: Valid file modes that have a preview API associated with them, such as `api/v1/markdown`. Separate the values by commas. The preview tab in edit mode won't be displayed if the file extension doesn't match. ### Repository - Pull Request (`repository.pull-request`) @@ -277,6 +277,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a - `CUSTOM_URL_SCHEMES`: Use a comma separated list (ftp,git,svn) to indicate additional URL hyperlinks to be rendered in Markdown. URLs beginning in http and https are always displayed +- `FILE_EXTENSIONS`: **.md,.markdown,.mdown,.mkd,.livemd**: List of file extensions that should be rendered/edited as Markdown. Separate the extensions with a comma. To render files without any extension as markdown, just put a comma. - `ENABLE_MATH`: **true**: Enables detection of `\(...\)`, `\[...\]`, `$...$` and `$$...$$` blocks as math blocks. ## Server (`server`) diff --git a/modules/setting/markup.go b/modules/setting/markup.go index 969e30e888..6c2246342b 100644 --- a/modules/setting/markup.go +++ b/modules/setting/markup.go @@ -33,7 +33,7 @@ var Markdown = struct { }{ EnableHardLineBreakInComments: true, EnableHardLineBreakInDocuments: false, - FileExtensions: strings.Split(".md,.markdown,.mdown,.mkd", ","), + FileExtensions: strings.Split(".md,.markdown,.mdown,.mkd,.livemd", ","), EnableMath: true, } diff --git a/modules/setting/repository.go b/modules/setting/repository.go index bae3c658a4..20ed6d0dcd 100644 --- a/modules/setting/repository.go +++ b/modules/setting/repository.go @@ -168,7 +168,7 @@ var ( Editor: struct { LineWrapExtensions []string }{ - LineWrapExtensions: strings.Split(".txt,.md,.markdown,.mdown,.mkd,", ","), + LineWrapExtensions: strings.Split(".txt,.md,.markdown,.mdown,.mkd,.livemd,", ","), }, // Repository upload settings From f1a4330306a21a1b53aaa744ec5749a52135c807 Mon Sep 17 00:00:00 2001 From: Hester Gong Date: Wed, 26 Apr 2023 23:59:08 +0800 Subject: [PATCH 08/81] Modify width of ui container, fine tune css for settings pages and org header (#24315) Close #24302 Part of #24229, Follows #24246 This PR focused on CSS style fine-tune, main changes: 1. Give `.ui.ui.ui.container` a width of `1280px` with a max-width of `calc(100vw - 64px)`, so the main contents looks better on large devices. 2. Share styles for table elements in all levels settings pages to fix overflow of runners table on mobile and for consistency (The headers on mobile can be further improved, but haven't found a proper way yet). 3. Use [stackable grid](https://fomantic-ui.com/collections/grid.html#stackable) and [device column width](https://fomantic-ui.com/examples/responsive.html) for responsiveness for some pages (repo/org collaborators settings pages, org teams related page) 4. Fixed #24302 by sharing label related CSS in reporg.css 5. Fine tune repo tags settings page --------- Co-authored-by: wxiaoguang --- templates/admin/dashboard.tmpl | 24 ++--- templates/admin/notice.tmpl | 105 +++++++++----------- templates/org/settings/runners.tmpl | 6 +- templates/org/team/members.tmpl | 2 +- templates/org/team/repositories.tmpl | 2 +- templates/org/team/teams.tmpl | 2 +- templates/repo/actions/list.tmpl | 2 +- templates/repo/issue/labels/label_list.tmpl | 4 +- templates/repo/settings/collaboration.tmpl | 4 +- templates/repo/settings/deploy_keys.tmpl | 2 +- templates/repo/settings/tags.tmpl | 2 +- templates/user/settings/applications.tmpl | 2 +- templates/user/settings/keys_principal.tmpl | 2 +- templates/user/settings/keys_ssh.tmpl | 2 +- templates/user/settings/repos.tmpl | 2 +- web_src/css/admin.css | 50 +--------- web_src/css/base.css | 17 +++- web_src/css/helpers.css | 18 ++++ web_src/css/organization.css | 11 +- web_src/css/shared/repoorg.css | 6 ++ 20 files changed, 122 insertions(+), 143 deletions(-) diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index 93fcae4ca4..0aa95c0e73 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -19,55 +19,55 @@
{{.CsrfTokenHtml}}
- +
- + - + - + - + {{if and (not .SSH.Disabled) (not .SSH.StartBuiltinServer)}} - + - + {{end}} - + - + - + - + - +
{{.locale.Tr "admin.dashboard.delete_inactive_accounts"}}
{{.locale.Tr "admin.dashboard.delete_repo_archives"}}
{{.locale.Tr "admin.dashboard.delete_missing_repos"}}
{{.locale.Tr "admin.dashboard.git_gc_repos"}}
{{.locale.Tr "admin.dashboard.resync_all_sshkeys"}}
{{.locale.Tr "admin.dashboard.resync_all_sshkeys.desc"}}
{{.locale.Tr "admin.dashboard.resync_all_sshprincipals"}}
{{.locale.Tr "admin.dashboard.resync_all_sshprincipals.desc"}}
{{.locale.Tr "admin.dashboard.resync_all_hooks"}}
{{.locale.Tr "admin.dashboard.reinit_missing_repos"}}
{{.locale.Tr "admin.dashboard.sync_external_users"}}
{{.locale.Tr "admin.dashboard.repo_health_check"}}
{{.locale.Tr "admin.dashboard.delete_generated_repository_avatars"}}
diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl index bd6b74dd2b..3dbae04625 100644 --- a/templates/admin/notice.tmpl +++ b/templates/admin/notice.tmpl @@ -3,67 +3,60 @@

{{.locale.Tr "admin.notices.system_notice_list"}} ({{.locale.Tr "admin.total" .Total}})

-
- - +
+ + + + + + + + + + + + {{range .Notices}} - - - - - - + + + + + + - - - {{range .Notices}} + {{end}} + + {{if .Notices}} + - - - - - - - - {{end}} - - {{if .Notices}} - - - - + - - - {{end}} -
ID{{.locale.Tr "admin.notices.type"}}{{.locale.Tr "admin.notices.desc"}}{{.locale.Tr "admin.users.created"}}{{.locale.Tr "admin.notices.op"}}
ID{{.locale.Tr "admin.notices.type"}}{{.locale.Tr "admin.notices.desc"}}{{.locale.Tr "admin.users.created"}}{{.locale.Tr "admin.notices.op"}}
{{.ID}}{{$.locale.Tr .TrStr}}{{.Description}}{{DateTime "short" .CreatedUnix}}{{svg "octicon-note" 16}}
-
- -
-
{{.ID}}{{$.locale.Tr .TrStr}}{{.Description}}{{DateTime "short" .CreatedUnix}}{{svg "octicon-note" 16 "view-detail"}}
- - {{.CsrfTokenHtml}} - - - +
+ {{.CsrfTokenHtml}} + +
+
-
- +
+ + + + + {{end}} + {{template "base/paginate" .}} diff --git a/templates/org/settings/runners.tmpl b/templates/org/settings/runners.tmpl index 2350f68ba9..86cb1bcd78 100644 --- a/templates/org/settings/runners.tmpl +++ b/templates/org/settings/runners.tmpl @@ -1,5 +1,5 @@ {{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings runners")}} -
- {{template "shared/actions/runner_list" .}} -
+
+ {{template "shared/actions/runner_list" .}} +
{{template "org/settings/layout_footer" .}} diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index 5f520f24a1..b31f2a96c5 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -3,7 +3,7 @@ {{template "org/header" .}}
{{template "base/alert" .}} -
+
{{template "org/team/sidebar" .}}
{{template "org/team/navbar" .}} diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl index 86b4a212d1..c73f40f054 100644 --- a/templates/org/team/repositories.tmpl +++ b/templates/org/team/repositories.tmpl @@ -3,7 +3,7 @@ {{template "org/header" .}}
{{template "base/alert" .}} -
+
{{template "org/team/sidebar" .}}
{{template "org/team/navbar" .}} diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 9148a45e5a..dcf937f3f0 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -10,7 +10,7 @@
{{end}} -
+
{{range .Teams}}
diff --git a/templates/repo/actions/list.tmpl b/templates/repo/actions/list.tmpl index 15f0d607a3..0f44630201 100644 --- a/templates/repo/actions/list.tmpl +++ b/templates/repo/actions/list.tmpl @@ -3,7 +3,7 @@ {{template "repo/header" .}}
-
+
diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl index 081d0c474e..b1beda7c94 100644 --- a/templates/repo/settings/navbar.tmpl +++ b/templates/repo/settings/navbar.tmpl @@ -28,18 +28,23 @@ {{.locale.Tr "repo.settings.deploy_keys"}} - - {{.locale.Tr "secrets.secrets"}} - {{if .LFSStartServer}} {{.locale.Tr "repo.settings.lfs"}} {{end}} {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}} - - {{.locale.Tr "actions.runners"}} - + {{end}}
diff --git a/templates/repo/settings/runners.tmpl b/templates/repo/settings/runners.tmpl deleted file mode 100644 index ab3ad40400..0000000000 --- a/templates/repo/settings/runners.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings runners")}} -
- {{template "shared/actions/runner_list" .}} -
-{{template "repo/settings/layout_footer" .}} diff --git a/templates/shared/secrets/add_list.tmpl b/templates/shared/secrets/add_list.tmpl index e56ace8fc6..e743c16f95 100644 --- a/templates/shared/secrets/add_list.tmpl +++ b/templates/shared/secrets/add_list.tmpl @@ -1,5 +1,5 @@

- {{.locale.Tr "secrets.secrets"}} + {{.locale.Tr "secrets.management"}}
diff --git a/templates/user/settings/secrets.tmpl b/templates/user/settings/actions.tmpl similarity index 73% rename from templates/user/settings/secrets.tmpl rename to templates/user/settings/actions.tmpl index a831453f2a..4d56523587 100644 --- a/templates/user/settings/secrets.tmpl +++ b/templates/user/settings/actions.tmpl @@ -1,6 +1,8 @@ -{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings secrets")}} +{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings actions")}}
+ {{if eq .PageType "secrets"}} {{template "shared/secrets/add_list" .}} + {{end}}
{{template "user/settings/layout_footer" .}} diff --git a/templates/user/settings/navbar.tmpl b/templates/user/settings/navbar.tmpl index 27ec73c34f..b79308419b 100644 --- a/templates/user/settings/navbar.tmpl +++ b/templates/user/settings/navbar.tmpl @@ -19,9 +19,16 @@ {{.locale.Tr "settings.ssh_gpg_keys"}} - - {{.locale.Tr "secrets.secrets"}} - + {{if .EnableActions}} +
+ {{.locale.Tr "actions.actions"}} + +
+ {{end}} {{if .EnablePackages}} {{.locale.Tr "packages.title"}} diff --git a/web_src/css/base.css b/web_src/css/base.css index dc7942e8a2..c7ea0e47c8 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -830,6 +830,21 @@ a.label, color: var(--color-text-light-3); } +/* sub menu of vertical menu */ +.ui.vertical.menu .item .menu .item { + color: var(--color-text-light-2); + text-indent: 16px; +} + +.ui.vertical.menu .item .menu .item:hover, +.ui.vertical.menu .item .menu a.item:hover { + color: var(--color-text-light-1); +} + +.ui.vertical.menu .item .menu .active.item { + color: var(--color-text); +} + /* slightly more contrast for filters on issue list */ .ui.ui.menu .dropdown.item.disabled { color: var(--color-text-light-2); diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 80e2e1cb8b..8b25775bb4 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -2444,7 +2444,7 @@ .settings.webhooks .list > .item:not(:first-child), .settings.githooks .list > .item:not(:first-child), -.settings.runners .list > .item:not(:first-child) { +.settings.actions .list > .item:not(:first-child) { padding: 0.25rem 1rem; margin: 12px -1rem -1rem; } From 83022013c83feb5488952baea3ef0be818dfce21 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 28 Apr 2023 09:48:41 +0800 Subject: [PATCH 23/81] Fix layouts of admin table / adapt repo / email test (#24370) Ref: https://github.com/go-gitea/gitea/pull/24315#pullrequestreview-1403034993 And fix the incorrect layout for "dasbboard", the "form" shouldn't follow `

`, so move it to inner. Diff with ignoring spaces: https://github.com/go-gitea/gitea/pull/24370/files?diff=unified&w=1 A known bug: the adapt/delete button doesn't work due to a historical messy logic, will fix it in next PR (#24374) ![image](https://user-images.githubusercontent.com/2114189/234754656-d160b098-b8d4-4783-962a-27d5c764863c.png) ![image](https://user-images.githubusercontent.com/2114189/234762327-3e77e2e4-a156-4498-8a8b-092e14cf9204.png) ![image](https://user-images.githubusercontent.com/2114189/234767811-74b7272c-e40c-4850-8e3c-499e3b53b827.png) ![image](https://user-images.githubusercontent.com/2114189/234761247-e6aad889-dcad-443c-948f-2d44df68725b.png) --- options/locale/locale_en-US.ini | 1 + templates/admin/config.tmpl | 18 +++-- templates/admin/dashboard.tmpl | 10 +-- templates/admin/repo/list.tmpl | 2 +- templates/admin/repo/unadopted.tmpl | 75 +++++++++---------- .../repo/settings/webhook/base_list.tmpl | 2 +- templates/user/settings/repos.tmpl | 12 +-- web_src/css/admin.css | 21 ++---- web_src/css/runner.css | 4 + web_src/css/user.css | 11 --- 10 files changed, 69 insertions(+), 87 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fb21ee2ec4..3fff13c5a2 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2959,6 +2959,7 @@ config.mailer_sendmail_timeout = Sendmail Timeout config.mailer_use_dummy = Dummy config.test_email_placeholder = Email (e.g. test@example.com) config.send_test_mail = Send Testing Email +config.send_test_mail_submit = Send config.test_mail_failed = Failed to send a testing email to "%s": %v config.test_mail_sent = A testing email has been sent to "%s". diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 136ad38f16..f0d0ad3643 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -238,16 +238,18 @@
{{.Mailer.SMTPPort}}
{{end}}
{{.locale.Tr "admin.config.mailer_user"}}
-
{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}

-
- {{.CsrfTokenHtml}} -
-
+
{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}
+
+
{{.locale.Tr "admin.config.send_test_mail"}}
+
+ + {{.CsrfTokenHtml}} +
-
- - + + + {{end}}
diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl index 0aa95c0e73..6784451376 100644 --- a/templates/admin/dashboard.tmpl +++ b/templates/admin/dashboard.tmpl @@ -16,9 +16,9 @@

{{.locale.Tr "admin.dashboard.operations"}}

-
- {{.CsrfTokenHtml}} -
+
+ + {{.CsrfTokenHtml}} @@ -71,8 +71,8 @@
-
- + +

{{.locale.Tr "admin.dashboard.system_status"}} diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl index 3d09f2de23..515ec78a34 100644 --- a/templates/admin/repo/list.tmpl +++ b/templates/admin/repo/list.tmpl @@ -1,4 +1,4 @@ -{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}} +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin")}}

{{.locale.Tr "admin.repos.repo_manage_panel"}} ({{.locale.Tr "admin.total" .Total}}) diff --git a/templates/admin/repo/unadopted.tmpl b/templates/admin/repo/unadopted.tmpl index 3e47447178..27898a1854 100644 --- a/templates/admin/repo/unadopted.tmpl +++ b/templates/admin/repo/unadopted.tmpl @@ -1,4 +1,4 @@ -{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}} +{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin")}}

{{.locale.Tr "admin.repos.unadopted"}} @@ -18,47 +18,44 @@ {{if .search}}
{{if .Dirs}} -
+
{{range $dirI, $dir := .Dirs}} -
-
- {{svg "octicon-file-directory-fill"}} - {{$dir}} -
- -

-
{{.Queue.Configuration | JsonPrettyPrint}}
+
{{JsonUtils.PrettyIndent .Queue.Configuration}}
diff --git a/templates/package/shared/cleanup_rules/list.tmpl b/templates/package/shared/cleanup_rules/list.tmpl index 09f95e4f4a..10a073eb55 100644 --- a/templates/package/shared/cleanup_rules/list.tmpl +++ b/templates/package/shared/cleanup_rules/list.tmpl @@ -22,9 +22,9 @@ {{.Type.Name}}
{{if .Enabled}}{{$.locale.Tr "enabled"}}{{else}}{{$.locale.Tr "disabled"}}{{end}}
{{if .KeepCount}}
{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count"}}: {{if eq .KeepCount 1}}{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count.1"}}{{else}}{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.count.n" .KeepCount}}{{end}}
{{end}} - {{if .KeepPattern}}
{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}: {{EllipsisString .KeepPattern 100}}
{{end}} + {{if .KeepPattern}}
{{$.locale.Tr "packages.owner.settings.cleanuprules.keep.pattern"}}: {{StringUtils.EllipsisString .KeepPattern 100}}
{{end}} {{if .RemoveDays}}
{{$.locale.Tr "packages.owner.settings.cleanuprules.remove.days"}}: {{$.locale.Tr "tool.days" .RemoveDays}}
{{end}} - {{if .RemovePattern}}
{{$.locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}: {{EllipsisString .RemovePattern 100}}
{{end}} + {{if .RemovePattern}}
{{$.locale.Tr "packages.owner.settings.cleanuprules.remove.pattern"}}: {{StringUtils.EllipsisString .RemovePattern 100}}
{{end}}

{{else}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index c47fa9d9ca..de7c3a1dd0 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -68,7 +68,13 @@ {{$l := Eval $n "-" 1}} {{if and (eq $n 0) .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} - {{svg "octicon-git-pull-request"}} @@ -103,7 +109,17 @@ {{end}} {{if ne $n 0}} - {{EllipsisString .Repository.Name 30}}{{range $i, $v := .TreeNames}}/{{if eq $i $l}}{{EllipsisString $v 30}}{{else}}{{$p := index $.Paths $i}}{{EllipsisString $v 30}}{{end}}{{end}} + + {{StringUtils.EllipsisString .Repository.Name 30}} + {{- range $i, $v := .TreeNames -}} + / + {{- if eq $i $l -}} + {{StringUtils.EllipsisString $v 30}} + {{- else -}} + {{$p := index $.Paths $i}}{{StringUtils.EllipsisString $v 30}} + {{- end -}} + {{- end -}} + {{end}}
diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index d00a4813d2..d673e89a39 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -13,7 +13,7 @@
{{if .PageIsComparePull}} -
{{.locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}
+
{{.locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}
{{end}}
{{if .Fields}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index b99e49a586..464f41be1a 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -304,10 +304,12 @@ {{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}} {{template "shared/user/authorlink" .Poster}} - {{$parsedDeadline := .Content | ParseDeadline}} - {{$from := DateTime "long" (index $parsedDeadline 1)}} - {{$to := DateTime "long" (index $parsedDeadline 0)}} - {{$.locale.Tr "repo.issues.due_date_modified" $to $from $createdStr | Safe}} + {{$parsedDeadline := StringUtils.Split .Content "|"}} + {{if eq (len $parsedDeadline) 2}} + {{$from := DateTime "long" (index $parsedDeadline 1)}} + {{$to := DateTime "long" (index $parsedDeadline 0)}} + {{$.locale.Tr "repo.issues.due_date_modified" $to $from $createdStr | Safe}} + {{end}}
{{else if eq .Type 18}} diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index fe8a6cfc55..2d34613dde 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -20,7 +20,7 @@ {{.tag_name}}@{{.tag_target}} {{else}} - +
@
- +

{{.locale.Tr "actions.runners.custom_labels_helper"}}

diff --git a/templates/user/heatmap.tmpl b/templates/user/heatmap.tmpl index 5d42a5435b..b0ee0eeaac 100644 --- a/templates/user/heatmap.tmpl +++ b/templates/user/heatmap.tmpl @@ -1,6 +1,6 @@ {{if .HeatmapData}}
Date: Sat, 29 Apr 2023 05:34:14 -0700 Subject: [PATCH 41/81] Add ability to specify '--not' from GetAllCommits (#24409) For my specific use case, I'd like to get all commits that are on one branch but NOT on the other branch. For instance, I'd like to get all the commits on `Branch1` that are not also on `master` (I.e. all commits that were made after `Branch1` was created). This PR adds a `not` query param that gets passed down to the `git log` command to allow the user to exclude items from `GetAllCommits`. See [git documentation](https://git-scm.com/docs/git-log#Documentation/git-log.txt---not) --------- Co-authored-by: Giteabot --- modules/git/commit.go | 4 ++-- modules/git/repo_commit.go | 18 +++++++++++++----- routers/api/v1/repo/commits.go | 7 ++++++- routers/web/feed/branch.go | 2 +- routers/web/repo/commit.go | 2 +- templates/swagger/v1_json.tmpl | 6 ++++++ 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/modules/git/commit.go b/modules/git/commit.go index 610d27c68a..f28c315cb5 100644 --- a/modules/git/commit.go +++ b/modules/git/commit.go @@ -187,8 +187,8 @@ func (c *Commit) CommitsCount() (int64, error) { } // CommitsByRange returns the specific page commits before current revision, every page's number default by CommitsRangeSize -func (c *Commit) CommitsByRange(page, pageSize int) ([]*Commit, error) { - return c.repo.commitsByRange(c.ID, page, pageSize) +func (c *Commit) CommitsByRange(page, pageSize int, not string) ([]*Commit, error) { + return c.repo.commitsByRange(c.ID, page, pageSize, not) } // CommitsBefore returns all the commits before current revision diff --git a/modules/git/repo_commit.go b/modules/git/repo_commit.go index 153a116b06..30a82eb297 100644 --- a/modules/git/repo_commit.go +++ b/modules/git/repo_commit.go @@ -90,14 +90,22 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) { return commits[0], nil } -func (repo *Repository) commitsByRange(id SHA1, page, pageSize int) ([]*Commit, error) { - stdout, _, err := NewCommand(repo.Ctx, "log"). - AddOptionFormat("--skip=%d", (page-1)*pageSize).AddOptionFormat("--max-count=%d", pageSize).AddArguments(prettyLogFormat). - AddDynamicArguments(id.String()). - RunStdBytes(&RunOpts{Dir: repo.Path}) +func (repo *Repository) commitsByRange(id SHA1, page, pageSize int, not string) ([]*Commit, error) { + cmd := NewCommand(repo.Ctx, "log"). + AddOptionFormat("--skip=%d", (page-1)*pageSize). + AddOptionFormat("--max-count=%d", pageSize). + AddArguments(prettyLogFormat). + AddDynamicArguments(id.String()) + + if not != "" { + cmd.AddOptionValues("--not", not) + } + + stdout, _, err := cmd.RunStdBytes(&RunOpts{Dir: repo.Path}) if err != nil { return nil, err } + return repo.parsePrettyFormatLogToList(stdout) } diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go index 22b013e7dc..401403c83d 100644 --- a/routers/api/v1/repo/commits.go +++ b/routers/api/v1/repo/commits.go @@ -115,6 +115,10 @@ func GetAllCommits(ctx *context.APIContext) { // in: query // description: page size of results (ignored if used with 'path') // type: integer + // - name: not + // in: query + // description: commits that match the given specifier will not be listed. + // type: string // responses: // "200": // "$ref": "#/responses/CommitList" @@ -181,7 +185,8 @@ func GetAllCommits(ctx *context.APIContext) { } // Query commits - commits, err = baseCommit.CommitsByRange(listOptions.Page, listOptions.PageSize) + not := ctx.FormString("not") + commits, err = baseCommit.CommitsByRange(listOptions.Page, listOptions.PageSize, not) if err != nil { ctx.Error(http.StatusInternalServerError, "CommitsByRange", err) return diff --git a/routers/web/feed/branch.go b/routers/web/feed/branch.go index 22b6e2f14b..f13038ff9b 100644 --- a/routers/web/feed/branch.go +++ b/routers/web/feed/branch.go @@ -16,7 +16,7 @@ import ( // ShowBranchFeed shows tags and/or releases on the repo as RSS / Atom feed func ShowBranchFeed(ctx *context.Context, repo *repo.Repository, formatType string) { - commits, err := ctx.Repo.Commit.CommitsByRange(0, 10) + commits, err := ctx.Repo.Commit.CommitsByRange(0, 10, "") if err != nil { ctx.ServerError("ShowBranchFeed", err) return diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go index 7439c2411b..93294f8ddd 100644 --- a/routers/web/repo/commit.go +++ b/routers/web/repo/commit.go @@ -70,7 +70,7 @@ func Commits(ctx *context.Context) { } // Both `git log branchName` and `git log commitId` work. - commits, err := ctx.Repo.Commit.CommitsByRange(page, pageSize) + commits, err := ctx.Repo.Commit.CommitsByRange(page, pageSize, "") if err != nil { ctx.ServerError("CommitsByRange", err) return diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 2db950b57a..51d123866d 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -3803,6 +3803,12 @@ "description": "page size of results (ignored if used with 'path')", "name": "limit", "in": "query" + }, + { + "type": "string", + "description": "commits that match the given specifier will not be listed.", + "name": "not", + "in": "query" } ], "responses": { From 94d6b5b09d49b2622c2164a03cfae45dced96c74 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 29 Apr 2023 21:40:10 +0300 Subject: [PATCH 42/81] Add "Updated" column for admin repositories list (#24429) - Closes #12454 # Before ![image](https://user-images.githubusercontent.com/20454870/235314351-82f5a414-7827-4029-8779-a837283a5a05.png) # After ![image](https://user-images.githubusercontent.com/20454870/235314376-ccf4bb95-6823-4fce-9b9a-a23da2351769.png) Signed-off-by: Yarden Shoham --- templates/admin/repo/list.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl index 515ec78a34..f485784d0c 100644 --- a/templates/admin/repo/list.tmpl +++ b/templates/admin/repo/list.tmpl @@ -33,6 +33,7 @@ {{.locale.Tr "admin.repos.size"}} {{SortArrow "size" "reversesize" $.SortType false}} + {{.locale.Tr "admin.auths.updated"}} {{.locale.Tr "admin.users.created"}} {{.locale.Tr "admin.notices.op"}} @@ -80,6 +81,7 @@ {{.NumForks}} {{.NumIssues}} {{FileSize .Size}} + {{DateTime "short" .UpdatedUnix}} {{DateTime "short" .CreatedUnix}} {{svg "octicon-trash"}} From cc64a925602d54f3439dd19f16b5280bd0377a7a Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Sun, 30 Apr 2023 04:13:58 +0900 Subject: [PATCH 43/81] Add follow organization and fix the logic of following page (#24345) ![image](https://user-images.githubusercontent.com/18380374/234740589-066f2e5c-30c7-4fc3-a539-066100e1f138.png) ![image](https://user-images.githubusercontent.com/18380374/234740605-88efe55d-7eaa-422e-ab86-0b5a402ca11c.png) Maybe we can fix user card tmpl in #24319? Or maybe a list is better here ![image](https://user-images.githubusercontent.com/18380374/234451417-7f93df20-4b19-4abb-a62d-4c67e1aa2220.png) --------- Co-authored-by: silverwind Co-authored-by: Giteabot --- models/user/user.go | 18 ++++++++-------- routers/web/org/home.go | 7 +++++++ routers/web/user/profile.go | 41 +++++++++++++++++++------------------ templates/org/home.tmpl | 12 +++++++++++ templates/user/profile.tmpl | 2 +- 5 files changed, 51 insertions(+), 29 deletions(-) diff --git a/models/user/user.go b/models/user/user.go index 053d6680cd..46c4440e5f 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -346,7 +346,7 @@ func GetUserFollowing(ctx context.Context, u, viewer *User, listOptions db.ListO Select("`user`.*"). Join("LEFT", "follow", "`user`.id=follow.follow_id"). Where("follow.user_id=?", u.ID). - And("`user`.type=?", UserTypeIndividual). + And("`user`.type IN (?, ?)", UserTypeIndividual, UserTypeOrganization). And(isUserVisibleToViewerCond(viewer)) if listOptions.Page != 0 { @@ -1210,23 +1210,25 @@ func isUserVisibleToViewerCond(viewer *User) builder.Cond { return builder.Neq{ "`user`.visibility": structs.VisibleTypePrivate, }.Or( + // viewer's following builder.In("`user`.id", builder. Select("`follow`.user_id"). From("follow"). Where(builder.Eq{"`follow`.follow_id": viewer.ID})), - builder.In("`user`.id", - builder. - Select("`team_user`.uid"). - From("team_user"). - Join("INNER", "`team_user` AS t2", "`team_user`.id = `t2`.id"). - Where(builder.Eq{"`t2`.uid": viewer.ID})), + // viewer's org user builder.In("`user`.id", builder. Select("`team_user`.uid"). From("team_user"). Join("INNER", "`team_user` AS t2", "`team_user`.org_id = `t2`.org_id"). - Where(builder.Eq{"`t2`.uid": viewer.ID}))) + Where(builder.Eq{"`t2`.uid": viewer.ID})), + // viewer's org + builder.In("`user`.id", + builder. + Select("`team_user`.org_id"). + From("team_user"). + Where(builder.Eq{"`team_user`.uid": viewer.ID}))) } // IsUserVisibleToViewer check if viewer is able to see user profile diff --git a/routers/web/org/home.go b/routers/web/org/home.go index 201eefa614..7f38ec51ba 100644 --- a/routers/web/org/home.go +++ b/routers/web/org/home.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/organization" repo_model "code.gitea.io/gitea/models/repo" + user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/markup" @@ -143,6 +144,11 @@ func Home(ctx *context.Context) { return } + var isFollowing bool + if ctx.Doer != nil { + isFollowing = user_model.IsFollowing(ctx.Doer.ID, ctx.ContextUser.ID) + } + ctx.Data["Repos"] = repos ctx.Data["Total"] = count ctx.Data["MembersTotal"] = membersCount @@ -150,6 +156,7 @@ func Home(ctx *context.Context) { ctx.Data["Teams"] = ctx.Org.Teams ctx.Data["DisableNewPullMirrors"] = setting.Mirror.DisableNewPull ctx.Data["PageIsViewRepositories"] = true + ctx.Data["IsFollowing"] = isFollowing pager := context.NewPagination(int(count), setting.UI.User.RepoPagingNum, page, 5) pager.SetDefaultParams(ctx) diff --git a/routers/web/user/profile.go b/routers/web/user/profile.go index 367bb306b8..ef91d89d14 100644 --- a/routers/web/user/profile.go +++ b/routers/web/user/profile.go @@ -167,30 +167,31 @@ func Profile(ctx *context.Context) { language := ctx.FormTrim("language") ctx.Data["Language"] = language + followers, numFollowers, err := user_model.GetUserFollowers(ctx, ctx.ContextUser, ctx.Doer, db.ListOptions{ + PageSize: pagingNum, + Page: page, + }) + if err != nil { + ctx.ServerError("GetUserFollowers", err) + return + } + ctx.Data["NumFollowers"] = numFollowers + following, numFollowing, err := user_model.GetUserFollowing(ctx, ctx.ContextUser, ctx.Doer, db.ListOptions{ + PageSize: pagingNum, + Page: page, + }) + if err != nil { + ctx.ServerError("GetUserFollowing", err) + return + } + ctx.Data["NumFollowing"] = numFollowing + switch tab { case "followers": - items, count, err := user_model.GetUserFollowers(ctx, ctx.ContextUser, ctx.Doer, db.ListOptions{ - PageSize: pagingNum, - Page: page, - }) - if err != nil { - ctx.ServerError("GetUserFollowers", err) - return - } - ctx.Data["Cards"] = items - + ctx.Data["Cards"] = followers total = int(count) case "following": - items, count, err := user_model.GetUserFollowing(ctx, ctx.ContextUser, ctx.Doer, db.ListOptions{ - PageSize: pagingNum, - Page: page, - }) - if err != nil { - ctx.ServerError("GetUserFollowing", err) - return - } - ctx.Data["Cards"] = items - + ctx.Data["Cards"] = following total = int(count) case "activity": date := ctx.FormString("date") diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 1bd017d119..afd7d61ca9 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -19,6 +19,18 @@ {{if .Org.Website}}
{{svg "octicon-link"}} {{.Org.Website}}
{{end}}
+
{{template "org/menu" .}} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index c3a06a16ee..9f454a82f1 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -22,7 +22,7 @@ {{svg "octicon-rss" 18}} {{end}}
From a18919bba6e7f56572b782ce00285960accbde87 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Sat, 29 Apr 2023 21:43:01 +0200 Subject: [PATCH 44/81] Fix user-cards format (#24428) Fixes #24418 --- templates/repo/user_cards.tmpl | 2 +- templates/repo/watchers.tmpl | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/repo/user_cards.tmpl b/templates/repo/user_cards.tmpl index bc159f523a..fd9585b22d 100644 --- a/templates/repo/user_cards.tmpl +++ b/templates/repo/user_cards.tmpl @@ -1,4 +1,4 @@ -
+
{{if .CardsTitle}}

{{.CardsTitle}} diff --git a/templates/repo/watchers.tmpl b/templates/repo/watchers.tmpl index ebd8f0faad..1828544c8c 100644 --- a/templates/repo/watchers.tmpl +++ b/templates/repo/watchers.tmpl @@ -1,6 +1,8 @@ {{template "base/head" .}}
{{template "repo/header" .}} - {{template "repo/user_cards" .}} +
+ {{template "repo/user_cards" .}} +
{{template "base/footer" .}} From cc84c58aff30281d7f3cc6baca80e6983e35c859 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Sat, 29 Apr 2023 23:51:43 +0300 Subject: [PATCH 45/81] Remove unused setting `time.FORMAT` (#24430) It's loaded and then never used. --------- Co-authored-by: Giteabot --- custom/conf/app.example.ini | 5 --- .../config-cheat-sheet.en-us.md | 1 - modules/setting/time.go | 39 +------------------ modules/timeutil/language.go | 33 ---------------- 4 files changed, 2 insertions(+), 76 deletions(-) delete mode 100644 modules/timeutil/language.go diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 3687e0fbd4..f22d555704 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -1899,11 +1899,6 @@ ROUTER = console ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -;; Specifies the format for fully outputted dates. Defaults to RFC1123 -;; Special supported values are ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro and StampNano -;; For more information about the format see http://golang.org/pkg/time/#pkg-constants -;FORMAT = -;; ;; Location the UI time display i.e. Asia/Shanghai ;; Empty means server's location setting ;DEFAULT_UI_LOCATION = diff --git a/docs/content/doc/administration/config-cheat-sheet.en-us.md b/docs/content/doc/administration/config-cheat-sheet.en-us.md index 03cd93f91e..f637b1ebd8 100644 --- a/docs/content/doc/administration/config-cheat-sheet.en-us.md +++ b/docs/content/doc/administration/config-cheat-sheet.en-us.md @@ -1207,7 +1207,6 @@ in this mapping or the filetype using heuristics. ## Time (`time`) -- `FORMAT`: Time format to display on UI. i.e. RFC1123 or 2006-01-02 15:04:05 - `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Asia/Shanghai ## Task (`task`) diff --git a/modules/setting/time.go b/modules/setting/time.go index 5fd0fdb92f..6d2aa80f5b 100644 --- a/modules/setting/time.go +++ b/modules/setting/time.go @@ -9,45 +9,10 @@ import ( "code.gitea.io/gitea/modules/log" ) -var ( - // Time settings - TimeFormat string - // UILocation is the location on the UI, so that we can display the time on UI. - DefaultUILocation = time.Local -) +// DefaultUILocation is the location on the UI, so that we can display the time on UI. +var DefaultUILocation = time.Local func loadTimeFrom(rootCfg ConfigProvider) { - timeFormatKey := rootCfg.Section("time").Key("FORMAT").MustString("") - if timeFormatKey != "" { - TimeFormat = map[string]string{ - "ANSIC": time.ANSIC, - "UnixDate": time.UnixDate, - "RubyDate": time.RubyDate, - "RFC822": time.RFC822, - "RFC822Z": time.RFC822Z, - "RFC850": time.RFC850, - "RFC1123": time.RFC1123, - "RFC1123Z": time.RFC1123Z, - "RFC3339": time.RFC3339, - "RFC3339Nano": time.RFC3339Nano, - "Kitchen": time.Kitchen, - "Stamp": time.Stamp, - "StampMilli": time.StampMilli, - "StampMicro": time.StampMicro, - "StampNano": time.StampNano, - }[timeFormatKey] - // When the TimeFormatKey does not exist in the previous map e.g.'2006-01-02 15:04:05' - if len(TimeFormat) == 0 { - TimeFormat = timeFormatKey - TestTimeFormat, _ := time.Parse(TimeFormat, TimeFormat) - if TestTimeFormat.Format(time.RFC3339) != "2006-01-02T15:04:05Z" { - log.Warn("Provided TimeFormat: %s does not create a fully specified date and time.", TimeFormat) - log.Warn("In order to display dates and times correctly please check your time format has 2006, 01, 02, 15, 04 and 05") - } - log.Trace("Custom TimeFormat: %s", TimeFormat) - } - } - zone := rootCfg.Section("time").Key("DEFAULT_UI_LOCATION").String() if zone != "" { var err error diff --git a/modules/timeutil/language.go b/modules/timeutil/language.go deleted file mode 100644 index c2f7a0e579..0000000000 --- a/modules/timeutil/language.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2019 The Gitea Authors. All rights reserved. -// SPDX-License-Identifier: MIT - -package timeutil - -import ( - "time" - - "code.gitea.io/gitea/modules/setting" -) - -var langTimeFormats = map[string]string{ - "zh-CN": "2006年01月02日 15时04分05秒", - "en-US": time.RFC1123, - "lv-LV": "02.01.2006. 15:04:05", -} - -// GetLangTimeFormat represents the default time format for the language -func GetLangTimeFormat(lang string) string { - return langTimeFormats[lang] -} - -// GetTimeFormat represents the -func GetTimeFormat(lang string) string { - if setting.TimeFormat == "" { - format := GetLangTimeFormat(lang) - if format == "" { - format = time.RFC1123 - } - return format - } - return setting.TimeFormat -} From 0f52beb6b7e9fcb755cad64a60682ea76cfa2c9e Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Sun, 30 Apr 2023 00:25:54 +0000 Subject: [PATCH 46/81] [skip ci] Updated translations via Crowdin --- options/locale/locale_ja-JP.ini | 8 ++++++++ options/locale/locale_pt-PT.ini | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index a52641f7b2..b5f434e1c9 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -1606,7 +1606,10 @@ pulls.tab_files=変更されたファイル pulls.reopen_to_merge=このプルリクエストをマージする場合は再オープンしてください。 pulls.cant_reopen_deleted_branch=このプルリクエストはブランチが削除されているため、再オープンできません。 pulls.merged=マージ済み +pulls.merged_success=プルリクエストは正常にマージ、クローズされました +pulls.closed=プルリクエストはクローズされました pulls.manually_merged=手動マージ済み +pulls.merged_info_text=ブランチ %s を削除できるようになりました。 pulls.is_closed=プルリクエストはクローズされています。 pulls.title_wip_desc=`誤ってマージされないようにするには、タイトルの頭に %s を付けます。` pulls.cannot_merge_work_in_progress=このプルリクエストは作業中(WIP)としてマーキングされています。 @@ -2426,6 +2429,7 @@ team_unit_desc=リポジトリのセクションへのアクセスを許可 team_unit_disabled=(無効) form.name_reserved=組織名 "%s" は予約されています。 +form.name_pattern_not_allowed=`"%s" の形式は組織名に使用できません。` form.create_org_not_allowed=組織を作成する権限がありません。 settings=設定 @@ -3392,8 +3396,12 @@ runs.closed_tab=%d クローズ runs.commit=コミット runs.pushed_by=Pushed by runs.invalid_workflow_helper=ワークフロー設定ファイルは無効です。あなたの設定ファイルを確認してください: %s +runs.no_matching_runner_helper=一致するランナーがありません: %s need_approval_desc=フォークプルリクエストのワークフローを実行するには承認が必要です。 [projects] +type-1.display_name=個人プロジェクト +type-2.display_name=リポジトリ プロジェクト +type-3.display_name=組織プロジェクト diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index c72fa11526..df12f24849 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -1833,7 +1833,7 @@ activity.new_issues_count_n=questões novas activity.new_issue_label=Em aberto activity.title.unresolved_conv_1=%d diálogo não concluído activity.title.unresolved_conv_n=%d diálogos não concluídos -activity.unresolved_conv_desc=Estas questões e estes pedidos de integração que foram modificados recentemente ainda não foram concluídos. +activity.unresolved_conv_desc=Estas questões e estes pedidos de integração, que foram modificados recentemente, ainda não foram concluídos. activity.unresolved_conv_label=Em aberto activity.title.releases_1=%d lançamento activity.title.releases_n=%d Lançamentos From 8f4dafcd4e6b0b5d307c3e060ffe908c2a96f047 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 30 Apr 2023 05:33:25 +0200 Subject: [PATCH 47/81] Rework header bar on issue, pull requests and milestone (#24420) - Make search bar dynamic full width via flexbox - Make all buttons `small` so font size is the same for all elements in the header - Remove primary color from search field, add SVG icon like on Code tab - Fix button vertical padding being enlarged by SVG icons [View diff without whitespace](https://github.com/go-gitea/gitea/pull/24420/files?diff=unified&w=1) Screenshot 2023-04-29 at 11 58 53 Screenshot 2023-04-29 at 11 59 39 Mobile: Screenshot 2023-04-29 at 11 59 52 Screenshot 2023-04-29 at 12 00 00 --- templates/projects/list.tmpl | 4 +- templates/projects/new.tmpl | 2 +- templates/projects/view.tmpl | 2 +- templates/repo/actions/openclose.tmpl | 2 +- templates/repo/home.tmpl | 4 +- templates/repo/issue/list.tmpl | 28 +++--- templates/repo/issue/milestones.tmpl | 70 +++++++-------- templates/repo/issue/navbar.tmpl | 2 +- templates/repo/issue/openclose.tmpl | 2 +- templates/repo/issue/search.tmpl | 8 +- templates/repo/projects/list.tmpl | 4 +- templates/repo/projects/new.tmpl | 2 +- templates/repo/projects/view.tmpl | 4 +- templates/repo/sub_menu_release_tag.tmpl | 2 +- templates/user/dashboard/issues.tmpl | 90 +++++++++---------- templates/user/dashboard/milestones.tmpl | 72 +++++++-------- .../notification_subscriptions.tmpl | 2 +- tests/integration/pull_compare_test.go | 2 +- web_src/css/base.css | 19 ++++ web_src/css/index.css | 1 + web_src/css/repository.css | 14 +-- web_src/css/repository/list-header.css | 36 ++++++++ 22 files changed, 197 insertions(+), 175 deletions(-) create mode 100644 web_src/css/repository/list-header.css diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index ac4b34a960..1ef0b0be97 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -3,14 +3,14 @@ {{if .CanWriteProjects}}
{{end}} {{template "base/alert" .}} -

From 1bd277223571c12dc57dd86e50d14f81a273b9cc Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 1 May 2023 11:35:02 +0200 Subject: [PATCH 61/81] Replace remaining fontawesome dropdown icons with SVG (#24455) - Replace leftover dropdown triangles with SVG - Replace remove icon with SVG and add styling for it: Screenshot 2023-05-01 at 00 40 05 Screenshot 2023-05-01 at 00 46 56 --- templates/package/settings.tmpl | 2 +- templates/repo/graph.tmpl | 1 - templates/repo/issue/fields/dropdown.tmpl | 3 ++- web_src/css/base.css | 18 ++++++++++++++++++ web_src/css/features/gitgraph.css | 4 ---- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/templates/package/settings.tmpl b/templates/package/settings.tmpl index a443a8d27f..7beb3da062 100644 --- a/templates/package/settings.tmpl +++ b/templates/package/settings.tmpl @@ -20,7 +20,7 @@ {{$repoID = .PackageDescriptor.Repository.ID}} {{end}} - + {{svg "octicon-triangle-down" 14 "dropdown icon"}}
{{.locale.Tr "packages.settings.link.select"}}