summaryrefslogtreecommitdiffstats
path: root/models/action_test.go
diff options
context:
space:
mode:
authorsinguliere <35190819+singuliere@users.noreply.github.com>2022-05-05 16:39:26 +0100
committerGitHub <noreply@github.com>2022-05-05 11:39:26 -0400
commitb536b65189319544939da9b6537919a4fc838d71 (patch)
tree038dd21a1f8082aa6020f891c1d8811e522852ea /models/action_test.go
parent04fc4b7e05bfbfee6cb7aa4f6c30d1af6f2d4d2d (diff)
downloadgitea-b536b65189319544939da9b6537919a4fc838d71.tar.gz
gitea-b536b65189319544939da9b6537919a4fc838d71.zip
GetFeeds must always discard actions with dangling repo_id (#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>
Diffstat (limited to 'models/action_test.go')
-rw-r--r--models/action_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/action_test.go b/models/action_test.go
index e247a5ec29..fb8a6c2686 100644
--- a/models/action_test.go
+++ b/models/action_test.go
@@ -211,3 +211,20 @@ func TestNotifyWatchers(t *testing.T) {
OpType: action.OpType,
})
}
+
+func TestGetFeedsCorrupted(t *testing.T) {
+ assert.NoError(t, unittest.PrepareTestDatabase())
+ user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User)
+ unittest.AssertExistsAndLoadBean(t, &Action{
+ ID: 8,
+ RepoID: 1700,
+ })
+
+ actions, err := GetFeeds(db.DefaultContext, GetFeedsOptions{
+ RequestedUser: user,
+ Actor: user,
+ IncludePrivate: true,
+ })
+ assert.NoError(t, err)
+ assert.Len(t, actions, 0)
+}