| 
														
															@@ -374,7 +374,7 @@ func usersCount(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	got = db.Count(ctx) 
														 | 
														
														 | 
														
															 	got = db.Count(ctx) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	assert.Equal(t, int64(1), got) 
														 | 
														
														 | 
														
															 	assert.Equal(t, int64(1), got) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsList-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersCount-tempPictureAvatarUploadPath") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	// Create an organization shouldn't count 
														 | 
														
														 | 
														
															 	// Create an organization shouldn't count 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -391,6 +391,9 @@ func usersCreate(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		"alice", 
														 | 
														
														 | 
														
															 		"alice", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		"alice@example.com", 
														 | 
														
														 | 
														
															 		"alice@example.com", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		CreateUserOptions{ 
														 | 
														
														 | 
														
															 		CreateUserOptions{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			FullName:  "Alice Jones", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			Location:  "Earth", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			Website:   "alice@example.com", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			Activated: true, 
														 | 
														
														 | 
														
															 			Activated: true, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}, 
														 | 
														
														 | 
														
															 		}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	) 
														 | 
														
														 | 
														
															 	) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -427,10 +430,14 @@ func usersCreate(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		assert.Equal(t, wantErr, err) 
														 | 
														
														 | 
														
															 		assert.Equal(t, wantErr, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	}) 
														 | 
														
														 | 
														
															 	}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	user, err := db.GetByUsername(ctx, alice.Name) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	got, err := db.GetByUsername(ctx, alice.Name) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	require.NoError(t, err) 
														 | 
														
														 | 
														
															 	require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	assert.Equal(t, db.NowFunc().Format(time.RFC3339), user.Created.UTC().Format(time.RFC3339)) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	assert.Equal(t, db.NowFunc().Format(time.RFC3339), user.Updated.UTC().Format(time.RFC3339)) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	assert.Equal(t, alice.Name, got.Name) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	assert.Equal(t, alice.FullName, got.FullName) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	assert.Equal(t, alice.Location, got.Location) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	assert.Equal(t, alice.Website, got.Website) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	assert.Equal(t, db.NowFunc().Format(time.RFC3339), got.Created.UTC().Format(time.RFC3339)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	assert.Equal(t, db.NowFunc().Format(time.RFC3339), got.Updated.UTC().Format(time.RFC3339)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 func usersDeleteCustomAvatar(t *testing.T, ctx context.Context, db *users) { 
														 | 
														
														 | 
														
															 func usersDeleteCustomAvatar(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -440,7 +447,7 @@ func usersDeleteCustomAvatar(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	avatar, err := public.Files.ReadFile("img/avatar_default.png") 
														 | 
														
														 | 
														
															 	avatar, err := public.Files.ReadFile("img/avatar_default.png") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	require.NoError(t, err) 
														 | 
														
														 | 
														
															 	require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsList-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersDeleteCustomAvatar-tempPictureAvatarUploadPath") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	avatarPath := userutil.CustomAvatarPath(alice.ID) 
														 | 
														
														 | 
														
															 	avatarPath := userutil.CustomAvatarPath(alice.ID) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -485,13 +492,13 @@ func usersDeleteByID(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		assert.Equal(t, wantErr, err) 
														 | 
														
														 | 
														
															 		assert.Equal(t, wantErr, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	}) 
														 | 
														
														 | 
														
															 	}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersDeleteByID-tempPictureAvatarUploadPath") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	t.Run("user still has organization membership", func(t *testing.T) { 
														 | 
														
														 | 
														
															 	t.Run("user still has organization membership", func(t *testing.T) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		bob, err := db.Create(ctx, "bob", "bob@exmaple.com", CreateUserOptions{}) 
														 | 
														
														 | 
														
															 		bob, err := db.Create(ctx, "bob", "bob@exmaple.com", CreateUserOptions{}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		require.NoError(t, err) 
														 | 
														
														 | 
														
															 		require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsList-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		_, err = NewOrganizationsStore(db.DB).Create(ctx, "org1", bob.ID, CreateOrganizationOptions{}) 
														 | 
														
														 | 
														
															 		_, err = NewOrganizationsStore(db.DB).Create(ctx, "org1", bob.ID, CreateOrganizationOptions{}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		require.NoError(t, err) 
														 | 
														
														 | 
														
															 		require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -568,8 +575,6 @@ func usersDeleteByID(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	require.NoError(t, err) 
														 | 
														
														 | 
														
															 	require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	// Mock user custom avatar 
														 | 
														
														 | 
														
															 	// Mock user custom avatar 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersDeleteByID-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	err = os.MkdirAll(tempPictureAvatarUploadPath, os.ModePerm) 
														 | 
														
														 | 
														
															 	err = os.MkdirAll(tempPictureAvatarUploadPath, os.ModePerm) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	require.NoError(t, err) 
														 | 
														
														 | 
														
															 	require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	tempCustomAvatarPath := userutil.CustomAvatarPath(testUser.ID) 
														 | 
														
														 | 
														
															 	tempCustomAvatarPath := userutil.CustomAvatarPath(testUser.ID) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -685,7 +690,7 @@ func usersDeleteInactivated(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	bob, err := db.Create(ctx, "bob", "bob@exmaple.com", CreateUserOptions{}) 
														 | 
														
														 | 
														
															 	bob, err := db.Create(ctx, "bob", "bob@exmaple.com", CreateUserOptions{}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	require.NoError(t, err) 
														 | 
														
														 | 
														
															 	require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsList-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersDeleteInactivated-tempPictureAvatarUploadPath") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	_, err = NewOrganizationsStore(db.DB).Create(ctx, "org1", bob.ID, CreateOrganizationOptions{}) 
														 | 
														
														 | 
														
															 	_, err = NewOrganizationsStore(db.DB).Create(ctx, "org1", bob.ID, CreateOrganizationOptions{}) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -722,7 +727,7 @@ func usersGetByEmail(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	}) 
														 | 
														
														 | 
														
															 	}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	t.Run("ignore organization", func(t *testing.T) { 
														 | 
														
														 | 
														
															 	t.Run("ignore organization", func(t *testing.T) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsList-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersGetByEmail-tempPictureAvatarUploadPath") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 		conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		org, err := NewOrganizationsStore(db.DB).Create(ctx, "gogs", 1, CreateOrganizationOptions{Email: "gogs@example.com"}) 
														 | 
														
														 | 
														
															 		org, err := NewOrganizationsStore(db.DB).Create(ctx, "gogs", 1, CreateOrganizationOptions{Email: "gogs@example.com"}) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -802,7 +807,7 @@ func usersGetByUsername(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	}) 
														 | 
														
														 | 
														
															 	}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	t.Run("wrong user type", func(t *testing.T) { 
														 | 
														
														 | 
														
															 	t.Run("wrong user type", func(t *testing.T) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsList-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersGetByUsername-tempPictureAvatarUploadPath") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 		conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		org1, err := NewOrganizationsStore(db.DB).Create(ctx, "org1", 1, CreateOrganizationOptions{}) 
														 | 
														
														 | 
														
															 		org1, err := NewOrganizationsStore(db.DB).Create(ctx, "org1", 1, CreateOrganizationOptions{}) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -910,7 +915,7 @@ func usersList(t *testing.T, ctx context.Context, db *users) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	require.NoError(t, err) 
														 | 
														
														 | 
														
															 	require.NoError(t, err) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	// Create an organization shouldn't count 
														 | 
														
														 | 
														
															 	// Create an organization shouldn't count 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "orgsList-tempPictureAvatarUploadPath") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	tempPictureAvatarUploadPath := filepath.Join(os.TempDir(), "usersList-tempPictureAvatarUploadPath") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
														
														 | 
														
															 	conf.SetMockPicture(t, conf.PictureOpts{AvatarUploadPath: tempPictureAvatarUploadPath}) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	_, err = NewOrganizationsStore(db.DB).Create(ctx, "org1", bob.ID, CreateOrganizationOptions{}) 
														 | 
														
														 | 
														
															 	_, err = NewOrganizationsStore(db.DB).Create(ctx, "org1", bob.ID, CreateOrganizationOptions{}) 
														 |