-
-
Notifications
You must be signed in to change notification settings - Fork 670
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
PMs screen doesn't show many conversations #3133
Comments
With in part this issue in mind, the Zulip backend as of Zulip 1.9 added a nice database index for PMs that a given user has received; so we can very quickly do queries on that data. The really dumb version that could be done with the API today would be to do a (Until the database index work in 1.9, this would have been prohibitively expensive, since we'd need to scan all messages to find enough PMs, which for low-PM users in an organization with a lot of streams traffic could have easily involved the database needing to look at 50K+ messages of history and thus adding 100sms of latency). I don't think this data set would need unreads data, since the client should have that and be able to splice it in directly and it's probably cleaner to have one source of truth there, but it wouldn't be hard to include. |
Yeah, indeed the mobile app does not need the unread data. One of the bug that @rishig encountered was that he knew there were unread PMs (correctly) but couldn't see them because of the 100 messages limit. It would be great to return the first message's raw content in the response for each PM entry so we can include a 'conversation preview' in the list like most other apps do. |
OK; the message raw content feature would be some extra work (it will probably require an extra DB query and thus have a small perf impact) but not too much. That probably suggests we should use a dict data structure, not a tuple, e.g.
In any case, I'd probably want to start with a v1 that just provides the data needed for doing the current UI correctly, and then extend from there. |
@timabbott This sounds good to me! And that format looks good. I think including the data in One optimization: I think we probably want a bound on the number of conversations represented, as well as the number of PMs. E.g., the last <=20 conversations found in the last <=1000 (as you suggested) PMs. That just saves some network traffic, and client-side processing, in extreme cases where the user has tons of different short PM conversations. (With SQL cleverness, perhaps the savings can even extend all the way to the database, but that isn't essential.) What's a good next step -- should we open an issue on the server repo? |
Yes, that's a good next step. I think the query we'll want is roughly |
I opened the serve issue for this as zulip/zulip#11944 |
I spent this afternoon/evening building the backend that the mobile app will need for this in zulip/zulip#11946. I want to add some unit tests and get some opinions on the "recent_conversations" name, since I'm worried it's ambiguous and should instead be something that explicitly mentions private messages. In any case, I've test-deployed that PR on chat.zulip.org, so you should be able to start fetching these data by passing the "recent_conversations" event type in the app's list of requested event types. The data structure for
Each row has a 3 attributes:
After fetching, clients will need to correctly maintain these data structures as new messages are sent or deleted (Though for deleted, probably you can just not worry about it too much? Unclear). |
Awesome, thanks!
I agree -- In general I like using "conversation" to mean basically a thread, or the smallest unit it makes sense to narrow to and reply to: it's either
Perhaps it'd be helpful to call it Separately: how does this behave for the user's PM thread with themself?
Hmm -- yeah, I think the server "recipient" concept may not be exposed in the API at all right now. So adding one place that refers to it is potentially confusing. Do these correspond bijectively to values of Of if they don't correspond bijectively with
Hmm -- yeah, in fact we can't in general maintain them exactly on deletion. If the message that was latest is deleted, we don't know what the next-latest would be. I think it's OK for us to just say that the semantics of our data structure are slightly relaxed: |
I haven't tested this with the current code, but if I had to guess, it'll include that recipient_id if there are recent messages, and have an empty list of
Yes, it's bijective with sets of user_ids as long as we're in a PM context (for a stream message, it's bijective with stream IDs). It's useful for server internals to have them in the intermediate form we use to make
Yeah, that's what I had in mind as well. So to summarize, we should:
|
Yeah, that seems like the right behavior to me. It'd be good to pin down what it in fact does. :-) In particular I think we've had bits of hairy logic where for the self-PM thread, in some interface or data structure,
Cool, sgtm then. |
I fixed the couple naming/structure changes we had planned for zulip/zulip#11946. Also tested self-PMs: the current behavior of the backend PR for self-PMs is that it will never return them. I think I know how to fix this; I'll make a quick attempt at that and then go from there. |
OK, I've successfully implemented self-PMs as giving |
And merged zulip/zulip#11946, so this should now be ready for mobile app side implementation to take advantage of it; you just need the @gnprice while doing this I added a comment in the |
I've just gone back through Isham's PR #3535 from mid-last year, and rebased it and revised to address most of the comments I had when I last reviewed it. At this point I think the main thing it needs is to take care that we're correctly handling the different forms of ways we identify a PM thread, in our codebase and in the Zulip server API. That's been an ongoing background need; I've just filed #4035 to describe it specifically. |
The PMs screen shows the PM conversations we've been in recently, but "recently" may be as few as the last 100 PM messages. For a user that heavily uses PMs, this can leave out conversations even from a day or two ago.
One user reported an example as a typical experience: they're looking for a specific conversation, and the last message in it was 3pm yesterday. It's 3:30pm at the time they look, just over 24hr later. It doesn't show up on the PMs screen, though 6 other conversations do.
When there's plenty of blank space on the screen, this looks wrong and flaky/broken. It also makes it more annoying to get to the desired conversation.
In particular, for a group PM conversation, it can look like there's no way to do that at all. (The existing answer is the "Create group" button, which is highly misleading; see #2694.)
The text was updated successfully, but these errors were encountered: