-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
[WIP] Migrate message['subject'] to message['topic'] #1236
base: main
Are you sure you want to change the base?
Conversation
Hello @zulip/server-refactoring members, this pull request was labeled with the "area: refactoring" label, so you may want to check it out! |
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.
@mounilKshah You have the right ideas here, but as per my stream feedback, it's good to keep code changes and associated test changes in the same commit.
In addition, you've got multiple changes here, which ideally would be in different commits. Part of that is that the main subject->topic migration is split into Message and Composition parts, ie. what we receive from the server vs what a user sends. However, the other aspect are API changes that have similar names but haven't necessarily changed, or that are adjacent. It's fine to make these changes, but it would be cleaner to see each change in a separate commit.
Each API change may be in a different version, so that opens up the scope for writing differently about the change, when it occurred, etc. in the commit text body.
zulipterminal/api_types.py
Outdated
@@ -21,8 +21,8 @@ class PrivateComposition(TypedDict): | |||
class StreamComposition(TypedDict): | |||
type: Literal["stream"] | |||
content: str | |||
to: str # stream name # TODO: Migrate to using int (stream id) | |||
subject: str # TODO: Migrate to using topic | |||
to: Optional[int] |
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.
This is a separate migration. It may be OK in this PR, but certainly in another commit.
zulipterminal/api_types.py
Outdated
to: str # stream name # TODO: Migrate to using int (stream id) | ||
subject: str # TODO: Migrate to using topic | ||
to: Optional[int] | ||
topic: str |
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.
As per a comment in the stream, it may be cleaner to separate the compose and message parts of the topic migration into separate commits (with associated test changes in each).
zulipterminal/api_types.py
Outdated
subject: str | ||
# Changing subject -> topic as per the migration in Zulip 2.0 | ||
topic: str # Only for stream msgs. |
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.
I'd suggest we comment out the subject, with a trailing comment referring to the migration.
In an ideal world that would mean using subject would cause a type error, but currently this TypedDict has total=False, so that won't happen (yet).
zulipterminal/api_types.py
Outdated
@@ -53,7 +55,7 @@ class Message(TypedDict, total=False): | |||
avatar_url: str | |||
content_type: str | |||
match_content: str # If keyword search specified in narrow params. | |||
match_subject: str # If keyword search specified in narrow params. | |||
match_topic: str # If keyword search specified in narrow params. |
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 you have support for this migration?
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.
No. As subject
was changed to topic
, I felt it would be good to rename this accordingly. But as the API is still the same, I'll retain the original names for this and orig_topic
zulipterminal/api_types.py
Outdated
orig_topic: str | ||
topic: str |
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 you have support for this migration in the API?
This commit contains migration for message["subject"] to message ["topic"] as per the modern API with the oldest support being v2.1. It also contains the updated tests for the migration.
b4de153
to
57df32e
Compare
@mounilKshah I left some answers in the stream; do you need further feedback before the tests are updated? |
@mounilKshah Thanks for investigating this! I left a message in the stream, but for other readers also:
|
Heads up @mounilKshah, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the |
What does this PR do?
This commit migrates the ZT to newer API elements. Here, the migration is from message['subject'] to message['topic'].
Partial fix for #965
Discussion:
#zulip-terminal>Update to modern API elements (support v2.1) #T965
Tested?
Commit flow
subject
totopic
Notes & Questions