Skip to content

Commit 5a422db

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Add spacing to global error message (go-gitea#31826) [skip ci] Updated translations via Crowdin Fixes for unreachable project issues when transfer repository from organization (go-gitea#31770)
2 parents 8942c19 + 7569a47 commit 5a422db

File tree

7 files changed

+46
-2
lines changed

7 files changed

+46
-2
lines changed

models/project/issue.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,9 @@ func (c *Column) moveIssuesToAnotherColumn(ctx context.Context, newColumn *Colum
117117
return nil
118118
})
119119
}
120+
121+
// DeleteAllProjectIssueByIssueIDsAndProjectIDs delete all project's issues by issue's and project's ids
122+
func DeleteAllProjectIssueByIssueIDsAndProjectIDs(ctx context.Context, issueIDs, projectIDs []int64) error {
123+
_, err := db.GetEngine(ctx).In("project_id", projectIDs).In("issue_id", issueIDs).Delete(&ProjectIssue{})
124+
return err
125+
}

models/project/project.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,12 @@ func GetProjectForRepoByID(ctx context.Context, repoID, id int64) (*Project, err
296296
return p, nil
297297
}
298298

299+
// GetAllProjectsIDsByOwnerID returns the all projects ids it owns
300+
func GetAllProjectsIDsByOwnerIDAndType(ctx context.Context, ownerID int64, projectType Type) ([]int64, error) {
301+
projects := make([]int64, 0)
302+
return projects, db.GetEngine(ctx).Table(&Project{}).Where("owner_id=? AND type=?", ownerID, projectType).Cols("id").Find(&projects)
303+
}
304+
299305
// UpdateProject updates project properties
300306
func UpdateProject(ctx context.Context, p *Project) error {
301307
if !IsCardTypeValid(p.CardType) {

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,7 @@ settings.transfer_in_progress = There is currently an ongoing transfer. Please c
21862186
settings.transfer_notices_1 = - You will lose access to the repository if you transfer it to an individual user.
21872187
settings.transfer_notices_2 = - You will keep access to the repository if you transfer it to an organization that you (co-)own.
21882188
settings.transfer_notices_3 = - If the repository is private and is transferred to an individual user, this action makes sure that the user does have at least read permission (and changes permissions if necessary).
2189+
settings.transfer_notices_4 = - If the repository belongs to an organization, and you transfer it to another organization or individual, you will lose the links between the repository's issues and the organization's project board.
21892190
settings.transfer_owner = New Owner
21902191
settings.transfer_perform = Perform Transfer
21912192
settings.transfer_started = This repository has been marked for transfer and awaits confirmation from "%s"

options/locale/locale_pt-PT.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,7 @@ pulls.cmd_instruction_checkout_title=Conferir
18901890
pulls.cmd_instruction_checkout_desc=No seu repositório, irá criar um novo ramo para que possa testar as modificações.
18911891
pulls.cmd_instruction_merge_title=Integrar
18921892
pulls.cmd_instruction_merge_desc=Integrar as modificações e enviar para o Gitea.
1893+
pulls.cmd_instruction_merge_warning=Aviso: Esta operação não pode executar pedidos de integração porque "auto-identificar integração manual" não estava habilitado
18931894
pulls.clear_merge_message=Apagar mensagem de integração
18941895
pulls.clear_merge_message_hint=Apagar a mensagem de integração apenas remove o conteúdo da mensagem de cometimento e mantém os rodapés do git, tais como "Co-Autorado-Por …".
18951896

@@ -2464,6 +2465,18 @@ settings.thread_id=ID da discussão
24642465
settings.matrix.homeserver_url=URL do servidor caseiro
24652466
settings.matrix.room_id=ID da sala
24662467
settings.matrix.message_type=Tipo de mensagem
2468+
settings.visibility.private.button=Tornar privado
2469+
settings.visibility.private.text=Mudar a visibilidade para privado não só irá tornar o repositório visível somente para membros autorizados como também poderá remover a relação entre o repositório e derivações, vigilâncias e favoritos.
2470+
settings.visibility.private.bullet_title=<strong>Mudar a visibilidade para privado irá:</strong>
2471+
settings.visibility.private.bullet_one=Tornar o repositório visível somente para membros autorizados.
2472+
settings.visibility.private.bullet_two=Possivelmente remover a relação entre o repositório e <strong>derivações</strong>, <strong>vigilâncias</strong> e <strong>favoritos</strong>.
2473+
settings.visibility.public.button=Tornar público
2474+
settings.visibility.public.text=Mudar a visibilidade para público irá tornar o repositório visível para qualquer pessoa.
2475+
settings.visibility.public.bullet_title=<strong>Mudar a visibilidade para público irá:</strong>
2476+
settings.visibility.public.bullet_one=Tornar o repositório visível para qualquer pessoa.
2477+
settings.visibility.success=A visibilidade do repositório foi modificada.
2478+
settings.visibility.error=Ocorreu um erro ao tentar modificar a visibilidade do repositório.
2479+
settings.visibility.fork_error=Não é possível modificar a visibilidade de um repositório derivado de outro.
24672480
settings.archive.button=Arquivar repositório
24682481
settings.archive.header=Arquivar este repositório
24692482
settings.archive.text=Arquivar o repositório irá torná-lo apenas de leitura. Ficará escondido do painel de controlo. Ninguém (nem você!) será capaz de fazer novos cometimentos, abrir questões ou pedidos de integração.

services/repository/transfer.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"code.gitea.io/gitea/models/organization"
1616
"code.gitea.io/gitea/models/perm"
1717
access_model "code.gitea.io/gitea/models/perm/access"
18+
project_model "code.gitea.io/gitea/models/project"
1819
repo_model "code.gitea.io/gitea/models/repo"
1920
user_model "code.gitea.io/gitea/models/user"
2021
"code.gitea.io/gitea/modules/log"
@@ -177,6 +178,22 @@ func transferOwnership(ctx context.Context, doer *user_model.User, newOwnerName
177178
}
178179
}
179180

181+
// Remove project's issues that belong to old organization's projects
182+
if oldOwner.IsOrganization() {
183+
projects, err := project_model.GetAllProjectsIDsByOwnerIDAndType(ctx, oldOwner.ID, project_model.TypeOrganization)
184+
if err != nil {
185+
return fmt.Errorf("Unable to find old org projects: %w", err)
186+
}
187+
issues, err := issues_model.GetIssueIDsByRepoID(ctx, repo.ID)
188+
if err != nil {
189+
return fmt.Errorf("Unable to find repo's issues: %w", err)
190+
}
191+
err = project_model.DeleteAllProjectIssueByIssueIDsAndProjectIDs(ctx, issues, projects)
192+
if err != nil {
193+
return fmt.Errorf("Unable to delete project's issues: %w", err)
194+
}
195+
}
196+
180197
if newOwner.IsOrganization() {
181198
teams, err := organization.FindOrgTeams(ctx, newOwner.ID)
182199
if err != nil {

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
'!./modules/{public,options,templates}/bindata.go',
3737
'./{build,models,modules,routers,services}/**/*.go',
3838
'./templates/**/*.tmpl',
39-
'./web_src/js/**/*.{js,vue}',
39+
'./web_src/js/**/*.{ts,js,vue}',
4040
].filter(Boolean),
4141
blocklist: [
4242
// classes that don't work without CSS variables from "@tailwind base" which we don't use

templates/repo/settings/options.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@
957957
<div class="ui warning message">
958958
{{ctx.Locale.Tr "repo.settings.transfer_notices_1"}} <br>
959959
{{ctx.Locale.Tr "repo.settings.transfer_notices_2"}} <br>
960-
{{ctx.Locale.Tr "repo.settings.transfer_notices_3"}}
960+
{{ctx.Locale.Tr "repo.settings.transfer_notices_3"}} <br>
961+
{{ctx.Locale.Tr "repo.settings.transfer_notices_4"}}
961962
</div>
962963
<form class="ui form" action="{{.Link}}" method="post">
963964
{{.CsrfTokenHtml}}

0 commit comments

Comments
 (0)