diff --git a/ts/components/MyStories.tsx b/ts/components/MyStories.tsx index b9675c186d..4931c5adba 100644 --- a/ts/components/MyStories.tsx +++ b/ts/components/MyStories.tsx @@ -68,12 +68,12 @@ export const MyStories = ({
{myStories.map(list => ( -
+
{list.stories.map(story => ( diff --git a/ts/state/selectors/stories.ts b/ts/state/selectors/stories.ts index ed7a01c5ee..48192b4acd 100644 --- a/ts/state/selectors/stories.ts +++ b/ts/state/selectors/stories.ts @@ -283,36 +283,48 @@ export const getStories = createSelector( return; } - if (story.sendStateByConversationId && story.storyDistributionListId) { - const list = - story.storyDistributionListId === MY_STORIES_ID - ? { id: MY_STORIES_ID, name: MY_STORIES_ID } - : distributionListSelector( - story.storyDistributionListId.toLowerCase() - ); + const conversationStory = getConversationStory( + conversationSelector, + story + ); - if (!list) { + if (story.sendStateByConversationId) { + let sentId = story.conversationId; + let sentName = conversationStory.group?.title; + + if (story.storyDistributionListId) { + const list = + story.storyDistributionListId === MY_STORIES_ID + ? { id: MY_STORIES_ID, name: MY_STORIES_ID } + : distributionListSelector( + story.storyDistributionListId.toLowerCase() + ); + + if (!list) { + return; + } + + sentId = list.id; + sentName = list.name; + } + + if (!sentName) { return; } const storyView = getStoryView(conversationSelector, story); - const existingMyStory = myStoriesById.get(list.id) || { stories: [] }; + const existingMyStory = myStoriesById.get(sentId) || { stories: [] }; - myStoriesById.set(list.id, { - distributionId: list.id, - distributionName: list.name, + myStoriesById.set(sentId, { + id: sentId, + name: sentName, stories: [...existingMyStory.stories, storyView], }); return; } - const conversationStory = getConversationStory( - conversationSelector, - story - ); - let storiesMap: Map; if (conversationStory.isHidden) { diff --git a/ts/test-both/helpers/getFakeStory.tsx b/ts/test-both/helpers/getFakeStory.tsx index f43da9e72b..b30b8f25d5 100644 --- a/ts/test-both/helpers/getFakeStory.tsx +++ b/ts/test-both/helpers/getFakeStory.tsx @@ -27,9 +27,8 @@ export function getFakeMyStory(id?: string, name?: string): MyStoryType { const storyCount = casual.integer(2, 6); return { - distributionId: id || UUID.generate().toString(), - distributionName: - name || id === MY_STORIES_ID ? 'My Stories' : casual.catch_phrase, + id: id || UUID.generate().toString(), + name: name || id === MY_STORIES_ID ? 'My Stories' : casual.catch_phrase, stories: Array.from(Array(storyCount), () => ({ ...getFakeStoryView(), sendState: [], diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index 4fccb6ecf6..1c2daad12c 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -1932,6 +1932,24 @@ export default class MessageReceiver timestamp: envelope.timestamp, }; + if (sentMessage && message.groupV2) { + const ev = new SentEvent( + { + destinationUuid: envelope.destinationUuid.toString(), + isRecipientUpdate: Boolean(sentMessage.isRecipientUpdate), + message, + receivedAtCounter: envelope.receivedAtCounter, + receivedAtDate: envelope.receivedAtDate, + serverTimestamp: envelope.serverTimestamp, + timestamp: envelope.timestamp, + unidentifiedStatus: sentMessage.unidentifiedStatus, + }, + this.removeFromCache.bind(this, envelope) + ); + this.dispatchAndWait(ev); + return; + } + if (sentMessage) { const { storyMessageRecipients } = sentMessage; const recipients = storyMessageRecipients ?? []; diff --git a/ts/types/Stories.ts b/ts/types/Stories.ts index 2b4efbc7eb..5ec3e7e37e 100644 --- a/ts/types/Stories.ts +++ b/ts/types/Stories.ts @@ -85,8 +85,8 @@ export type StoryViewType = { }; export type MyStoryType = { - distributionId: string; - distributionName: string; + id: string; + name: string; stories: Array; };