diff --git a/ts/components/StoryListItem.tsx b/ts/components/StoryListItem.tsx index 67e5e8a667..e9adef9674 100644 --- a/ts/components/StoryListItem.tsx +++ b/ts/components/StoryListItem.tsx @@ -106,9 +106,9 @@ export function StoryListItem({ } let repliesElement: JSX.Element | undefined; - if (hasRepliesFromSelf) { + if (group === undefined && hasRepliesFromSelf) { repliesElement =
; - } else if (hasReplies) { + } else if (group && (hasReplies || hasRepliesFromSelf)) { repliesElement =
; } diff --git a/ts/services/storyLoader.ts b/ts/services/storyLoader.ts index 887170d4a7..52643847dd 100644 --- a/ts/services/storyLoader.ts +++ b/ts/services/storyLoader.ts @@ -16,7 +16,6 @@ import { isNotNil } from '../util/isNotNil'; import { strictAssert } from '../util/assert'; import { dropNull } from '../util/dropNull'; import { DurationInSeconds } from '../util/durations'; -import { isGroup } from '../util/whatTypeOfConversation'; import { SIGNAL_ACI } from '../types/SignalConversation'; let storyData: @@ -33,14 +32,6 @@ export async function loadStories(): Promise { storyData = await Promise.all( stories.map(async story => { - const conversation = window.ConversationController.get( - story.conversationId - ); - - if (!isGroup(conversation?.attributes)) { - return story; - } - const [hasReplies, hasRepliesFromSelf] = await Promise.all([ dataInterface.hasStoryReplies(story.id), dataInterface.hasStoryRepliesFromSelf(story.id), diff --git a/ts/state/ducks/stories.ts b/ts/state/ducks/stories.ts index 48572878e3..1dbbae68ef 100644 --- a/ts/state/ducks/stories.ts +++ b/ts/state/ducks/stories.ts @@ -516,8 +516,8 @@ function replyToStory( mentions: DraftBodyRangesType, timestamp: number, story: StoryViewType -): ThunkAction { - return async dispatch => { +): ThunkAction { + return async (dispatch, getState) => { const conversation = window.ConversationController.get(conversationId); if (!conversation) { @@ -537,10 +537,23 @@ function replyToStory( } ); - dispatch({ - type: 'NOOP', - payload: null, - }); + const { stories } = getState().stories; + + const storyData = stories.find(s => s.messageId === story.messageId); + if (!storyData) { + log.error('replyToStory: story not found', story.messageId); + return; + } + + // for group stories, this happens automatically through LOAD_STORY_REPLIES + // but 1:1 we need to update manually + dispatch( + storyChanged({ + ...storyData, + hasReplies: true, + hasRepliesFromSelf: true, + }) + ); }; } @@ -1396,6 +1409,9 @@ export function reducer( prevStory.sendStateByConversationId, newStory.sendStateByConversationId ); + const hasHasRepliesChanged = + prevStory.hasReplies !== newStory.hasReplies || + prevStory.hasRepliesFromSelf !== newStory.hasRepliesFromSelf; const shouldReplace = isDownloadingAttachment || @@ -1405,7 +1421,9 @@ export function reducer( hasExpirationChanged || hasSendStateChanged || readStatusChanged || - reactionsChanged; + reactionsChanged || + hasHasRepliesChanged; + if (!shouldReplace) { return state; }