diff options
author | singuliere <35190819+singuliere@users.noreply.github.com> | 2022-05-05 16:39:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 11:39:26 -0400 |
commit | b536b65189319544939da9b6537919a4fc838d71 (patch) | |
tree | 038dd21a1f8082aa6020f891c1d8811e522852ea /models/unittest | |
parent | 04fc4b7e05bfbfee6cb7aa4f6c30d1af6f2d4d2d (diff) | |
download | gitea-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/unittest')
-rw-r--r-- | models/unittest/consistency.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/models/unittest/consistency.go b/models/unittest/consistency.go index 2645084d3e..af05348868 100644 --- a/models/unittest/consistency.go +++ b/models/unittest/consistency.go @@ -175,8 +175,10 @@ func init() { checkForActionConsistency := func(t assert.TestingT, bean interface{}) { action := reflectionWrap(bean) - repoRow := AssertExistsAndLoadMap(t, "repository", builder.Eq{"id": action.int("RepoID")}) - assert.Equal(t, parseBool(repoRow["is_private"]), action.bool("IsPrivate"), "action: %+v", action) + if action.int("RepoID") != 1700 { // dangling intentional + repoRow := AssertExistsAndLoadMap(t, "repository", builder.Eq{"id": action.int("RepoID")}) + assert.Equal(t, parseBool(repoRow["is_private"]), action.bool("IsPrivate"), "action: %+v", action) + } } consistencyCheckMap["user"] = checkForUserConsistency |