-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix not removed watches on unallowed repositories #4201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4201 +/- ##
==========================================
+ Coverage 19.97% 19.98% +0.01%
==========================================
Files 153 153
Lines 30530 30581 +51
==========================================
+ Hits 6097 6112 +15
- Misses 23519 23542 +23
- Partials 914 927 +13
Continue to review full report at Codecov.
|
@lafriks Please add status/wip as I've to add the migration to cleanup hanging watches |
@daviian I don't think that the mgiration is necessary for this fix. It would be nice to have, but not something that should hold back this PR. |
@bkcsoft It's already implemented. I'm currently in the middle of testing the migration locally ;) If it's fine i'll push. |
return a.Mode, nil | ||
} | ||
|
||
sess := x.NewSession() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need
defer sess.Close()
if err := sess.Begin(); err != nil {
return err
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes. Totally forgot.
models/org_team.go
Outdated
@@ -178,6 +178,11 @@ func (t *Team) removeRepository(e Engine, repo *Repository, recalculate bool) (e | |||
if err = watchRepo(e, teamUser.UID, repo.ID, false); err != nil { | |||
return err | |||
} | |||
|
|||
// Remove all IssueWatches a user has subscribed to in the repositories | |||
if err := removeIssueWatchersByRepoID(e, teamUser.ID, repo.ID); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
teamUser.UID
@lunny Added your suggestions |
…removed, a collaborator is removed
} | ||
if _, err := x.Get(repo); err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should repoCache[watch.RepoID] = repo
} | ||
if _, err := x.Get(repo); err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above
Please follow my comment, otherwise LGTM |
@lafriks the ticket this was attached to was marked as backport, but you removed the label from this PR, should it still be backported? |
This will not be back port since it has a migration which will let user difficult upgrade from v1.4 to v1.5 |
Targets: #3343, #3782, #4149
What does it do:
TODO: