Skip to content

Commit

Permalink
api: Add isActive to RealmUserUpdateEvent
Browse files Browse the repository at this point in the history
This will become handy in the next commit(s) where we want to change the UI
based on `User.isActive` when having a DM conversation.
  • Loading branch information
sm-sayedi committed Jul 18, 2024
1 parent 7285325 commit a038e72
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/api/model/events.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ class RealmUserUpdateEvent extends RealmUserEvent {

@JsonKey(readValue: _readFromPerson) final RealmUserUpdateCustomProfileField? customProfileField;
@JsonKey(readValue: _readFromPerson) final String? newEmail;
@JsonKey(readValue: _readFromPerson) final bool? isActive;

static Object? _readFromPerson(Map<dynamic, dynamic> json, String key) {
return (json['person'] as Map<String, dynamic>)[key];
Expand Down Expand Up @@ -318,6 +319,7 @@ class RealmUserUpdateEvent extends RealmUserEvent {
this.deliveryEmail,
this.customProfileField,
this.newEmail,
this.isActive,
});

factory RealmUserUpdateEvent.fromJson(Map<String, dynamic> json) =>
Expand Down
3 changes: 3 additions & 0 deletions lib/api/model/events.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/model/store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ class PerAccountStore extends ChangeNotifier with StreamStore, MessageStore {
if (event.isBillingAdmin != null) user.isBillingAdmin = event.isBillingAdmin!;
if (event.deliveryEmail != null) user.deliveryEmail = event.deliveryEmail!.value;
if (event.newEmail != null) user.email = event.newEmail!;
if (event.isActive != null) user.isActive = event.isActive!;
if (event.customProfileField != null) {
final profileData = (user.profileData ??= {});
final update = event.customProfileField!;
Expand Down

0 comments on commit a038e72

Please sign in to comment.