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