fix: user profile images not working in beta timeline (#20203)

* fix user icons in album view

* revert updateUsersV1 change

* fix: UserDto merge issues

* fix: update user entity

* revert what I thought were merge issues

turns out drift cant figure out when it needs to gen a file...

* fix removed line

* handle defaults for older servers

* feat: checkpoint migrations

* fix: use parenthesis instead of brackets

* Update 1753800911775-ProfileImageCheckpointRemoval.ts

* fix: sync stream updateUsersV1
This commit is contained in:
Brandon Wees
2025-07-30 11:09:28 -05:00
committed by GitHub
parent da5deffd03
commit 097e132fba
29 changed files with 7069 additions and 282 deletions
@@ -98,7 +98,7 @@ void main() {
group('createProfileImage', () {
test('should return profile image path', () async {
const profileImagePath = 'profile.jpg';
final updatedUser = UserStub.admin.copyWith(profileImagePath: profileImagePath);
final updatedUser = UserStub.admin;
when(
() => mockUserApiRepo.createProfileImage(name: profileImagePath, data: Uint8List(0)),
@@ -115,7 +115,7 @@ void main() {
test('should return null if profile image creation fails', () async {
const profileImagePath = 'profile.jpg';
final updatedUser = UserStub.admin.copyWith(profileImagePath: profileImagePath);
final updatedUser = UserStub.admin;
when(
() => mockUserApiRepo.createProfileImage(name: profileImagePath, data: Uint8List(0)),
+4 -1
View File
@@ -7,6 +7,7 @@ import 'schema_v1.dart' as v1;
import 'schema_v2.dart' as v2;
import 'schema_v3.dart' as v3;
import 'schema_v4.dart' as v4;
import 'schema_v5.dart' as v5;
class GeneratedHelper implements SchemaInstantiationHelper {
@override
@@ -20,10 +21,12 @@ class GeneratedHelper implements SchemaInstantiationHelper {
return v3.DatabaseAtV3(db);
case 4:
return v4.DatabaseAtV4(db);
case 5:
return v5.DatabaseAtV5(db);
default:
throw MissingSchemaException(version, versions);
}
}
static const versions = const [1, 2, 3, 4];
static const versions = const [1, 2, 3, 4, 5];
}
File diff suppressed because it is too large Load Diff
+18 -2
View File
@@ -4,12 +4,28 @@ import 'package:openapi/api.dart';
abstract final class SyncStreamStub {
static final userV1Admin = SyncEvent(
type: SyncEntityType.userV1,
data: SyncUserV1(deletedAt: DateTime(2020), email: "admin@admin", id: "1", name: "Admin", avatarColor: null),
data: SyncUserV1(
deletedAt: DateTime(2020),
email: "admin@admin",
id: "1",
name: "Admin",
avatarColor: null,
hasProfileImage: false,
profileChangedAt: DateTime(2025),
),
ack: "1",
);
static final userV1User = SyncEvent(
type: SyncEntityType.userV1,
data: SyncUserV1(deletedAt: DateTime(2021), email: "user@user", id: "5", name: "User", avatarColor: null),
data: SyncUserV1(
deletedAt: DateTime(2021),
email: "user@user",
id: "5",
name: "User",
avatarColor: null,
hasProfileImage: false,
profileChangedAt: DateTime(2025),
),
ack: "5",
);
static final userDeleteV1 = SyncEvent(
+3 -3
View File
@@ -10,7 +10,7 @@ abstract final class UserStub {
name: "admin",
isAdmin: true,
updatedAt: DateTime(2021),
profileImagePath: null,
profileChangedAt: DateTime(2021),
avatarColor: AvatarColor.green,
);
@@ -20,7 +20,7 @@ abstract final class UserStub {
name: "user1",
isAdmin: false,
updatedAt: DateTime(2022),
profileImagePath: null,
profileChangedAt: DateTime(2022),
avatarColor: AvatarColor.red,
);
@@ -30,7 +30,7 @@ abstract final class UserStub {
name: "user2",
isAdmin: false,
updatedAt: DateTime(2023),
profileImagePath: null,
profileChangedAt: DateTime(2023),
avatarColor: AvatarColor.primary,
);
}
@@ -66,7 +66,14 @@ void main() {
final MockPartnerRepository partnerRepository = MockPartnerRepository();
final MockUserService userService = MockUserService();
final owner = UserDto(id: "1", updatedAt: DateTime.now(), email: "a@b.c", name: "first last", isAdmin: false);
final owner = UserDto(
id: "1",
updatedAt: DateTime.now(),
email: "a@b.c",
name: "first last",
isAdmin: false,
profileChangedAt: DateTime(2021),
);
late SyncService s;
setUpAll(() async {
WidgetsFlutterBinding.ensureInitialized();