0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-16 23:11:10 +01:00

Modify behaviour of repo-delete. (#3232)

Re: issues gogits/gogs#2863 and gogits/gogs#3231

As a result of modifications to the contents of the conf folder, `make bindata`
was run, causing an update to bindata.go.

Meta
-----
This commit will be rebased onto the 'develop' branch.
This commit is contained in:
Pheng Heong TAN 2016-07-09 13:13:57 +08:00 committed by 无闻
parent d62ab49978
commit 467d7dacb6
5 changed files with 704 additions and 941 deletions

View file

@ -604,9 +604,7 @@ settings.delete = Delete This Repository
settings.delete_desc = Once you delete a repository, there is no going back. Please be certain. settings.delete_desc = Once you delete a repository, there is no going back. Please be certain.
settings.delete_notices_1 = - This operation <strong>CANNOT</strong> be undone. settings.delete_notices_1 = - This operation <strong>CANNOT</strong> be undone.
settings.delete_notices_2 = - This operation will permanently delete the everything of this repository, including Git data, issues, comments and accesses of collaborators. settings.delete_notices_2 = - This operation will permanently delete the everything of this repository, including Git data, issues, comments and accesses of collaborators.
settings.delete_notices_fork_1 = - If this repository is public, all forks will become independent after deletion. settings.delete_notices_fork_1 = - All forks will become independent after deletion.
settings.delete_notices_fork_2 = - If this repository is private, all forks will be removed at the same time.
settings.delete_notices_fork_3 = - If you want to keep all forks after deletion, please change visibility of this repository to public first.
settings.deletion_success = Repository has been deleted successfully! settings.deletion_success = Repository has been deleted successfully!
settings.update_settings_success = Repository options has been updated successfully. settings.update_settings_success = Repository options has been updated successfully.
settings.transfer_owner = New Owner settings.transfer_owner = New Owner

View file

@ -1409,22 +1409,10 @@ func DeleteRepository(uid, repoID int64) error {
} }
if repo.NumForks > 0 { if repo.NumForks > 0 {
if repo.IsPrivate {
forkRepos, err := GetRepositoriesByForkID(repo.ID)
if err != nil {
return fmt.Errorf("getRepositoriesByForkID: %v", err)
}
for i := range forkRepos {
if err = DeleteRepository(forkRepos[i].OwnerID, forkRepos[i].ID); err != nil {
log.Error(4, "DeleteRepository [%d]: %v", forkRepos[i].ID, err)
}
}
} else {
if _, err = x.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil { if _, err = x.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil {
log.Error(4, "reset 'fork_id' and 'is_fork': %v", err) log.Error(4, "reset 'fork_id' and 'is_fork': %v", err)
} }
} }
}
return nil return nil
} }

File diff suppressed because one or more lines are too long

View file

@ -59,8 +59,6 @@
<p>{{.i18n.Tr "repo.settings.delete_desc"}}</p> <p>{{.i18n.Tr "repo.settings.delete_desc"}}</p>
<p>{{.i18n.Tr "repo.settings.delete_notices_2"}}</p> <p>{{.i18n.Tr "repo.settings.delete_notices_2"}}</p>
<p>{{.i18n.Tr "repo.settings.delete_notices_fork_1"}}</p> <p>{{.i18n.Tr "repo.settings.delete_notices_fork_1"}}</p>
<p>{{.i18n.Tr "repo.settings.delete_notices_fork_2"}}</p>
<p>{{.i18n.Tr "repo.settings.delete_notices_fork_3"}}</p>
</div> </div>
{{template "base/delete_modal_actions" .}} {{template "base/delete_modal_actions" .}}
</div> </div>

View file

@ -288,9 +288,7 @@
{{.i18n.Tr "repo.settings.delete_notices_1" | Safe}} <br> {{.i18n.Tr "repo.settings.delete_notices_1" | Safe}} <br>
{{.i18n.Tr "repo.settings.delete_notices_2" | Safe}} {{.i18n.Tr "repo.settings.delete_notices_2" | Safe}}
{{if .Repository.NumForks}}<br> {{if .Repository.NumForks}}<br>
{{.i18n.Tr "repo.settings.delete_notices_fork_1" | Safe}} <br> {{.i18n.Tr "repo.settings.delete_notices_fork_1" | Safe}}
{{.i18n.Tr "repo.settings.delete_notices_fork_2" | Safe}} <br>
{{.i18n.Tr "repo.settings.delete_notices_fork_3" | Safe}}
{{end}} {{end}}
</div> </div>
<form class="ui form" action="{{.Link}}" method="post"> <form class="ui form" action="{{.Link}}" method="post">