Skip to content

Commit 56b6f99

Browse files
committed
fix delete repo
1 parent c88a9b8 commit 56b6f99

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

models/repo.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
16251625
&LanguageStat{RepoID: repoID},
16261626
&Comment{RefRepoID: repoID},
16271627
&Task{RepoID: repoID},
1628+
&UserPinnedRepo{RepoID: repoID},
16281629
); err != nil {
16291630
return fmt.Errorf("deleteBeans: %v", err)
16301631
}

models/user.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,7 @@ func deleteUser(e *xorm.Session, u *User) error {
12421242
&TeamUser{UID: u.ID},
12431243
&Collaboration{UserID: u.ID},
12441244
&Stopwatch{UserID: u.ID},
1245+
&UserPinnedRepo{UID: u.ID},
12451246
); err != nil {
12461247
return fmt.Errorf("deleteBeans: %v", err)
12471248
}

options/locale/locale_en-US.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,6 @@ update_avatar_success = Your avatar has been updated.
457457
458458
pinned_repo = pinned this repo
459459
unpinned_repo = unpinned this repo
460-
pinned_repo_success = Successfully pinned repo
461-
unpinned_repo_success = Successfully unpinned repo
462460
pinned_other_repo_des = Repo full name
463461
pinned_other_repo = Pinned other repo
464462
pinned_btn = Pinned

routers/org/home.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ func Home(ctx *context.Context) {
140140

141141
if !has {
142142
repo, err := models.GetRepositoryByID(pinnedRepoID)
143-
if err != nil {
144-
if !models.IsErrRepoNotExist(err) {
145-
ctx.ServerError("GetRepositoryByID", err)
146-
}
143+
if err != nil && !models.IsErrRepoNotExist(err) {
144+
ctx.ServerError("GetRepositoryByID", err)
147145
return
148146
}
149147

routers/user/profile.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,8 @@ func Profile(ctx *context.Context) {
267267

268268
if !has {
269269
repo, err := models.GetRepositoryByID(pinnedRepoID)
270-
if err != nil {
271-
if !models.IsErrRepoNotExist(err) {
272-
ctx.ServerError("GetRepositoryByID", err)
273-
}
270+
if err != nil && !models.IsErrRepoNotExist(err) {
271+
ctx.ServerError("GetRepositoryByID", err)
274272
return
275273
}
276274

0 commit comments

Comments
 (0)