mirror of
https://github.com/immich-app/immich.git
synced 2025-06-22 23:11:06 -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])) {
|
||||
sharedUsersList.value = sharedUsersList.value
|
||||
.where(
|
||||
(selectedUser) => selectedUser.id != users[index].id,
|
||||
(selectedUser) =>
|
||||
selectedUser.uid != users[index].uid,
|
||||
)
|
||||
.toSet();
|
||||
} else {
|
||||
|
@ -118,7 +118,8 @@ class AlbumSharedUserSelectionPage extends HookConsumerWidget {
|
||||
if (sharedUsersList.value.contains(users[index])) {
|
||||
sharedUsersList.value = sharedUsersList.value
|
||||
.where(
|
||||
(selectedUser) => selectedUser.id != users[index].id,
|
||||
(selectedUser) =>
|
||||
selectedUser.uid != users[index].uid,
|
||||
)
|
||||
.toSet();
|
||||
} else {
|
||||
|
@ -51,7 +51,7 @@ class ActivitiesPage extends HookConsumerWidget {
|
||||
final liked = data.firstWhereOrNull(
|
||||
(a) =>
|
||||
a.type == ActivityType.like &&
|
||||
a.user.id == user?.id &&
|
||||
a.user.uid == user?.uid &&
|
||||
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(),
|
||||
deleteEnabled: false,
|
||||
favoriteEnabled: false,
|
||||
|
@ -110,7 +110,7 @@ class PhotosPage extends HookConsumerWidget {
|
||||
: const SizedBox(),
|
||||
renderListProvider: timelineUsers.length > 1
|
||||
? multiUsersTimelineProvider(timelineUsers)
|
||||
: singleUserTimelineProvider(currentUser?.id),
|
||||
: singleUserTimelineProvider(currentUser?.uid),
|
||||
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?.id == u.id);
|
||||
allUsers.removeWhere((u) => currentUser?.uid == u.uid);
|
||||
return allUsers;
|
||||
});
|
||||
|
@ -314,7 +314,7 @@ class AssetService {
|
||||
await refreshRemoteAssets();
|
||||
final owner = _userService.getMyUser();
|
||||
final remoteAssets = await _assetRepository.getAll(
|
||||
ownerId: owner.id,
|
||||
ownerId: owner.uid,
|
||||
state: AssetState.merged,
|
||||
);
|
||||
|
||||
@ -516,11 +516,11 @@ class AssetService {
|
||||
|
||||
Future<List<Asset>> getRecentlyAddedAssets() {
|
||||
final me = _userService.getMyUser();
|
||||
return _assetRepository.getRecentlyAddedAssets(me.id);
|
||||
return _assetRepository.getRecentlyAddedAssets(me.uid);
|
||||
}
|
||||
|
||||
Future<List<Asset>> getMotionAssets() {
|
||||
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
|
||||
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(
|
||||
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.id),
|
||||
onlySecond: (UserDto b) => toDelete.add(b.uid),
|
||||
);
|
||||
if (changes) {
|
||||
await _userRepository.transaction(() async {
|
||||
@ -222,7 +222,7 @@ class SyncService {
|
||||
) async {
|
||||
final currentUser = _userService.getMyUser();
|
||||
final DateTime? since =
|
||||
(await _eTagRepository.get(currentUser.id))?.time?.toUtc();
|
||||
(await _eTagRepository.get(currentUser.uid))?.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.id,
|
||||
ownerId: user.uid,
|
||||
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.id.compareTo(b.id));
|
||||
sharedUsers.sort((a, b) => a.uid.compareTo(b.uid));
|
||||
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<UserDto> usersToUnlink = [];
|
||||
diffSortedListsSync(
|
||||
users,
|
||||
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,
|
||||
onlyFirst: (UserDto a) => userIdsToAdd.add(a.id),
|
||||
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
|
||||
final inDb = await _assetRepository.getByAlbum(
|
||||
dbAlbum,
|
||||
ownerId: (_userService.getMyUser()).id,
|
||||
ownerId: (_userService.getMyUser()).uid,
|
||||
sortBy: AssetSort.checksum,
|
||||
);
|
||||
|
||||
|
@ -30,12 +30,12 @@ class TimelineService {
|
||||
|
||||
Future<List<String>> getTimelineUserIds() async {
|
||||
final me = _userService.getMyUser();
|
||||
return _timelineRepository.getTimelineUserIds(me.id);
|
||||
return _timelineRepository.getTimelineUserIds(me.uid);
|
||||
}
|
||||
|
||||
Stream<List<String>> watchTimelineUserIds() async* {
|
||||
final me = _userService.getMyUser();
|
||||
yield* _timelineRepository.watchTimelineUsers(me.id);
|
||||
yield* _timelineRepository.watchTimelineUsers(me.uid);
|
||||
}
|
||||
|
||||
Stream<RenderList> watchHomeTimeline(String userId) {
|
||||
@ -52,13 +52,13 @@ class TimelineService {
|
||||
Stream<RenderList> watchArchiveTimeline() async* {
|
||||
final user = _userService.getMyUser();
|
||||
|
||||
yield* _timelineRepository.watchArchiveTimeline(user.id);
|
||||
yield* _timelineRepository.watchArchiveTimeline(user.uid);
|
||||
}
|
||||
|
||||
Stream<RenderList> watchFavoriteTimeline() async* {
|
||||
final user = _userService.getMyUser();
|
||||
|
||||
yield* _timelineRepository.watchFavoriteTimeline(user.id);
|
||||
yield* _timelineRepository.watchFavoriteTimeline(user.uid);
|
||||
}
|
||||
|
||||
Stream<RenderList> watchAlbumTimeline(Album album) async* {
|
||||
@ -71,7 +71,7 @@ class TimelineService {
|
||||
Stream<RenderList> watchTrashTimeline() async* {
|
||||
final user = _userService.getMyUser();
|
||||
|
||||
yield* _timelineRepository.watchTrashTimeline(user.id);
|
||||
yield* _timelineRepository.watchTrashTimeline(user.uid);
|
||||
}
|
||||
|
||||
Stream<RenderList> watchAllVideosTimeline() {
|
||||
@ -98,7 +98,7 @@ class TimelineService {
|
||||
Stream<RenderList> watchAssetSelectionTimeline() async* {
|
||||
final user = _userService.getMyUser();
|
||||
|
||||
yield* _timelineRepository.watchAssetSelectionTimeline(user.id);
|
||||
yield* _timelineRepository.watchAssetSelectionTimeline(user.uid);
|
||||
}
|
||||
|
||||
GroupAssetsBy _getGroupByOption() {
|
||||
|
@ -46,7 +46,7 @@ class TrashService {
|
||||
|
||||
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();
|
||||
|
||||
await _assetRepository.transaction(() async {
|
||||
@ -77,7 +77,7 @@ class TrashService {
|
||||
|
||||
await _apiService.trashApi.restoreTrash();
|
||||
|
||||
final trashedAssets = await _assetRepository.getTrashAssets(user.id);
|
||||
final trashedAssets = await _assetRepository.getTrashAssets(user.uid);
|
||||
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.id}-profile",
|
||||
cacheKey: "user-${u.uid}-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.id,
|
||||
ownerId: owner.uid,
|
||||
sortBy: AssetSort.checksum,
|
||||
),
|
||||
).thenAnswer((_) async => initialAssets);
|
||||
@ -200,7 +200,7 @@ void main() {
|
||||
expect(c1, isTrue);
|
||||
when(
|
||||
() => assetRepository.getAll(
|
||||
ownerId: owner.id,
|
||||
ownerId: owner.uid,
|
||||
sortBy: AssetSort.checksum,
|
||||
),
|
||||
).thenAnswer((_) async => remoteAssets);
|
||||
@ -213,7 +213,7 @@ void main() {
|
||||
final currentState = [...remoteAssets];
|
||||
when(
|
||||
() => assetRepository.getAll(
|
||||
ownerId: owner.id,
|
||||
ownerId: owner.uid,
|
||||
sortBy: AssetSort.checksum,
|
||||
),
|
||||
).thenAnswer((_) async => currentState);
|
||||
|
Loading…
x
Reference in New Issue
Block a user