Fix story group replies rendering

This commit is contained in:
Josh Perez 2022-08-25 12:10:56 -04:00 committed by GitHub
parent afc14aedd1
commit eadef45290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 14 deletions

View File

@ -675,7 +675,7 @@ export const StoryViewer = ({
components={[<strong>{viewCount}</strong>]} components={[<strong>{viewCount}</strong>]}
/> />
))} ))}
{viewCount > 0 && replyCount > 0 && ' '} {(sendState || viewCount > 0) && replyCount > 0 && ' '}
{replyCount > 0 && {replyCount > 0 &&
(replyCount === 1 ? ( (replyCount === 1 ? (
<Intl <Intl
@ -751,7 +751,6 @@ export const StoryViewer = ({
getPreferredBadge={getPreferredBadge} getPreferredBadge={getPreferredBadge}
i18n={i18n} i18n={i18n}
isGroupStory={isGroupStory} isGroupStory={isGroupStory}
isMyStory={isMe}
onClose={() => setHasStoryViewsNRepliesModal(false)} onClose={() => setHasStoryViewsNRepliesModal(false)}
onReact={emoji => { onReact={emoji => {
onReactToStory(emoji, story); onReactToStory(emoji, story);

View File

@ -31,9 +31,6 @@ export default {
i18n: { i18n: {
defaultValue: i18n, defaultValue: i18n,
}, },
isMyStory: {
defaultValue: false,
},
onClose: { action: true }, onClose: { action: true },
onSetSkinTone: { action: true }, onSetSkinTone: { action: true },
onReact: { action: true }, onReact: { action: true },
@ -168,7 +165,6 @@ CanReply.storyName = 'Can reply';
export const ViewsOnly = Template.bind({}); export const ViewsOnly = Template.bind({});
ViewsOnly.args = { ViewsOnly.args = {
isMyStory: true,
views: getViewsAndReplies().views, views: getViewsAndReplies().views,
}; };
ViewsOnly.storyName = 'Views only'; ViewsOnly.storyName = 'Views only';

View File

@ -89,7 +89,6 @@ export type PropsType = {
getPreferredBadge: PreferredBadgeSelectorType; getPreferredBadge: PreferredBadgeSelectorType;
i18n: LocalizerType; i18n: LocalizerType;
isGroupStory?: boolean; isGroupStory?: boolean;
isMyStory?: boolean;
onClose: () => unknown; onClose: () => unknown;
onReact: (emoji: string) => unknown; onReact: (emoji: string) => unknown;
onReply: ( onReply: (
@ -116,7 +115,6 @@ export const StoryViewsNRepliesModal = ({
getPreferredBadge, getPreferredBadge,
i18n, i18n,
isGroupStory, isGroupStory,
isMyStory,
onClose, onClose,
onReact, onReact,
onReply, onReply,
@ -173,7 +171,7 @@ export const StoryViewsNRepliesModal = ({
let composerElement: JSX.Element | undefined; let composerElement: JSX.Element | undefined;
if (!isMyStory && canReply) { if (canReply) {
composerElement = ( composerElement = (
<> <>
{!isGroupStory && ( {!isGroupStory && (
@ -293,7 +291,9 @@ export const StoryViewsNRepliesModal = ({
<div className="StoryViewsNRepliesModal__reply--title"> <div className="StoryViewsNRepliesModal__reply--title">
<ContactName <ContactName
contactNameColor={reply.contactNameColor} contactNameColor={reply.contactNameColor}
title={reply.author.title} title={
reply.author.isMe ? i18n('you') : reply.author.title
}
/> />
</div> </div>
{i18n('StoryViewsNRepliesModal__reacted')} {i18n('StoryViewsNRepliesModal__reacted')}
@ -312,6 +312,7 @@ export const StoryViewsNRepliesModal = ({
<Message <Message
{...MESSAGE_DEFAULT_PROPS} {...MESSAGE_DEFAULT_PROPS}
author={reply.author} author={reply.author}
contactNameColor={reply.contactNameColor}
containerElementRef={containerElementRef} containerElementRef={containerElementRef}
conversationColor="ultramarine" conversationColor="ultramarine"
conversationId={reply.conversationId} conversationId={reply.conversationId}
@ -326,10 +327,12 @@ export const StoryViewsNRepliesModal = ({
readStatus={reply.readStatus} readStatus={reply.readStatus}
renderingContext="StoryViewsNRepliesModal" renderingContext="StoryViewsNRepliesModal"
shouldCollapseAbove={ shouldCollapseAbove={
reply.conversationId === replies[index - 1]?.conversationId reply.conversationId === replies[index - 1]?.conversationId &&
!replies[index - 1]?.reactionEmoji
} }
shouldCollapseBelow={ shouldCollapseBelow={
reply.conversationId === replies[index + 1]?.conversationId reply.conversationId === replies[index + 1]?.conversationId &&
!replies[index + 1]?.reactionEmoji
} }
shouldHideMetadata={false} shouldHideMetadata={false}
text={reply.body} text={reply.body}

View File

@ -858,6 +858,7 @@ export class Message extends React.PureComponent<Props, State> {
const { const {
author, author,
contactNameColor, contactNameColor,
i18n,
isSticker, isSticker,
isTapToView, isTapToView,
isTapToViewExpired, isTapToViewExpired,
@ -879,7 +880,7 @@ export class Message extends React.PureComponent<Props, State> {
<div className={moduleName}> <div className={moduleName}>
<ContactName <ContactName
contactNameColor={contactNameColor} contactNameColor={contactNameColor}
title={author.title} title={author.isMe ? i18n('you') : author.title}
module={moduleName} module={moduleName}
/> />
</div> </div>

View File

@ -341,7 +341,11 @@ export const getStories = createSelector(
stories: [storyView, ...existingMyStory.stories], stories: [storyView, ...existingMyStory.stories],
}); });
return; // If it's a group story we still want it to render as part of regular
// stories or hidden stories.
if (story.storyDistributionListId) {
return;
}
} }
let storiesMap: Map<string, ConversationStoryType>; let storiesMap: Map<string, ConversationStoryType>;

View File

@ -217,6 +217,7 @@ export async function sendStoryMessage(
const messageAttributes = const messageAttributes =
await window.Signal.Migrations.upgradeMessageSchema({ await window.Signal.Migrations.upgradeMessageSchema({
attachments, attachments,
canReplyToStory: true,
conversationId, conversationId,
expireTimer: DAY / SECOND, expireTimer: DAY / SECOND,
id: UUID.generate().toString(), id: UUID.generate().toString(),