-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop three User fields we aren't keeping up to date; verify that's all #876
Conversation
lib/model/store.dart
Outdated
@@ -465,6 +465,10 @@ class PerAccountStore extends ChangeNotifier with ChannelStore, MessageStore { | |||
if (user == null) { | |||
return; // TODO log | |||
} | |||
// Fields on [User] not updated here: | |||
// userId, dateJoined, isBot, botType, isSystemBot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to have a reference on User
, so that we remember to update this comment when there is another immutable field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the more important case is when adding a mutable field, so that we add the code to update it.
Anyway, switched to a comment on User
, in conjunction with making the immutable fields final
.
lib/model/store.dart
Outdated
// Fields on [User] not updated here: | ||
// userId, dateJoined, isBot, botType, isSystemBot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about also making these immutable fields final
?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, thanks. Switched to that.
b30bfa7
to
429fa9e
Compare
These are obsoleted by [User.role] (which dates to Zulip 4.0). We never looked at these fields, but had a latent bug because we weren't keeping them up to date on RealmUserUpdateEvent. To fix the bug, just stop having the fields around at all. (Later if we find we want booleans with these handy names, we can always add getters that just inspect [User.role].)
This was prompted by noticing recently that we weren't updating [User.isActive]: zulip#816 (comment) After fixing that, I looked and found there were actually three other fields on User which we weren't updating -- a latent bug, since we never looked at those fields, but a bug. Fixed that in the preceding commit. Now the remaining fields that don't get updated are fields that really are immutable on a Zulip user. Mark those as final, and add a comment to help maintain the pattern.
429fa9e
to
156c693
Compare
Thanks, LGTM! Merged. |
This was prompted by noticing recently that we weren't updating
[User.isActive]:
#816 (comment)
(/cc @sm-sayedi)
After we fixed that, I looked and found there were actually three
other fields on User which we weren't updating -- a latent bug,
since we never looked at those fields, but a bug. Fix that.
Then add a comment showing my work on verifying that that's it,
and giving us a head start on re-verifying that in the future
with whatever's changed in the API between now and then.