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

refactor: Clarify draft types & naming #924

Merged

Conversation

neiljp
Copy link
Collaborator

@neiljp neiljp commented Feb 15, 2021

Previously a draft was a Message, which is a much more complex data
structure received from the server with differently-named fields. The
draft system only requires the data which is subsequently sent via
the send_message API call, so a simpler API-specific set of data
structures are created and used for drafts named ~ Composition.

Other than typing, the new data structures allow space to define where
we wish to move to use newer API forms (ids vs strings) in future. An
extra 'stream_id' field is present in StreamComposition, not present in
the API, until we migrate to use IDs.

To emphasize the message/draft distinction and migration, variable names
are also updated to match.

Previously a draft was a Message, which is a much more complex data
structure received from the server with differently-named fields. The
draft system only requires the data which is subsequently sent via
the send_message API call, so a simpler API-specific set of data
structures are created and used for drafts named ~ Composition.

Other than typing, the new data structures allow space to define where
we wish to move to use newer API forms (ids vs strings) in future. An
extra 'stream_id' field is present in StreamComposition, not present in
the API, until we migrate to use IDs.

To emphasize the message/draft distinction and migration, variable names
are also updated to match.
@zulipbot zulipbot added the size: L [Automatic label added by zulipbot] label Feb 15, 2021
@neiljp neiljp merged commit 306a394 into zulip:main Feb 15, 2021
@neiljp neiljp added this to the Next Release milestone Feb 15, 2021
@zulipbot
Copy link
Member

Hello @zulip/server-refactoring members, this pull request was labeled with the "area: refactoring" label, so you may want to check it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: refactoring size: L [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants