summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-09-30 11:04:08 +0800
committerGitHub <noreply@github.com>2024-09-30 11:04:08 +0800
commita4a6c785b43080b1f9f3492bd1fa1adee648aec4 (patch)
tree4a8a5d28bb12d862a9f981c241b3101cfe046de2 /models
parent634454c48c829e2dd90b84fd3077ce9ff24fccfd (diff)
downloadgitea-a4a6c785b43080b1f9f3492bd1fa1adee648aec4.tar.gz
gitea-a4a6c785b43080b1f9f3492bd1fa1adee648aec4.zip
Don't join repository when loading action table data (#32127) (#32143)
backport #32127
Diffstat (limited to 'models')
-rw-r--r--models/activities/action.go4
-rw-r--r--models/activities/action_test.go6
2 files changed, 5 insertions, 5 deletions
diff --git a/models/activities/action.go b/models/activities/action.go
index d23f2bd986..a99df558cb 100644
--- a/models/activities/action.go
+++ b/models/activities/action.go
@@ -450,9 +450,7 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, int64, err
return nil, 0, err
}
- sess := db.GetEngine(ctx).Where(cond).
- Select("`action`.*"). // this line will avoid select other joined table's columns
- Join("INNER", "repository", "`repository`.id = `action`.repo_id")
+ sess := db.GetEngine(ctx).Where(cond)
opts.SetDefaultValues()
sess = db.SetSessionPagination(sess, &opts)
diff --git a/models/activities/action_test.go b/models/activities/action_test.go
index 557415dcda..7ed33f9eb3 100644
--- a/models/activities/action_test.go
+++ b/models/activities/action_test.go
@@ -226,6 +226,8 @@ func TestNotifyWatchers(t *testing.T) {
}
func TestGetFeedsCorrupted(t *testing.T) {
+ // Now we will not check for corrupted data in the feeds
+ // users should run doctor to fix their data
assert.NoError(t, unittest.PrepareTestDatabase())
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
unittest.AssertExistsAndLoadBean(t, &activities_model.Action{
@@ -239,8 +241,8 @@ func TestGetFeedsCorrupted(t *testing.T) {
IncludePrivate: true,
})
assert.NoError(t, err)
- assert.Len(t, actions, 0)
- assert.Equal(t, int64(0), count)
+ assert.Len(t, actions, 1)
+ assert.Equal(t, int64(1), count)
}
func TestConsistencyUpdateAction(t *testing.T) {