-
Notifications
You must be signed in to change notification settings - Fork 173
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
autocomplete: Introduce topic input autocomplete #627
Conversation
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.
Thanks @Khader-1! Generally this strategy looks good, modulo the comment already made in the chat thread. A few other high-level comments below.
9b465c3
to
f0b4a3c
Compare
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.
Thanks @gnprice! I have made some changes. Yet this still needs some tests. Some comments about things I am not so sure about are below. Any other notes or suggestions are welcome.
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.
Cool, thanks for the revision. Some high-level comments below, but broadly the strategy looks good — I think the main next step is to write tests for this, and to otherwise get it into shape for a non-draft PR.
One theme I notice in several places is that there's code that looks to have been copy-pasted from some similar existing code, but that hasn't been fully edited to reflect the differences. This occurs particularly in comments. I figure that's part of the draft state of this PR — but as part of revising this into non-draft status, please do read through your changes again to look for anything that doesn't fit what's happening around it, particularly comments, and update those.
Similarly, there are several places with excess indentation, double blank lines, or other formatting nits; so please give the code a reread looking for those.
fa64db7
to
b6c64d4
Compare
964eb9f
to
e3d5933
Compare
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.
Thank you @Khader-1 for all the work on this. The generic approach seems promising. Added a few comments, mostly small. And, it would be better to see this PR rebased on the main for the next revision as some changes happened in MentionAutocompleteView
in #693 being merged.
Also, the following commits fail the tests (need to pass):
4a34f33
to
bb33514
Compare
Thanks @sm-sayedi! you're comments are really helpful! |
bb33514
to
a33ea7b
Compare
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.
Thanks for the revision. Two comments below.
a33ea7b
to
dfcf5af
Compare
Thanks @sm-sayedi! I've pushed a new revision PTAL. |
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.
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.
good stuff
Thanks! Looks like there's a conflict from the just-merged #805. I think you can resolve by skipping this commit:
and using Separately, if you get some test failures about |
591b2e1
to
71f1128
Compare
Thanks @chrisbobbe! I've resolved with a new revision. PTAL |
Thanks! Marking as ready for Greg's review. |
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.
Thanks @Khader-1, and thanks @sm-sayedi and @chrisbobbe for the previous reviews!
For this round, I've read the first two commits:
c6d3ae1 autocomplete [nfc]: Rename Autocomplete to ComposeContentAutocomplete
28c2694 autocomplete [nfc]: Factor out generic AutocompleteView
Comments on those below. I think some of the comments are likely to apply also to the third commit:
b2f9e5c autocomplete [nfc]: Factor out generic AutocompleteField
so please try to revise that as well where these comments relate to it.
71f1128
to
b34f5c4
Compare
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.
Thanks for the revision! Comments below.
For this round, I've read through these three commits:
265ad97 autocomplete [nfc]: Rename Autocomplete to ComposeContentAutocomplete
7d9cc85 autocomplete [nfc]: Factor out generic AutocompleteView
beaf4e2 autocomplete: Setup stream topics API binding
and part of these two:
7c24173 autocomplete [nfc]: Factor out generic AutocompleteField
b34f5c4 autocomplete: Implement targeted topic autocomplete
I think those latter two will be easier to read after acting on a couple of my comments below.
b34f5c4
to
223e3fe
Compare
Thanks @gnprice! I've pushed a new revision PTAL. |
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.
Thanks for the revision! Comments below. In this round I got through the whole PR.
7cb5a30
to
ee3f0fa
Compare
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.
Thanks for the revision! This is quite close now. Just small comments below, and a couple of subthreads remain open from above — #627 (comment) as noted below, and #627 (comment) where I replied above.
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import '../core.dart'; | ||
part 'channels.g.dart'; |
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.
Cool, this is a lot closer:
api: Set up stream topics API binding
Let's specifically match previous commits that added new endpoint bindings, though. Here's a command that shows those (as well as a few other matches):
$ git log --oneline lib/api/route | grep -vw nfc
So in particular
6d9f22d api: Add markAllAsRead, markStreamAsRead, and markTopicAsRead routes
dfcc6ca api: Add updateMessageFlags and updateMessageFlagsForNarrow routes
b8290cd api: Add routes registerFcmToken, registerApnsToken
For this, let's then say "api: Add route getStreamTopics".
} | ||
|
||
@override | ||
Iterable<String> getSortedItemsToTest(TopicAutocompleteQuery query) => _topics; |
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 think you already know this is still open, but bumping just so this remains visible in the new review)
ee3f0fa
to
21f4cd0
Compare
Thanks @gnprice! I've pushed a new revision PTAL. |
93457aa
to
b3f111e
Compare
The name Autocomplete is too generic and it collides with flutter's material Autocomplete widget name. So this uses the more specific name 'ComposeContentAutocomplete'.
The mechanism of query and results is generic to the idea of autocomplete in general, it's not specific to autocomplete on @-mentions vs. topics vs. anything else.
Most of the logic in `ComposeAutocomplete` is not specific to the content input it self rather it is general logic that applies to any autocomplete field.
The filtering logic (in [TopicAutocompleteQuery.testTopic]) differs from zulip-mobile but agrees with web. Details at: zulip#627 (comment) Fixes: zulip#310
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.
Thanks for the revision! Everything looks good now, with a couple of nits below; I'll fix those and merge.
I also tweaked the main commit's summary line:
- autocomplete: Implement targeted topic autocomplete
+ autocomplete: Add autocomplete for topic to send to
because "targeted" sounded to me like it was a kind of autocomplete that was somehow "targeted". I think what you intended was instead that the topic was "targeted", as in being the topic the draft message is aimed toward, so reworded to hopefully make that clearer.
} | ||
|
||
@override | ||
Iterable<String> getSortedItemsToTest(TopicAutocompleteQuery query) => _topics; |
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.
Cool. Verifying the existing server's behavior isn't enough in itself, because that doesn't guarantee the server won't change behavior later… but that thread now also has Tim's agreement that we intend that as part of the API, and an intention to write it down in the docs. So that means we can rely on it for the future too.
TopicAutocompleteQuery(super.raw); | ||
|
||
bool testTopic(String topic) { | ||
return topic != raw && topic.toLowerCase().contains(raw.toLowerCase()); |
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.
bump on one part of #627 (comment) : adding a TODO(#881)
comment
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.
Also I added a few words to the commit message saying we picked web's behavior over zulip-mobile's, and linking to this subthread.
b3f111e
to
046ceab
Compare
Fixes: #310
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-07-11.at.10.38.47.mp4