Skip to content

Commit

Permalink
wip narrow: getNarrowFromMessage never a stream narrow
Browse files Browse the repository at this point in the history
There's no reason we would sometimes want a stream narrow here.
This is just how it was when this function was first written, for
narrowing to a message's conversation, in 34ab1f9 (zulip#333) in 2017.

This case also should be impossible anyway, because message topics
should always be nonempty -- we convert empty to "(no topic)".
  • Loading branch information
gnprice committed Feb 6, 2020
1 parent d6a566d commit 84ae358
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
11 changes: 0 additions & 11 deletions src/utils/__tests__/narrow-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,17 +365,6 @@ describe('getNarrowFromMessage', () => {
expect(actualNarrow).toEqual(expectedNarrow);
});

test('if recipient of a message is string, returns a stream narrow', () => {
const message = {
display_recipient: 'stream',
};
const expectedNarrow = streamNarrow('stream');

const actualNarrow = getNarrowFromMessage(message);

expect(actualNarrow).toEqual(expectedNarrow);
});

test('if recipient is a string and there is a subject returns a topic narrow', () => {
const message = {
display_recipient: 'stream',
Expand Down
6 changes: 1 addition & 5 deletions src/utils/narrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,5 @@ export const getNarrowFromMessage = (message: Message | Outbox, ownEmail: string
return groupNarrow(recipient.map(x => x.email));
}

if (message.subject && message.subject.length) {
return topicNarrow(message.display_recipient, message.subject);
}

return streamNarrow(message.display_recipient);
return topicNarrow(message.display_recipient, message.subject);
};

0 comments on commit 84ae358

Please sign in to comment.