-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
GetFeeds must always discard actions with dangling repo_id #19598
Conversation
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.
LGTM, seems a bit hacky tbh. Seems like we should actually fix loadRepoOwner
to not panic.
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.
TestPrivateActivityNoVisibleForPublic
fails related :/
b41ab10
to
bf728b8
Compare
I agree that it feels like a hack. Now that the tests are passing I'll try to follow your suggestion. My concern is that returning an action with a nil Repo member is likely to set a trap for future code using the Action struct that goes undetected because it is a rare occurrence and not covered by the current tests. |
a691314
to
4b4da6b
Compare
@Gusted Added a safeguard so loadRepoOwner is no longer susceptible to panic on action.Repo == nil |
fae8c19
to
3fc19d8
Compare
please |
@singuliere please refrain from force pushes, it makes it hard to review PRs |
This comment was marked as off-topic.
This comment was marked as off-topic.
@singuliere please send backport :) |
…19598) Co-authored-by: Loïc Dachary <loic@dachary.org> (cherry picked from commit b536b65) Conflicts: models/action_test.go The GetFeeds function does not have a Context argument in 1.16. models/action.go The SQL statement is essentially the same in 1.16 but structured differently. The Join() was copied and the created_unix field prefixed with `action`. models/action_list.go in 1.16 the loadRepoOwner method did not exist and it was done in the RetrieveFeeds method of web/feed/profile.go. The safeguard to skip when act.Repo == nil was moved there.
* giteaofficial/main: Simplify `IsVendor` (go-gitea#19626) Prevent NPE when checking repo units if the user is nil (go-gitea#19625) Skip duplicated layers. (go-gitea#19624) Add "Reference" section to Issue view sidebar (go-gitea#19609) GetFeeds must always discard actions with dangling repo_id (go-gitea#19598)
…19629) Co-authored-by: Loïc Dachary <loic@dachary.org> (cherry picked from commit b536b65) Conflicts: models/action_test.go The GetFeeds function does not have a Context argument in 1.16. models/action.go The SQL statement is essentially the same in 1.16 but structured differently. The Join() was copied and the created_unix field prefixed with `action`. models/action_list.go in 1.16 the loadRepoOwner method did not exist and it was done in the RetrieveFeeds method of web/feed/profile.go. The safeguard to skip when act.Repo == nil was moved there.
…19598) * GetFeeds must always discard actions with dangling repo_id See https://discourse.gitea.io/t/blank-page-after-login/5051/12 for a panic in 1.16.6. * add comment to explain the dangling ID in the fixture * loadRepoOwner must not attempt to use a nil action.Repo * make fmt Co-authored-by: Loïc Dachary <loic@dachary.org>
See original merge request from Loïc Dachary @ forgefriends
See https://discourse.gitea.io/t/blank-page-after-login/5051/12
for a panic in 1.16.6.
Fix #19631