mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 10:37:11 -04:00 
			
		
		
		
	refactor: remove int user Id
This commit is contained in:
		
							parent
							
								
									fea9a16f63
								
							
						
					
					
						commit
						155a2e83a9
					
				| @ -105,7 +105,8 @@ class AlbumAdditionalSharedUserSelectionPage extends HookConsumerWidget { | |||||||
|                   if (sharedUsersList.value.contains(users[index])) { |                   if (sharedUsersList.value.contains(users[index])) { | ||||||
|                     sharedUsersList.value = sharedUsersList.value |                     sharedUsersList.value = sharedUsersList.value | ||||||
|                         .where( |                         .where( | ||||||
|                           (selectedUser) => selectedUser.id != users[index].id, |                           (selectedUser) => | ||||||
|  |                               selectedUser.uid != users[index].uid, | ||||||
|                         ) |                         ) | ||||||
|                         .toSet(); |                         .toSet(); | ||||||
|                   } else { |                   } else { | ||||||
|  | |||||||
| @ -118,7 +118,8 @@ class AlbumSharedUserSelectionPage extends HookConsumerWidget { | |||||||
|                   if (sharedUsersList.value.contains(users[index])) { |                   if (sharedUsersList.value.contains(users[index])) { | ||||||
|                     sharedUsersList.value = sharedUsersList.value |                     sharedUsersList.value = sharedUsersList.value | ||||||
|                         .where( |                         .where( | ||||||
|                           (selectedUser) => selectedUser.id != users[index].id, |                           (selectedUser) => | ||||||
|  |                               selectedUser.uid != users[index].uid, | ||||||
|                         ) |                         ) | ||||||
|                         .toSet(); |                         .toSet(); | ||||||
|                   } else { |                   } else { | ||||||
|  | |||||||
| @ -51,7 +51,7 @@ class ActivitiesPage extends HookConsumerWidget { | |||||||
|           final liked = data.firstWhereOrNull( |           final liked = data.firstWhereOrNull( | ||||||
|             (a) => |             (a) => | ||||||
|                 a.type == ActivityType.like && |                 a.type == ActivityType.like && | ||||||
|                 a.user.id == user?.id && |                 a.user.uid == user?.uid && | ||||||
|                 a.assetId == asset?.remoteId, |                 a.assetId == asset?.remoteId, | ||||||
|           ); |           ); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -111,7 +111,7 @@ class PartnerDetailPage extends HookConsumerWidget { | |||||||
|             ), |             ), | ||||||
|           ), |           ), | ||||||
|         ), |         ), | ||||||
|         renderListProvider: singleUserTimelineProvider(partner.id), |         renderListProvider: singleUserTimelineProvider(partner.uid), | ||||||
|         onRefresh: () => ref.read(assetProvider.notifier).getAllAsset(), |         onRefresh: () => ref.read(assetProvider.notifier).getAllAsset(), | ||||||
|         deleteEnabled: false, |         deleteEnabled: false, | ||||||
|         favoriteEnabled: false, |         favoriteEnabled: false, | ||||||
|  | |||||||
| @ -110,7 +110,7 @@ class PhotosPage extends HookConsumerWidget { | |||||||
|               : const SizedBox(), |               : const SizedBox(), | ||||||
|           renderListProvider: timelineUsers.length > 1 |           renderListProvider: timelineUsers.length > 1 | ||||||
|               ? multiUsersTimelineProvider(timelineUsers) |               ? multiUsersTimelineProvider(timelineUsers) | ||||||
|               : singleUserTimelineProvider(currentUser?.id), |               : singleUserTimelineProvider(currentUser?.uid), | ||||||
|           buildLoadingIndicator: buildLoadingIndicator, |           buildLoadingIndicator: buildLoadingIndicator, | ||||||
|           onRefresh: refreshAssets, |           onRefresh: refreshAssets, | ||||||
|           stackEnabled: true, |           stackEnabled: true, | ||||||
|  | |||||||
| @ -10,6 +10,6 @@ final otherUsersProvider = | |||||||
|   final currentUser = ref.watch(currentUserProvider); |   final currentUser = ref.watch(currentUserProvider); | ||||||
| 
 | 
 | ||||||
|   final allUsers = await userService.getAll(); |   final allUsers = await userService.getAll(); | ||||||
|   allUsers.removeWhere((u) => currentUser?.id == u.id); |   allUsers.removeWhere((u) => currentUser?.uid == u.uid); | ||||||
|   return allUsers; |   return allUsers; | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -314,7 +314,7 @@ class AssetService { | |||||||
|       await refreshRemoteAssets(); |       await refreshRemoteAssets(); | ||||||
|       final owner = _userService.getMyUser(); |       final owner = _userService.getMyUser(); | ||||||
|       final remoteAssets = await _assetRepository.getAll( |       final remoteAssets = await _assetRepository.getAll( | ||||||
|         ownerId: owner.id, |         ownerId: owner.uid, | ||||||
|         state: AssetState.merged, |         state: AssetState.merged, | ||||||
|       ); |       ); | ||||||
| 
 | 
 | ||||||
| @ -516,11 +516,11 @@ class AssetService { | |||||||
| 
 | 
 | ||||||
|   Future<List<Asset>> getRecentlyAddedAssets() { |   Future<List<Asset>> getRecentlyAddedAssets() { | ||||||
|     final me = _userService.getMyUser(); |     final me = _userService.getMyUser(); | ||||||
|     return _assetRepository.getRecentlyAddedAssets(me.id); |     return _assetRepository.getRecentlyAddedAssets(me.uid); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Future<List<Asset>> getMotionAssets() { |   Future<List<Asset>> getMotionAssets() { | ||||||
|     final me = _userService.getMyUser(); |     final me = _userService.getMyUser(); | ||||||
|     return _assetRepository.getMotionAssets(me.id); |     return _assetRepository.getMotionAssets(me.uid); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -38,7 +38,7 @@ class BackupVerificationService { | |||||||
| 
 | 
 | ||||||
|   /// Returns at most [limit] assets that were backed up without exif |   /// Returns at most [limit] assets that were backed up without exif | ||||||
|   Future<List<Asset>> findWronglyBackedUpAssets({int limit = 100}) async { |   Future<List<Asset>> findWronglyBackedUpAssets({int limit = 100}) async { | ||||||
|     final owner = _userService.getMyUser().id; |     final owner = _userService.getMyUser().uid; | ||||||
|     final List<Asset> onlyLocal = await _assetRepository.getAll( |     final List<Asset> onlyLocal = await _assetRepository.getAll( | ||||||
|       ownerId: owner, |       ownerId: owner, | ||||||
|       state: AssetState.local, |       state: AssetState.local, | ||||||
|  | |||||||
| @ -183,7 +183,7 @@ class SyncService { | |||||||
|         return false; |         return false; | ||||||
|       }, |       }, | ||||||
|       onlyFirst: (UserDto a) => toUpsert.add(a), |       onlyFirst: (UserDto a) => toUpsert.add(a), | ||||||
|       onlySecond: (UserDto b) => toDelete.add(b.id), |       onlySecond: (UserDto b) => toDelete.add(b.uid), | ||||||
|     ); |     ); | ||||||
|     if (changes) { |     if (changes) { | ||||||
|       await _userRepository.transaction(() async { |       await _userRepository.transaction(() async { | ||||||
| @ -222,7 +222,7 @@ class SyncService { | |||||||
|   ) async { |   ) async { | ||||||
|     final currentUser = _userService.getMyUser(); |     final currentUser = _userService.getMyUser(); | ||||||
|     final DateTime? since = |     final DateTime? since = | ||||||
|         (await _eTagRepository.get(currentUser.id))?.time?.toUtc(); |         (await _eTagRepository.get(currentUser.uid))?.time?.toUtc(); | ||||||
|     if (since == null) return null; |     if (since == null) return null; | ||||||
|     final DateTime now = DateTime.now(); |     final DateTime now = DateTime.now(); | ||||||
|     final (toUpsert, toDelete) = await getChangedAssets(users, since); |     final (toUpsert, toDelete) = await getChangedAssets(users, since); | ||||||
| @ -321,7 +321,7 @@ class SyncService { | |||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|     final List<Asset> inDb = await _assetRepository.getAll( |     final List<Asset> inDb = await _assetRepository.getAll( | ||||||
|       ownerId: user.id, |       ownerId: user.uid, | ||||||
|       sortBy: AssetSort.checksum, |       sortBy: AssetSort.checksum, | ||||||
|     ); |     ); | ||||||
|     assert(inDb.isSorted(Asset.compareByChecksum), "inDb not sorted!"); |     assert(inDb.isSorted(Asset.compareByChecksum), "inDb not sorted!"); | ||||||
| @ -427,15 +427,15 @@ class SyncService { | |||||||
|     // update shared users |     // update shared users | ||||||
|     final List<UserDto> sharedUsers = |     final List<UserDto> sharedUsers = | ||||||
|         album.sharedUsers.map((u) => u.toDto()).toList(growable: false); |         album.sharedUsers.map((u) => u.toDto()).toList(growable: false); | ||||||
|     sharedUsers.sort((a, b) => a.id.compareTo(b.id)); |     sharedUsers.sort((a, b) => a.uid.compareTo(b.uid)); | ||||||
|     final List<UserDto> users = dto.remoteUsers.map((u) => u.toDto()).toList() |     final List<UserDto> users = dto.remoteUsers.map((u) => u.toDto()).toList() | ||||||
|       ..sort((a, b) => a.id.compareTo(b.id)); |       ..sort((a, b) => a.uid.compareTo(b.uid)); | ||||||
|     final List<String> userIdsToAdd = []; |     final List<String> userIdsToAdd = []; | ||||||
|     final List<UserDto> usersToUnlink = []; |     final List<UserDto> usersToUnlink = []; | ||||||
|     diffSortedListsSync( |     diffSortedListsSync( | ||||||
|       users, |       users, | ||||||
|       sharedUsers, |       sharedUsers, | ||||||
|       compare: (UserDto a, UserDto b) => a.id.compareTo(b.id), |       compare: (UserDto a, UserDto b) => a.uid.compareTo(b.uid), | ||||||
|       both: (a, b) => false, |       both: (a, b) => false, | ||||||
|       onlyFirst: (UserDto a) => userIdsToAdd.add(a.id), |       onlyFirst: (UserDto a) => userIdsToAdd.add(a.id), | ||||||
|       onlySecond: (UserDto a) => usersToUnlink.add(a), |       onlySecond: (UserDto a) => usersToUnlink.add(a), | ||||||
| @ -622,7 +622,7 @@ class SyncService { | |||||||
|     // general case, e.g. some assets have been deleted or there are excluded albums on iOS |     // general case, e.g. some assets have been deleted or there are excluded albums on iOS | ||||||
|     final inDb = await _assetRepository.getByAlbum( |     final inDb = await _assetRepository.getByAlbum( | ||||||
|       dbAlbum, |       dbAlbum, | ||||||
|       ownerId: (_userService.getMyUser()).id, |       ownerId: (_userService.getMyUser()).uid, | ||||||
|       sortBy: AssetSort.checksum, |       sortBy: AssetSort.checksum, | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -30,12 +30,12 @@ class TimelineService { | |||||||
| 
 | 
 | ||||||
|   Future<List<String>> getTimelineUserIds() async { |   Future<List<String>> getTimelineUserIds() async { | ||||||
|     final me = _userService.getMyUser(); |     final me = _userService.getMyUser(); | ||||||
|     return _timelineRepository.getTimelineUserIds(me.id); |     return _timelineRepository.getTimelineUserIds(me.uid); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Stream<List<String>> watchTimelineUserIds() async* { |   Stream<List<String>> watchTimelineUserIds() async* { | ||||||
|     final me = _userService.getMyUser(); |     final me = _userService.getMyUser(); | ||||||
|     yield* _timelineRepository.watchTimelineUsers(me.id); |     yield* _timelineRepository.watchTimelineUsers(me.uid); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Stream<RenderList> watchHomeTimeline(String userId) { |   Stream<RenderList> watchHomeTimeline(String userId) { | ||||||
| @ -52,13 +52,13 @@ class TimelineService { | |||||||
|   Stream<RenderList> watchArchiveTimeline() async* { |   Stream<RenderList> watchArchiveTimeline() async* { | ||||||
|     final user = _userService.getMyUser(); |     final user = _userService.getMyUser(); | ||||||
| 
 | 
 | ||||||
|     yield* _timelineRepository.watchArchiveTimeline(user.id); |     yield* _timelineRepository.watchArchiveTimeline(user.uid); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Stream<RenderList> watchFavoriteTimeline() async* { |   Stream<RenderList> watchFavoriteTimeline() async* { | ||||||
|     final user = _userService.getMyUser(); |     final user = _userService.getMyUser(); | ||||||
| 
 | 
 | ||||||
|     yield* _timelineRepository.watchFavoriteTimeline(user.id); |     yield* _timelineRepository.watchFavoriteTimeline(user.uid); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Stream<RenderList> watchAlbumTimeline(Album album) async* { |   Stream<RenderList> watchAlbumTimeline(Album album) async* { | ||||||
| @ -71,7 +71,7 @@ class TimelineService { | |||||||
|   Stream<RenderList> watchTrashTimeline() async* { |   Stream<RenderList> watchTrashTimeline() async* { | ||||||
|     final user = _userService.getMyUser(); |     final user = _userService.getMyUser(); | ||||||
| 
 | 
 | ||||||
|     yield* _timelineRepository.watchTrashTimeline(user.id); |     yield* _timelineRepository.watchTrashTimeline(user.uid); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Stream<RenderList> watchAllVideosTimeline() { |   Stream<RenderList> watchAllVideosTimeline() { | ||||||
| @ -98,7 +98,7 @@ class TimelineService { | |||||||
|   Stream<RenderList> watchAssetSelectionTimeline() async* { |   Stream<RenderList> watchAssetSelectionTimeline() async* { | ||||||
|     final user = _userService.getMyUser(); |     final user = _userService.getMyUser(); | ||||||
| 
 | 
 | ||||||
|     yield* _timelineRepository.watchAssetSelectionTimeline(user.id); |     yield* _timelineRepository.watchAssetSelectionTimeline(user.uid); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   GroupAssetsBy _getGroupByOption() { |   GroupAssetsBy _getGroupByOption() { | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ class TrashService { | |||||||
| 
 | 
 | ||||||
|     await _apiService.trashApi.emptyTrash(); |     await _apiService.trashApi.emptyTrash(); | ||||||
| 
 | 
 | ||||||
|     final trashedAssets = await _assetRepository.getTrashAssets(user.id); |     final trashedAssets = await _assetRepository.getTrashAssets(user.uid); | ||||||
|     final ids = trashedAssets.map((e) => e.remoteId!).toList(); |     final ids = trashedAssets.map((e) => e.remoteId!).toList(); | ||||||
| 
 | 
 | ||||||
|     await _assetRepository.transaction(() async { |     await _assetRepository.transaction(() async { | ||||||
| @ -77,7 +77,7 @@ class TrashService { | |||||||
| 
 | 
 | ||||||
|     await _apiService.trashApi.restoreTrash(); |     await _apiService.trashApi.restoreTrash(); | ||||||
| 
 | 
 | ||||||
|     final trashedAssets = await _assetRepository.getTrashAssets(user.id); |     final trashedAssets = await _assetRepository.getTrashAssets(user.uid); | ||||||
|     final updatedAssets = trashedAssets.map((asset) { |     final updatedAssets = trashedAssets.map((asset) { | ||||||
|       asset.isTrashed = false; |       asset.isTrashed = false; | ||||||
|       return asset; |       return asset; | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ Widget userAvatar(BuildContext context, UserDto u, {double? radius}) { | |||||||
|     foregroundImage: CachedNetworkImageProvider( |     foregroundImage: CachedNetworkImageProvider( | ||||||
|       url, |       url, | ||||||
|       headers: ApiService.getRequestHeaders(), |       headers: ApiService.getRequestHeaders(), | ||||||
|       cacheKey: "user-${u.id}-profile", |       cacheKey: "user-${u.uid}-profile", | ||||||
|     ), |     ), | ||||||
|     // silence errors if user has no profile image, use initials as fallback |     // silence errors if user has no profile image, use initials as fallback | ||||||
|     onForegroundImageError: (exception, stackTrace) {}, |     onForegroundImageError: (exception, stackTrace) {}, | ||||||
|  | |||||||
| @ -125,7 +125,7 @@ void main() { | |||||||
|       when(() => userRepository.getAll()).thenAnswer((_) async => [owner]); |       when(() => userRepository.getAll()).thenAnswer((_) async => [owner]); | ||||||
|       when( |       when( | ||||||
|         () => assetRepository.getAll( |         () => assetRepository.getAll( | ||||||
|           ownerId: owner.id, |           ownerId: owner.uid, | ||||||
|           sortBy: AssetSort.checksum, |           sortBy: AssetSort.checksum, | ||||||
|         ), |         ), | ||||||
|       ).thenAnswer((_) async => initialAssets); |       ).thenAnswer((_) async => initialAssets); | ||||||
| @ -200,7 +200,7 @@ void main() { | |||||||
|       expect(c1, isTrue); |       expect(c1, isTrue); | ||||||
|       when( |       when( | ||||||
|         () => assetRepository.getAll( |         () => assetRepository.getAll( | ||||||
|           ownerId: owner.id, |           ownerId: owner.uid, | ||||||
|           sortBy: AssetSort.checksum, |           sortBy: AssetSort.checksum, | ||||||
|         ), |         ), | ||||||
|       ).thenAnswer((_) async => remoteAssets); |       ).thenAnswer((_) async => remoteAssets); | ||||||
| @ -213,7 +213,7 @@ void main() { | |||||||
|       final currentState = [...remoteAssets]; |       final currentState = [...remoteAssets]; | ||||||
|       when( |       when( | ||||||
|         () => assetRepository.getAll( |         () => assetRepository.getAll( | ||||||
|           ownerId: owner.id, |           ownerId: owner.uid, | ||||||
|           sortBy: AssetSort.checksum, |           sortBy: AssetSort.checksum, | ||||||
|         ), |         ), | ||||||
|       ).thenAnswer((_) async => currentState); |       ).thenAnswer((_) async => currentState); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user