-
-
Notifications
You must be signed in to change notification settings - Fork 655
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
narrow: Stop mis-unescaping narrows from recipient bars.
Here's a bug: * Send a message to a topic with a name like "this & that". * Look at it in the whole-stream view, or another interleaved view. The recipient header will show it nice and correctly: "this & that". * Tap the recipient header. * Expected: We narrow to topic "this & that". * Actual: We narrow to a different topic, "this & that". The cause of the bug is that we're trying to "unescape" a string that hasn't been "escaped" in the first place -- it's already simply the string we wanted, and "unescaping" can only corrupt it. Specifically: in `webViewEventHandlers.js` when we get the relevant outbound message-list event, it has the target narrow as a property, encoded as a string; we pass it to this helper `parseNarrowString`, and instead of simply decoding that string to a narrow, it calls `lodash.unescape` on it first. It looks like this bug has been here since the beginning of the webview-based message list. The location of it changed in commit b5f2e53, in 2018-02: before then, the narrow was encoded wrong in the HTML in the first place. That commit fixed that problem (well, part of it -- see 9941453) but introduced this spurious unescaping. This helper has no other call sites which might be relying on its current behavior, so we can just fix it directly. There was a test that gestured in the direction of this kind of question... but it actually just exercised the broken behavior, because it wasn't paired with the use of keyFromNarrow. Its useful content is covered by the round-trip tests we just added, so delete it; then add a bunch more round-trip tests that specifically probe for this class of bug. Fixes: #4338
- Loading branch information
Showing
4 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters