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
future: Convert subject -> topic in webapp/backend code. #10806
Conversation
What you're thinking around Because aside from that, I feel like from an API-readability standpoint, |
zerver/lib/topic.py
Outdated
def messages_for_topic(stream_id: int, topic_name: str) -> QuerySet: | ||
return Message.objects.filter( | ||
recipient__type_id=stream_id, | ||
subject=topic_name, |
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 do this as a new commit on top since the old code was wrong in the same way, but this function is incorrect; it should be subject__icontains=
.
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 am not really sure why you think this should be "icontains". I added a comment to that effect for now. I can deal with this in the second round of edits if you give me a bit more context (and I may change the name of the function to something more like messages_containing_topic
.
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.
Oh, I meant iexact
.
Generally looks pretty good; I posted a bunch of small comments. |
I'm changing "topic_name" to "topic" per your suggestion, then I'm going through the inline comments. |
ab8ab96
to
afad414
Compare
This is ready for the second round of review. The first 20 commits were in your first review--I may add more later this morning that you haven't seen yet. The only thing I have a question about is your |
I swept the tests for "subject." I tried to be pretty thoughtful about not making tests "too easy to pass" if we change things. Most tests that use "subject" are just using it in passing. The tests that actually focus on the name "subject", whether it's an event or the DB model, are a bit vulnerable to false positives, but I think even most of those are basically valid if we do sane things during the migration. |
e6cb089
to
b59a36e
Compare
The last bunch of lint commits are to speed up lint, and I can probably move them to another PR if that helps. It was helpful to split out functions when I was profiling why it's slow, so that's why some commits just do extractions. The current bottlenecks is actual calls to
|
6f723b8
to
4dfb57f
Compare
@showell this is great. I merged a bunch of things, and then stopped in two places:
(I think you should be able to easily rebase cleanly). Include Eeshan in any discussion on the API stuff. |
4dfb57f
to
5b50524
Compare
5b50524
to
1dd56d3
Compare
I fixed the linter. I kinda hate having that code just sitting there and bitrotting till we release our linter, but it's two lines, so whatever. For the API stuff, I avoided touching the pieces that get excerpted to docs. If you look at the code and my diff, you'll see it's fairly easy to see what's safe. |
Here's the remaining use of "subject" in the API code (cause it's wrapped for doc magic): # {code_example|start}
# Send a stream message
request = {
"type": "stream",
"to": "Denmark",
"subject": "Castle",
"content": "I come not, friends, to steal away your hearts."
}
result = client.send_message(request)
# {code_example|end} |
1dd56d3
to
97f0945
Compare
I've added some JS-side cleanups as well. The last of those is probably the most non-trivial of them. |
FWIW, Zev and I did some work at a hackathon a couple months ago on extracting and releasing the linter, and probably the work could be finished in about a day. So it isn't a totally abstract concept. |
17dcddc
to
6f56019
Compare
Makes sense. I merged all but the last 2 commits as the series ending in 6546fb3. |
6f56019
to
4145183
Compare
4145183
to
b8ca9e0
Compare
For the compose things, what do you think about calling the HTML elements |
(I merged the other commits on here). |
b8ca9e0
to
47e1bb7
Compare
The first two commits here are ready to merge. They're both a bit more involved than many of the commits leading up to this that you already merged, @timabbott, but nothing too risky/controversial as far as I can tell. |
47e1bb7
to
1c38938
Compare
(Holding off on merging this until we get the |
1c38938
to
04dbf3e
Compare
This is still just a proof of concept, but we try to at least get all tests passing with fairly minimal effort. Not so sure about fix_unreads here.
04dbf3e
to
b6c54a7
Compare
There's still a lot of work to do before we can merge the commit here, but the goal is to get here. |
Heads up @showell, we just merged some commits that conflict with the changes your 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 |
No description provided.