Merge pull request 'Added Last Name display and made it editable' (#145) from SEND015 into main
All checks were successful
ci/woodpecker/push/billing_fees Pipeline was successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/chain_gateway Pipeline was successful
ci/woodpecker/push/bff Pipeline was successful
ci/woodpecker/push/fx_oracle Pipeline was successful
ci/woodpecker/push/fx_ingestor Pipeline was successful
ci/woodpecker/push/ledger Pipeline was successful
ci/woodpecker/push/notification Pipeline was successful
ci/woodpecker/push/frontend Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/mntx_gateway Pipeline was successful
ci/woodpecker/push/payments_orchestrator Pipeline was successful

Reviewed-on: #145
This commit was merged in pull request #145.
This commit is contained in:
2025-12-24 16:08:40 +00:00
8 changed files with 118 additions and 43 deletions

View File

@@ -20,6 +20,14 @@ class AccountBase implements StorableDescribable {
DateTime get updatedAt => storable.updatedAt;
@override
String get name => describable.name;
String get fullName {
final first = describable.name.trim();
final last = lastName.trim();
if (last.isEmpty) return first;
if (first.isEmpty) return last;
return '$first $last';
}
@override
String? get description => describable.description;
@@ -32,7 +40,7 @@ class AccountBase implements StorableDescribable {
required this.lastName,
});
String get nameInitials => getNameInitials(describable.name);
String get nameInitials => getNameInitials(fullName);
AccountBase copyWith({
Describable? describable,

View File

@@ -203,6 +203,7 @@ class AccountProvider extends ChangeNotifier {
Future<Account?> update({
Describable? describable,
String? lastName,
String? locale,
String? avatarUrl,
String? notificationFrequency,
@@ -213,6 +214,7 @@ class AccountProvider extends ChangeNotifier {
final updated = await AccountService.update(
account!.copyWith(
describable: describable,
lastName: lastName,
avatarUrl: () => avatarUrl ?? account!.avatarUrl,
locale: locale ?? account!.locale,
),
@@ -250,10 +252,11 @@ class AccountProvider extends ChangeNotifier {
}
}
Future<Account?> resetUsername(String userName) async {
Future<Account?> resetUsername(String userName, {String? lastName}) async {
if (account == null) throw ErrorUnauthorized();
return update(
describable: account!.describable.copyWith(name: userName),
lastName: lastName ?? account!.lastName,
);
}