Browse Source

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.
pull/3250/head
Pheng Heong TAN 8 years ago committed by 无闻
parent
commit
467d7dacb6
  1. 4
      conf/locale/locale_en-US.ini
  2. 12
      models/repo.go
  3. 1623
      modules/bindata/bindata.go
  4. 2
      templates/admin/repo/list.tmpl
  5. 4
      templates/repo/settings/options.tmpl

4
conf/locale/locale_en-US.ini

@ -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_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_fork_1 = - If this repository is public, 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.delete_notices_fork_1 = - All forks will become independent after deletion.
settings.deletion_success = Repository has been deleted successfully!
settings.update_settings_success = Repository options has been updated successfully.
settings.transfer_owner = New Owner

12
models/repo.go

@ -1409,21 +1409,9 @@ func DeleteRepository(uid, repoID int64) error {
}
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 {
log.Error(4, "reset 'fork_id' and 'is_fork': %v", err)
}
}
}
return nil

1623
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

2
templates/admin/repo/list.tmpl

@ -59,8 +59,6 @@
<p>{{.i18n.Tr "repo.settings.delete_desc"}}</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_2"}}</p>
<p>{{.i18n.Tr "repo.settings.delete_notices_fork_3"}}</p>
</div>
{{template "base/delete_modal_actions" .}}
</div>

4
templates/repo/settings/options.tmpl

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

Loading…
Cancel
Save