Skip to content

Commit c850219

Browse files
chrisbobbegnprice
authored andcommitted
messagesActions [nfc]: Separate nearOperand-is-null case into early return
NFC because doNarrow's second param defaults to 0, so not passing a second argument is the same as passing 0 for it. Also NFC because doNarrow drops that param on the floor.
1 parent 4352dc9 commit c850219

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/message/messagesActions.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ export const messageLinkPress =
3838
if (narrow) {
3939
// This call is OK: `narrow` is truthy, so isNarrowLink(…) was true.
4040
const nearOperand = getNearOperandFromLink(href, auth.realm);
41-
dispatch(doNarrow(narrow, nearOperand ?? 0));
41+
if (nearOperand === null) {
42+
dispatch(doNarrow(narrow));
43+
return;
44+
}
45+
46+
dispatch(doNarrow(narrow, nearOperand));
4247
} else if (!isUrlOnRealm(href, auth.realm)) {
4348
openLinkWithUserPreference(href, getGlobalSettings());
4449
} else {

0 commit comments

Comments
 (0)