Normalize the distribution list and UUIDs iOS sends us
This commit is contained in:
parent
4a39264188
commit
7d2b91368d
3 changed files with 20 additions and 5 deletions
|
@ -282,7 +282,9 @@ export const getStories = createSelector(
|
|||
const list =
|
||||
story.storyDistributionListId === MY_STORIES_ID
|
||||
? { id: MY_STORIES_ID, name: MY_STORIES_ID }
|
||||
: distributionListSelector(story.storyDistributionListId);
|
||||
: distributionListSelector(
|
||||
story.storyDistributionListId.toLowerCase()
|
||||
);
|
||||
|
||||
if (!list) {
|
||||
return;
|
||||
|
|
|
@ -1946,15 +1946,20 @@ export default class MessageReceiver
|
|||
return;
|
||||
}
|
||||
|
||||
const normalizedDestinationUuid = normalizeUuid(
|
||||
destinationUuid,
|
||||
'handleStoryMessage.destinationUuid'
|
||||
);
|
||||
|
||||
recipient.distributionListIds?.forEach(listId => {
|
||||
const sentUuids: Set<string> =
|
||||
distributionListToSentUuid.get(listId) || new Set();
|
||||
sentUuids.add(destinationUuid);
|
||||
sentUuids.add(normalizedDestinationUuid);
|
||||
distributionListToSentUuid.set(listId, sentUuids);
|
||||
});
|
||||
|
||||
isAllowedToReply.set(
|
||||
destinationUuid,
|
||||
normalizedDestinationUuid,
|
||||
recipient.isAllowedToReply !== false
|
||||
);
|
||||
});
|
||||
|
@ -1975,7 +1980,10 @@ export default class MessageReceiver
|
|||
isRecipientUpdate: Boolean(sentMessage.isRecipientUpdate),
|
||||
receivedAtCounter: envelope.receivedAtCounter,
|
||||
receivedAtDate: envelope.receivedAtDate,
|
||||
storyDistributionListId: listId,
|
||||
storyDistributionListId: normalizeUuid(
|
||||
listId,
|
||||
'storyDistributionListId'
|
||||
),
|
||||
},
|
||||
this.removeFromCache.bind(this, envelope)
|
||||
);
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
getMessageIdForLogging,
|
||||
} from './idForLogging';
|
||||
import { isStory } from '../state/selectors/message';
|
||||
import { normalizeUuid } from './normalizeUuid';
|
||||
import { queueUpdateMessage } from './messageBatcher';
|
||||
|
||||
export async function onStoryRecipientUpdate(
|
||||
|
@ -58,7 +59,11 @@ export async function onStoryRecipientUpdate(
|
|||
|
||||
conversationIdToDistributionListIds.set(
|
||||
convo.id,
|
||||
new Set(item.distributionListIds)
|
||||
new Set(
|
||||
item.distributionListIds.map(uuid =>
|
||||
normalizeUuid(uuid, 'onStoryRecipientUpdate.distributionListId')
|
||||
)
|
||||
)
|
||||
);
|
||||
isAllowedToReply.set(convo.id, item.isAllowedToReply !== false);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue