Repository metrics
- Stars
- (1,348 stars)
- PR merge metrics
- (PR metrics pending)
Description
As we saw in #5206, it's possible to have a message in the message list that's in a stream we don't have in our data structures. (For example: if you were in a stream, got some messages there, then left it, and either it's private (and you're not an admin) or you're a guest. Then find that message in all-messages, in search, or if applicable in @-mentions or starred messages.)
If you long-press on the recipient header of that message, you'll get a crash. This is because we try to open the topic action sheet, and:
const stream = backgroundData.streams.get(streamId);
invariant(stream !== undefined, 'Stream with provided streamId not found.');
Same thing if you try to open the stream action sheet for that stream; one way you can get there is to (short-)press the recipient header to navigate to the topic narrow, then (after #5205 is merged) hit the "up" icon to go to the stream narrow, then long-press on the app bar's title area.
Instead, we should give the user appropriate feedback that (a) yes, they successfully did the gesture that pulls up the action sheet, but (b) we can't provide a useful action sheet.
Specifically, we should:
- Go ahead and show an action sheet.
- It won't have any buttons other than "Cancel" -- none of the other buttons make sense when the stream is one we don't have access to.
- For the title, we'd usually show the stream name, and we don't have that. Instead, fill in an error message: perhaps "Unknown stream".