Skip to content

Commit 8bdde96

Browse files
committed
outbox: Show outbox messages when 'caughtUp.newer' is false.
Currently, we return a NULL_ARRAY in outboxMessagesForNarrow when 'caughtUp.newer' is false - but there is no reason to do this. We should always show outbox messages regardless of the caughtUp state because there can always be unsent messages for various reasons. So, remove the conditional that causes this. Fixes: zulip#3800.
1 parent ba6b6b3 commit 8bdde96

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/chat/__tests__/narrowsSelectors-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe('getMessagesForNarrow', () => {
7575
expect(anchor).toEqual(expectedState);
7676
});
7777

78-
test('do not combine messages and outbox if not caught up', () => {
78+
test('combine messages and outbox if not caught up', () => {
7979
const state = deepFreeze({
8080
narrows: {
8181
[HOME_NARROW_STR]: [123],
@@ -94,7 +94,7 @@ describe('getMessagesForNarrow', () => {
9494
],
9595
});
9696

97-
const expectedState = deepFreeze([state.messages[123]]);
97+
const expectedState = deepFreeze([state.messages[123], ...state.outbox]);
9898

9999
const anchor = getMessagesForNarrow(state, HOME_NARROW);
100100

src/chat/narrowsSelectors.js

-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ export const outboxMessagesForNarrow: Selector<Outbox[], Narrow> = createSelecto
3636
getCaughtUpForNarrow,
3737
state => getOutbox(state),
3838
(narrow, caughtUp, outboxMessages) => {
39-
if (!caughtUp.newer) {
40-
return NULL_ARRAY;
41-
}
4239
const filtered = outboxMessages.filter(item => narrowContains(narrow, item.narrow));
4340
return isEqual(filtered, outboxMessages) ? outboxMessages : filtered;
4441
},

src/topics/__tests__/topicsSelectors-test.js

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('getLastMessageTopic', () => {
3030
test('when no messages in narrow return an empty string', () => {
3131
const state = deepFreeze({
3232
narrows: {},
33+
outbox: [],
3334
});
3435

3536
const topic = getLastMessageTopic(state, HOME_NARROW);
@@ -50,6 +51,7 @@ describe('getLastMessageTopic', () => {
5051
1: { id: 1 },
5152
2: { id: 2, subject: 'some topic' },
5253
},
54+
outbox: [],
5355
});
5456

5557
const topic = getLastMessageTopic(state, narrow);

0 commit comments

Comments
 (0)