From eefec9bcc719e663658002215a3b3ae2ef8d9a7d Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 11 Oct 2024 15:46:16 -0700 Subject: [PATCH 1/4] Fix some places which doesn't repsect org full name setting --- templates/admin/org/list.tmpl | 2 +- templates/base/head_script.tmpl | 1 + templates/user/dashboard/repolist.tmpl | 2 +- web_src/js/components/DashboardRepoList.vue | 5 +++-- web_src/js/types.ts | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl index 987ceab1e0f99..76cdf919cea13 100644 --- a/templates/admin/org/list.tmpl +++ b/templates/admin/org/list.tmpl @@ -52,7 +52,7 @@ {{.ID}} - {{.Name}} + {{if and DefaultShowFullName .FullName}}{{.FullName}}({{.Name}}){{else}}{{.Name}}{{end}} {{if .Visibility.IsPrivate}} {{svg "octicon-lock"}} {{end}} diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index 22e08e9c8f69c..0a443ab493adf 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -13,6 +13,7 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly assetUrlPrefix: '{{AssetUrlPrefix}}', runModeIsProd: {{.RunModeIsProd}}, + defaultShowFullName: {{DefaultShowFullName}}, customEmojis: {{CustomEmojis}}, csrfToken: '{{.CsrfToken}}', pageData: {{.PageData}}, diff --git a/templates/user/dashboard/repolist.tmpl b/templates/user/dashboard/repolist.tmpl index be710675d560a..a2764ba608442 100644 --- a/templates/user/dashboard/repolist.tmpl +++ b/templates/user/dashboard/repolist.tmpl @@ -45,7 +45,7 @@ data.teamId = {{.Team.ID}}; {{end}} {{if not .ContextUser.IsOrganization}} -data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}, 'org_visibility': {{.Visibility}}},{{end}}]; +data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'full_name': {{.FullName}}, 'num_repos': {{.NumRepos}}, 'org_visibility': {{.Visibility}}},{{end}}]; data.isOrganization = false; data.organizationsTotalCount = {{.UserOrgsCount}}; data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}}; diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index 986fcc11814e5..144e419baf10e 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -4,7 +4,7 @@ import $ from 'jquery'; import {SvgIcon} from '../svg.ts'; import {GET} from '../modules/fetch.ts'; -const {appSubUrl, assetUrlPrefix, pageData} = window.config; +const {appSubUrl, assetUrlPrefix, pageData, defaultShowFullName} = window.config; // make sure this matches templates/repo/commit_status.tmpl const commitStatus = { @@ -64,6 +64,7 @@ const sfc = { canCreateOrganization: false, organizationsTotalCount: 0, organizationId: 0, + defaultShowFullName, subUrl: appSubUrl, ...pageData.dashboardRepoList, @@ -471,7 +472,7 @@ export default sfc; // activate the IDE's Vue plugin
  • -
    {{ org.name }}
    +
    {{ defaultShowFullName && org.full_name ? org.full_name : org.name }}
    {{ org.org_visibility === 'limited' ? textOrgVisibilityLimited: textOrgVisibilityPrivate }} diff --git a/web_src/js/types.ts b/web_src/js/types.ts index f3ac305162b24..53d272e29e7df 100644 --- a/web_src/js/types.ts +++ b/web_src/js/types.ts @@ -12,6 +12,7 @@ export type Config = { assetVersionEncoded: string, assetUrlPrefix: string, runModeIsProd: boolean, + defaultShowFullName: boolean, customEmojis: Record, csrfToken: string, pageData: Record, From a60fce5aa8c6f96f44519a424409480c2babaf60 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 5 Nov 2024 22:38:16 -0800 Subject: [PATCH 2/4] follow wxiaoguang's suggestion --- web_src/js/components/DashboardRepoList.vue | 5 ++--- web_src/js/types.ts | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index 144e419baf10e..f2aa028001687 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -4,7 +4,7 @@ import $ from 'jquery'; import {SvgIcon} from '../svg.ts'; import {GET} from '../modules/fetch.ts'; -const {appSubUrl, assetUrlPrefix, pageData, defaultShowFullName} = window.config; +const {appSubUrl, assetUrlPrefix, pageData} = window.config; // make sure this matches templates/repo/commit_status.tmpl const commitStatus = { @@ -64,7 +64,6 @@ const sfc = { canCreateOrganization: false, organizationsTotalCount: 0, organizationId: 0, - defaultShowFullName, subUrl: appSubUrl, ...pageData.dashboardRepoList, @@ -472,7 +471,7 @@ export default sfc; // activate the IDE's Vue plugin
  • -
    {{ defaultShowFullName && org.full_name ? org.full_name : org.name }}
    +
    {{ org.full_name ? `${org.full_name} (${org.name})` : org.name }}
    {{ org.org_visibility === 'limited' ? textOrgVisibilityLimited: textOrgVisibilityPrivate }} diff --git a/web_src/js/types.ts b/web_src/js/types.ts index 53d272e29e7df..f3ac305162b24 100644 --- a/web_src/js/types.ts +++ b/web_src/js/types.ts @@ -12,7 +12,6 @@ export type Config = { assetVersionEncoded: string, assetUrlPrefix: string, runModeIsProd: boolean, - defaultShowFullName: boolean, customEmojis: Record, csrfToken: string, pageData: Record, From ca7bac4a688b1c43751939305f14051857487321 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 5 Nov 2024 22:39:39 -0800 Subject: [PATCH 3/4] Remove unnecessary code --- templates/base/head_script.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index 399b9a0cdef85..c0c7235e3b02e 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -13,7 +13,6 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly assetUrlPrefix: '{{AssetUrlPrefix}}', runModeIsProd: {{.RunModeIsProd}}, - defaultShowFullName: {{DefaultShowFullName}}, customEmojis: {{CustomEmojis}}, csrfToken: '{{.CsrfToken}}', pageData: {{.PageData}}, From d8c9044637388bd6a0544b8419af521363253285 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 6 Nov 2024 10:33:02 -0800 Subject: [PATCH 4/4] Add space between full name and name --- templates/admin/org/list.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/admin/org/list.tmpl b/templates/admin/org/list.tmpl index 873b9bc5ddd98..d5e09939c5324 100644 --- a/templates/admin/org/list.tmpl +++ b/templates/admin/org/list.tmpl @@ -52,7 +52,7 @@ {{.ID}} - {{if and DefaultShowFullName .FullName}}{{.FullName}}({{.Name}}){{else}}{{.Name}}{{end}} + {{if and DefaultShowFullName .FullName}}{{.FullName}} ({{.Name}}){{else}}{{.Name}}{{end}} {{if .Visibility.IsPrivate}} {{svg "octicon-lock"}} {{end}}