mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Add context.Context to more methods (#21546)
				
					
				
			This PR adds a context parameter to a bunch of methods. Some helper `xxxCtx()` methods got replaced with the normal name now. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -10,6 +10,7 @@ import (
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	activities_model "code.gitea.io/gitea/models/activities"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	"code.gitea.io/gitea/models/unittest"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
@@ -25,7 +26,7 @@ func TestAPINotification(t *testing.T) {
 | 
			
		||||
	user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
 | 
			
		||||
	repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
 | 
			
		||||
	thread5 := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{ID: 5})
 | 
			
		||||
	assert.NoError(t, thread5.LoadAttributes())
 | 
			
		||||
	assert.NoError(t, thread5.LoadAttributes(db.DefaultContext))
 | 
			
		||||
	session := loginUser(t, user2.Name)
 | 
			
		||||
	token := getTokenForLoggedInUser(t, session)
 | 
			
		||||
 | 
			
		||||
@@ -143,7 +144,7 @@ func TestAPINotificationPUT(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
 | 
			
		||||
	thread5 := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{ID: 5})
 | 
			
		||||
	assert.NoError(t, thread5.LoadAttributes())
 | 
			
		||||
	assert.NoError(t, thread5.LoadAttributes(db.DefaultContext))
 | 
			
		||||
	session := loginUser(t, user2.Name)
 | 
			
		||||
	token := getTokenForLoggedInUser(t, session)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user