Sync stories sent to a group
This commit is contained in:
parent
808118d1e4
commit
dca848389c
5 changed files with 54 additions and 25 deletions
|
@ -68,12 +68,12 @@ export const MyStories = ({
|
|||
</div>
|
||||
<div className="Stories__pane__list">
|
||||
{myStories.map(list => (
|
||||
<div className="MyStories__distribution" key={list.distributionId}>
|
||||
<div className="MyStories__distribution" key={list.id}>
|
||||
<div className="MyStories__distribution__title">
|
||||
<StoryDistributionListName
|
||||
i18n={i18n}
|
||||
id={list.distributionId}
|
||||
name={list.distributionName}
|
||||
id={list.id}
|
||||
name={list.name}
|
||||
/>
|
||||
</div>
|
||||
{list.stories.map(story => (
|
||||
|
|
|
@ -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<string, ConversationStoryType>;
|
||||
|
||||
if (conversationStory.isHidden) {
|
||||
|
|
|
@ -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: [],
|
||||
|
|
|
@ -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 ?? [];
|
||||
|
|
|
@ -85,8 +85,8 @@ export type StoryViewType = {
|
|||
};
|
||||
|
||||
export type MyStoryType = {
|
||||
distributionId: string;
|
||||
distributionName: string;
|
||||
id: string;
|
||||
name: string;
|
||||
stories: Array<StoryViewType>;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue