Skip to content

store: Update streams and subscriptions on stream-create/delete events #183

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

Merged
merged 3 commits into from
Jun 14, 2023

Conversation

chrisbobbe
Copy link
Collaborator

Also, add addStream / addStreams helpers to PerAccountStoreTestExtension. We'll use those soon, to write tests for message-link creation for quote-and-reply.

Fixes: #181
Related: #182

@chrisbobbe chrisbobbe added a-api Implementing specific parts of the Zulip server API a-model Implementing our data model (PerAccountStore, etc.) labels Jun 14, 2023
@chrisbobbe chrisbobbe requested a review from gnprice June 14, 2023 19:43
@chrisbobbe
Copy link
Collaborator Author

I'm not sure if I've followed the right ordering in the added code—in lib/api/model, I've tried to follow the API doc; in lib/model, I've tried to follow lib/api/model/model.dart.

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! All LGTM with a suggestion on the ordering.

I'm not sure if I've followed the right ordering in the added code—in lib/api/model, I've tried to follow the API doc; in lib/model, I've tried to follow lib/api/model/model.dart.

Yeah. In lib/api/model/events.dart I originally wanted to follow the ordering in the API doc… until I went to implement the realm_user events. Search the page for "realm_user op:" and you'll see why: realm_user/update events are way up near the top, while realm_user/add and realm_user/remove events come quite a bit later. In between are message, several flavors of subscription, and others.

I definitely wanted the different op values for a given type to be together, so it wasn't going to work to stick to the docs' ordering.

That means that in order to compare the lists for completeness we'll need to do something else anyway. So we might as well put the events in an order that makes sense to us semantically.

Given that, I'd put these event types in events.dart in the same order as you have them in handleEvent. More generally, I'd go for the same broad order as in lib/api/model/model.dart, which is also the one in zulip-mobile's src/api/modelTypes.js:

  • first info about the realm as a whole,
  • then about users,
  • then about streams and subscriptions,
  • then about messages.

@chrisbobbe chrisbobbe force-pushed the pr-stream-create-delete-events branch from ac17901 to 245f296 Compare June 14, 2023 21:40
@chrisbobbe
Copy link
Collaborator Author

Makes sense! Thanks for the review; revision pushed.

@gnprice gnprice force-pushed the pr-stream-create-delete-events branch from 245f296 to 4e11ea7 Compare June 14, 2023 21:42
@gnprice
Copy link
Member

gnprice commented Jun 14, 2023

Thanks! Merging.

@gnprice gnprice merged commit 4e11ea7 into zulip:main Jun 14, 2023
@chrisbobbe chrisbobbe deleted the pr-stream-create-delete-events branch June 14, 2023 21:43
chrisbobbe added a commit to chrisbobbe/zulip-flutter that referenced this pull request Jul 3, 2023
Technically maxFileUploadSizeMib is for the whole server, I think,
but it seems fine to treat it as realm info for the purpose of
ordering these.

See Greg's bulleted list here:
  zulip#183 (review)
gnprice pushed a commit to chrisbobbe/zulip-flutter that referenced this pull request Jul 5, 2023
Technically maxFileUploadSizeMib is for the whole server, I think,
but it seems fine to treat it as realm info for the purpose of
ordering these.

See Greg's bulleted list here:
  zulip#183 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-api Implementing specific parts of the Zulip server API a-model Implementing our data model (PerAccountStore, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle created/deleted streams (stream op: create and stream op: delete events)
2 participants