Skip to content

Commit

Permalink
Merge pull request #23310 from Nikhil-Vats/21683_show_new_tooltip_for…
Browse files Browse the repository at this point in the history
…_mentions

Fix tooltip for mentions
  • Loading branch information
mountiny authored Jul 21, 2023
2 parents d3a13d6 + 642f346 commit 2c5dd69
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import {TNodeChildrenRenderer} from 'react-native-render-html';
import Navigation from '../../../libs/Navigation/Navigation';
import ROUTES from '../../../ROUTES';
import Text from '../../Text';
import Tooltip from '../../Tooltip';
import UserDetailsTooltip from '../../UserDetailsTooltip';
import htmlRendererPropTypes from './htmlRendererPropTypes';
import withCurrentUserPersonalDetails from '../../withCurrentUserPersonalDetails';
import personalDetailsPropType from '../../../pages/personalDetailsPropType';
import * as StyleUtils from '../../../styles/StyleUtils';
import * as PersonalDetailsUtils from '../../../libs/PersonalDetailsUtils';
import TextLink from '../../TextLink';

const propTypes = {
Expand All @@ -33,11 +34,18 @@ function MentionUserRenderer(props) {
// We need to remove the leading @ from data as it is not part of the login
const loginWithoutLeadingAt = props.tnode.data.slice(1);

const accountID = _.first(PersonalDetailsUtils.getAccountIDsByLogins([loginWithoutLeadingAt]));

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

return (
<Text>
<Tooltip text={loginWithoutLeadingAt}>
<UserDetailsTooltip
accountID={accountID}
fallbackUserDetails={{
displayName: loginWithoutLeadingAt,
}}
>
<TextLink
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
Expand All @@ -49,7 +57,7 @@ function MentionUserRenderer(props) {
>
<TNodeChildrenRenderer tnode={props.tnode} />
</TextLink>
</Tooltip>
</UserDetailsTooltip>
</Text>
);
}
Expand Down

0 comments on commit 2c5dd69

Please sign in to comment.