Skip to content
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

Add streams to PerAccountStore #139

Merged
merged 4 commits into from
Jun 1, 2023
Merged

Conversation

gnprice
Copy link
Member

@gnprice gnprice commented May 31, 2023

Fixes: #136

@gnprice gnprice added the a-model Implementing our data model (PerAccountStore, etc.) label May 31, 2023
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good except a question on isWebPublic; see below.

final int? firstMessageId;

final bool inviteOnly;
final bool isWebPublic;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In Subscription we say this:

final bool? isWebPublic; // TODO(server-??): doc doesn't say when added

and the API doc is the same for this property on streams[] and on subscriptions[]:

Whether the stream has been configured to allow unauthenticated access to its message history from the web.

Do we think the same TODO might apply here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, good catch, thanks.

In addition to the TODO, there's the making it optional — so in Subscription.isWebPublic it looks like we figured it may be newer than the oldest server version we're supporting.

However, for stream objects there is a mention in the overall API changelog, back in server-2.1:
https://zulip.com/api/changelog#changes-in-zulip-21

Added is_web_public field to Stream objects. This field is intended to support web-public streams.

That's back in the early period of the changelog and the API docs, when we weren't as systematic about having a changelog entry and a "Changes:" note for each API change.

So I think the conclusion is that it's always present on streams for the servers we support. Which means the same is probably true of subscriptions, but it's not documented.

Copy link
Member Author

Choose a reason for hiding this comment

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

(I'll add a comment)

gnprice added 4 commits May 31, 2023 17:15
The Zulip API docs lack good links for specific elements of the
initial-snapshot data at /api/register-queue .  But we can provide
the link to the page, and search strings that work within it.
This type is long enough to kind of push the limit for manually
comparing the docs to the type when they're not in the same order.
But in practice for future updates to it I think we can rely on
reading through its API docs for "Changes" notes.

And meanwhile, even within the API docs the `subscriptions` and the
`streams` lists don't agree on the order of the fields, even among
those they have in common.  So we might as well give up on matching
them and go for a logical order instead.
@gnprice gnprice force-pushed the pr-streams-data branch from 6d2bc64 to 6b8ecb3 Compare June 1, 2023 00:22
@gnprice
Copy link
Member Author

gnprice commented Jun 1, 2023

Pushed a revision, with that comment and a couple of additional NFC commits; please take a look.

@chrisbobbe
Copy link
Collaborator

Looks good, thanks! Merging.

@chrisbobbe chrisbobbe merged commit 9520c92 into zulip:main Jun 1, 2023
gnprice added a commit to gnprice/zulip-flutter that referenced this pull request Jun 1, 2023
This should have gone along with the reordering in 393d842 / zulip#139,
oops.
@gnprice gnprice deleted the pr-streams-data branch June 1, 2023 00:33
chrisbobbe pushed a commit that referenced this pull request Jun 1, 2023
This should have gone along with the reordering in 393d842 / #139,
oops.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-model Implementing our data model (PerAccountStore, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add streams to PerAccountStore, with a map keyed by stream ID
2 participants