Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RE-331 fix DM forwarded from title issue #1928

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/src/renderer/apps/Courier/components/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,17 @@ export const ChatMessagePresenter = ({
disabled: false,
onClick: (evt: React.MouseEvent<HTMLDivElement>) => {
evt.stopPropagation();
const forwardedPathTitle: string =
selectedChat.type === 'dm'
? `DM with ${selectedChat.metadata.title}`
: selectedChat.metadata.title;
setObject({
app: 'Courier',
icon: 'CourierApp',
dataTypeName: 'message',
mergedContents: getMergedContents(message, messages, friends),
message,
forwardedPathTitle,
share: (o: any, paths: SharePath[]) => {
const frags = o.message.contents.map((c: any) => {
return {
Expand All @@ -288,7 +293,7 @@ export const ChatMessagePresenter = ({
...c.metadata,
forwardedId: o.message.id,
forwardedPath: o.message.path,
forwardedPathTitle: o.message.forwardedFrom,
forwardedPathTitle: o.forwardedPathTitle,
},
};
});
Expand Down
1 change: 1 addition & 0 deletions app/src/renderer/components/ShareModal/useShareModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type ShareObject = {
share: (o: any, paths: SharePath[]) => void;
mergedContents?: any;
message?: ChatMessageType;
forwardedPathTitle?: string;
} | null;

export type SharePath = {
Expand Down
8 changes: 7 additions & 1 deletion lib/design-system/src/blocks/Bubble/Bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ export const Bubble = ({
<Flex
ref={innerRef}
key={`${id}-${fragments.join('-')}`}
id={id}
display="inline-flex"
justifyContent={isOur ? 'flex-end' : 'flex-start'}
position="relative"
>
<BubbleStyle
id={id}
isPrevGrouped={isPrevGrouped}
isNextGrouped={isNextGrouped}
ourTextColor={contrastAwareBlackOrWhiteHex(
Expand All @@ -207,6 +209,7 @@ export const Bubble = ({
>
{!isOur && !isPrevGrouped && (
<BubbleAuthor
id={id}
style={{
color: authorColorDisplay,
}}
Expand All @@ -218,11 +221,12 @@ export const Bubble = ({
{forwardedFrom && (
<Text.Custom
style={{ color: 'rgba(var(--rlm-icon-rgba), 0.60)', fontSize: 11 }}
id={id}
>
Forwarded from: {forwardedFrom}
</Text.Custom>
)}
<FragmentBlock>{fragments}</FragmentBlock>
<FragmentBlock id={id}>{fragments}</FragmentBlock>
<BubbleFooter height={footerHeight} mt={1}>
<Box width="70%">
{((reactions && reactions.length > 0) || onReaction) && (
Expand All @@ -236,6 +240,7 @@ export const Bubble = ({
)}
</Box>
<Flex
id={id}
width="30%"
gap={4}
alignItems="flex-end"
Expand Down Expand Up @@ -270,6 +275,7 @@ export const Bubble = ({
/>
)}
<Text.Custom
id={id}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing the same id to multiple DOM elements is a bad practice since it's supposed to be unique. I think switching to className would be a rather simple refactor, if not – let's leave it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason we pass the same id is because context menu needs it. we could change the way context menu works, but that was outside the scope of what I was trying to do here, since that would touch the whole application, not just chat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gdbroman I made a ticket to fix the id issue here: https://holium.atlassian.net/browse/RE-378

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea. Did you try setting pointer-events: none on these children instead of passing the id? That way the click should just pass through until it hits the parent container. @Tenari

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did not try that... I can tinker with it today

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style={{ whiteSpace: 'nowrap', userSelect: 'none' }}
pointerEvents="none"
textAlign="right"
Expand Down