mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Move user functions into user.go (#17659)
* Move user functions into user.go * Fix test
This commit is contained in:
parent
6874fe90e5
commit
3c3855a05c
14 changed files with 101 additions and 72 deletions
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
_ "image/jpeg" // Needed for jpeg support
|
||||
|
||||
admin_model "code.gitea.io/gitea/models/admin"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
"code.gitea.io/gitea/models/webhook"
|
||||
|
@ -133,7 +134,7 @@ func NewRepoContext() {
|
|||
loadRepoConfig()
|
||||
unit.LoadUnitConfig()
|
||||
|
||||
RemoveAllWithNotice("Clean up repository temporary data", filepath.Join(setting.AppDataPath, "tmp"))
|
||||
admin_model.RemoveAllWithNotice("Clean up repository temporary data", filepath.Join(setting.AppDataPath, "tmp"))
|
||||
}
|
||||
|
||||
// RepositoryStatus defines the status of repository
|
||||
|
@ -1648,36 +1649,36 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
|
|||
|
||||
// Remove repository files.
|
||||
repoPath := repo.RepoPath()
|
||||
removeAllWithNotice(db.GetEngine(db.DefaultContext), "Delete repository files", repoPath)
|
||||
admin_model.RemoveAllWithNotice("Delete repository files", repoPath)
|
||||
|
||||
// Remove wiki files
|
||||
if repo.HasWiki() {
|
||||
removeAllWithNotice(db.GetEngine(db.DefaultContext), "Delete repository wiki", repo.WikiPath())
|
||||
admin_model.RemoveAllWithNotice("Delete repository wiki", repo.WikiPath())
|
||||
}
|
||||
|
||||
// Remove archives
|
||||
for i := range archivePaths {
|
||||
removeStorageWithNotice(db.GetEngine(db.DefaultContext), storage.RepoArchives, "Delete repo archive file", archivePaths[i])
|
||||
admin_model.RemoveStorageWithNotice(storage.RepoArchives, "Delete repo archive file", archivePaths[i])
|
||||
}
|
||||
|
||||
// Remove lfs objects
|
||||
for i := range lfsPaths {
|
||||
removeStorageWithNotice(db.GetEngine(db.DefaultContext), storage.LFS, "Delete orphaned LFS file", lfsPaths[i])
|
||||
admin_model.RemoveStorageWithNotice(storage.LFS, "Delete orphaned LFS file", lfsPaths[i])
|
||||
}
|
||||
|
||||
// Remove issue attachment files.
|
||||
for i := range attachmentPaths {
|
||||
RemoveStorageWithNotice(storage.Attachments, "Delete issue attachment", attachmentPaths[i])
|
||||
admin_model.RemoveStorageWithNotice(storage.Attachments, "Delete issue attachment", attachmentPaths[i])
|
||||
}
|
||||
|
||||
// Remove release attachment files.
|
||||
for i := range releaseAttachments {
|
||||
RemoveStorageWithNotice(storage.Attachments, "Delete release attachment", releaseAttachments[i])
|
||||
admin_model.RemoveStorageWithNotice(storage.Attachments, "Delete release attachment", releaseAttachments[i])
|
||||
}
|
||||
|
||||
// Remove attachment with no issue_id and release_id.
|
||||
for i := range newAttachmentPaths {
|
||||
RemoveStorageWithNotice(storage.Attachments, "Delete issue attachment", attachmentPaths[i])
|
||||
admin_model.RemoveStorageWithNotice(storage.Attachments, "Delete issue attachment", attachmentPaths[i])
|
||||
}
|
||||
|
||||
if len(repo.Avatar) > 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue