mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 22:12:25 -05:00 
			
		
		
		
	fix broken GetInstanceAccount selector (#311)
* fix broken GetInstanceAccount selector * patch tests
This commit is contained in:
		
					parent
					
						
							
								ff7c96caa3
							
						
					
				
			
			
				commit
				
					
						f3e36de78a
					
				
			
		
					 2 changed files with 4 additions and 4 deletions
				
			
		|  | @ -127,13 +127,13 @@ func (a *accountDB) GetInstanceAccount(ctx context.Context, domain string) (*gts | ||||||
| 
 | 
 | ||||||
| 	q := a.newAccountQ(account) | 	q := a.newAccountQ(account) | ||||||
| 
 | 
 | ||||||
| 	if domain == "" { | 	if domain != "" { | ||||||
| 		q = q. | 		q = q. | ||||||
| 			Where("account.username = ?", domain). | 			Where("account.username = ?", domain). | ||||||
| 			Where("account.domain = ?", domain) | 			Where("account.domain = ?", domain) | ||||||
| 	} else { | 	} else { | ||||||
| 		q = q. | 		q = q. | ||||||
| 			Where("account.username = ?", domain). | 			Where("account.username = ?", a.config.Host). | ||||||
| 			WhereGroup(" AND ", whereEmptyOrNull("domain")) | 			WhereGroup(" AND ", whereEmptyOrNull("domain")) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ func (suite *AdminTestSuite) TestCreateInstanceAccount() { | ||||||
| 	testrig.CreateTestTables(suite.db) | 	testrig.CreateTestTables(suite.db) | ||||||
| 
 | 
 | ||||||
| 	// make sure there's no instance account in the db yet | 	// make sure there's no instance account in the db yet | ||||||
| 	acct, err := suite.db.GetInstanceAccount(context.Background(), suite.config.Host) | 	acct, err := suite.db.GetInstanceAccount(context.Background(), "") | ||||||
| 	suite.Error(err) | 	suite.Error(err) | ||||||
| 	suite.Nil(acct) | 	suite.Nil(acct) | ||||||
| 
 | 
 | ||||||
|  | @ -46,7 +46,7 @@ func (suite *AdminTestSuite) TestCreateInstanceAccount() { | ||||||
| 	suite.NoError(err) | 	suite.NoError(err) | ||||||
| 
 | 
 | ||||||
| 	// and now check it exists | 	// and now check it exists | ||||||
| 	acct, err = suite.db.GetInstanceAccount(context.Background(), suite.config.Host) | 	acct, err = suite.db.GetInstanceAccount(context.Background(), "") | ||||||
| 	suite.NoError(err) | 	suite.NoError(err) | ||||||
| 	suite.NotNil(acct) | 	suite.NotNil(acct) | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue