Proper handling of incoming 1:1 story replies

This commit is contained in:
Scott Nonnenberg 2024-02-26 13:57:55 -08:00 committed by GitHub
parent 02f01974c2
commit c981b0d7ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 8 deletions

View file

@ -6979,6 +6979,10 @@
"messageformat": "Reacted to a story from {name}",
"description": "Label for when a person reacts to a story"
},
"icu:Quote__story-reaction--you": {
"messageformat": "Reacted to your story",
"description": "Label for when someone reacts to your story"
},
"icu:Quote__story-reaction--single": {
"messageformat": "Reacted to a story",
"description": "Used whenever we can't find a user's first name"

View file

@ -1651,9 +1651,11 @@ export class Message extends React.PureComponent<Props, State> {
<>
{storyReplyContext.emoji && (
<div className="module-message__quote-story-reaction-header">
{i18n('icu:Quote__story-reaction', {
name: storyReplyContext.authorTitle,
})}
{isIncoming
? i18n('icu:Quote__story-reaction--you')
: i18n('icu:Quote__story-reaction', {
name: storyReplyContext.authorTitle,
})}
</div>
)}
<Quote

View file

@ -1839,8 +1839,8 @@ export const StoryReplyYours = (): JSX.Element => {
export const StoryReplyEmoji = (): JSX.Element => {
const conversation = getDefaultConversation();
return renderThree({
...createProps({ direction: 'outgoing', text: 'Wow!' }),
return renderBothDirections({
...createProps({ text: 'Wow!' }),
storyReplyContext: {
authorTitle: conversation.firstName || conversation.title,
conversationColor: ConversationColors[0],

View file

@ -62,10 +62,8 @@ export async function hydrateStoryContext(
);
const newMessageAttributes: Partial<MessageAttributesType> = {
storyReplyContext: {
...context,
attachment: undefined,
// This is ok to do because story replies only show in 1:1 conversations
// so the story that was quoted should be from the same conversation.
authorAci: conversation?.getAci(),
// No messageId = referenced story not found
messageId: '',
},