Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix linked contact person updates

Neeraj Gupta865dc63fa732
diff --git a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart
index 1a8a1ffa89..27106abd79 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart
@@ -72,7 +72,6 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
String _inputName = "";
String? _selectedDate;
String? _email;
- bool _contactLinkEmailCleared = false;
bool _isPinned = false;
bool _hideFromMemories = false;
bool userAlreadyAssigned = false;
@@ -87,11 +86,13 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
int? get _currentUserIDToSave =>
currentUserIDForContactLinkEmail(_emailToSave);
+ bool get _contactLinkEmailChanged =>
+ widget.isEditing && _emailToSave != _trimEmptyToNull(person?.data.email);
+
bool get _shouldClearContactUserID =>
- widget.isEditing &&
- _contactLinkEmailCleared &&
+ _contactLinkEmailChanged &&
person?.data.userID != null &&
- _emailToSave == null;
+ _currentUserIDToSave == null;
bool get _shouldSetCurrentUserID =>
widget.isEditing &&
@@ -1262,13 +1263,8 @@ class _EmailSectionState extends State<_EmailSection> {
void _updateEmailField(String? newEmail) {
final saveOrEditPersonState = context
.findAncestorStateOfType<_SaveOrEditPersonState>()!;
- final clearedExistingEmail =
- saveOrEditPersonState.widget.isEditing &&
- _trimEmptyToNull(saveOrEditPersonState.person?.data.email) != null &&
- _trimEmptyToNull(newEmail) == null;
saveOrEditPersonState.setState(() {
saveOrEditPersonState._email = newEmail;
- saveOrEditPersonState._contactLinkEmailCleared = clearedExistingEmail;
});
}
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
index dff99b837b..252ae68efb 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
@@ -598,10 +598,11 @@ class _EditContactPageState extends State<EditContactPage> {
}
}
- if (updatedPersons.isNotEmpty) {
+ for (final updatedPerson in updatedPersons) {
Bus.instance.fire(
PeopleChangedEvent(
- person: updatedPersons.last,
+ type: PeopleEventType.saveOrEditPerson,
+ person: updatedPerson,
source: "edit_contact_link",
),
);