mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-06 02:15:20 +02:00
add repo list of dashboard
This commit is contained in:
parent
fdc4151ff3
commit
b5cc4078a9
4 changed files with 24 additions and 5 deletions
|
@ -223,6 +223,10 @@ func GetRepositories(user *User) ([]Repository, error) {
|
|||
return repos, err
|
||||
}
|
||||
|
||||
func GetRepositoryCount(user *User) (int64, error) {
|
||||
return orm.Count(&Repository{OwnerId: user.Id})
|
||||
}
|
||||
|
||||
func StarReposiory(user *User, repoName string) error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -142,13 +142,15 @@ func UpdateUser(user *User) (err error) {
|
|||
|
||||
// DeleteUser completely deletes everything of the user.
|
||||
func DeleteUser(user *User) error {
|
||||
repos, err := GetRepositories(user)
|
||||
cnt, err := GetRepositoryCount(user)
|
||||
if err != nil {
|
||||
return errors.New("modesl.GetRepositories: " + err.Error())
|
||||
} else if len(repos) > 0 {
|
||||
} else if cnt > 0 {
|
||||
return ErrUserOwnRepos
|
||||
}
|
||||
|
||||
// TODO: check issues, other repos' commits
|
||||
|
||||
_, err = orm.Delete(user)
|
||||
// TODO: delete and update follower information.
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue