Skip to content

Commit

Permalink
Merge pull request #20447 from tienifr/fix/19303-mention-not-show-bea…
Browse files Browse the repository at this point in the history
…m-on-selection

Fix: Mention does not show beam on selection
  • Loading branch information
Joel Bettner authored Jun 14, 2023
2 parents 63c1264 + f24fb4f commit 7f936b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import htmlRendererPropTypes from './htmlRendererPropTypes';
import withCurrentUserPersonalDetails from '../../withCurrentUserPersonalDetails';
import personalDetailsPropType from '../../../pages/personalDetailsPropType';
import * as StyleUtils from '../../../styles/StyleUtils';
import TextLink from '../../TextLink';

const propTypes = {
...htmlRendererPropTypes,
Expand All @@ -30,22 +31,23 @@ function MentionUserRenderer(props) {
const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style']);

// We need to remove the leading @ from data as it is not part of the login
const loginWhithoutLeadingAt = props.tnode.data.slice(1);
const loginWithoutLeadingAt = props.tnode.data.slice(1);

const isOurMention = loginWhithoutLeadingAt === props.currentUserPersonalDetails.login;
const isOurMention = loginWithoutLeadingAt === props.currentUserPersonalDetails.login;

return (
<Text>
<Tooltip text={loginWhithoutLeadingAt}>
<Text
<Tooltip text={loginWithoutLeadingAt}>
<TextLink
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
href={ROUTES.getDetailsRoute(loginWithoutLeadingAt)}
color={StyleUtils.getMentionTextColor(isOurMention)}
style={[_.omit(props.style, 'color'), StyleUtils.getMentionStyle(isOurMention)]}
onPress={() => showUserDetails(loginWhithoutLeadingAt)}
onPress={() => showUserDetails(loginWithoutLeadingAt)}
>
<TNodeChildrenRenderer tnode={props.tnode} />
</Text>
</TextLink>
</Tooltip>
</Text>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/TextLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const defaultProps = {
};

function TextLink(props) {
const rest = _.omit(props, _.keys(propTypes));
const additionalStyles = _.isArray(props.style) ? props.style : [props.style];

/**
Expand Down Expand Up @@ -64,6 +65,8 @@ function TextLink(props) {
onPress={openLink}
onMouseDown={props.onMouseDown}
onKeyDown={openLinkIfEnterKeyPressed}
// eslint-disable-next-line react/jsx-props-no-spreading
{...rest}
>
{props.children}
</Text>
Expand Down

0 comments on commit 7f936b7

Please sign in to comment.