<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { unescape } from 'underscore';

import Text from 'react/components/UI/Text';
import Truncate from 'react/components/UI/Truncate';
import LockIconWithBorder from 'react/components/UI/LockIconWithBorder';

const NotificationObjectLink = ({
  __typename, label, href, visibility, is_me, ...rest
}) => {
  if (is_me) {
    return (
      <Text display="inline" f={1}>
        you
      </Text>
    );
  }

  return (
    <Text
      display="inline"
      f={1}
      fontWeight="bold"
      color={__typename === 'Channel' ? `channel.${visibility}` : 'gray.base'}
      {...rest}
    >
      <a href={href}>
        <Truncate length={40}>
          {unescape(label)}
        </Truncate>
        {visibility === 'private' &&
          <LockIconWithBorder display="inline-flex" ml={2} />
        }
      </a>
    </Text>
  );
};

NotificationObjectLink.propTypes = {
  __typename: PropTypes.string.isRequired,
  label: PropTypes.string.isRequired,
  href: PropTypes.string.isRequired,
  visibility: PropTypes.string,<commit_msg>Use truncate function<commit_after>import React from 'react';
import PropTypes from 'prop-types';

import Text from 'react/components/UI/Text';
import { truncate } from 'react/components/UI/Truncate';
import LockIconWithBorder from 'react/components/UI/LockIconWithBorder';

const NotificationObjectLink = ({
  __typename, label, href, visibility, is_me, ...rest
}) => {
  if (is_me) {
    return (
      <Text display="inline" f={1}>
        you
      </Text>
    );
  }

  return (
    <Text
      display="inline"
      f={1}
      fontWeight="bold"
      color={__typename === 'Channel' ? `channel.${visibility}` : 'gray.base'}
      {...rest}
    >
      <a href={href}>
        <span dangerouslySetInnerHTML={{ __html: truncate(label, 40) }} />
        {visibility === 'private' &&
          <LockIconWithBorder display="inline-flex" ml={2} />
        }
      </a>
    </Text>
  );
};

NotificationObjectLink.propTypes = {
  __typename: PropTypes.string.isRequired,
  label: PropTypes.string.isRequired,
  href: PropTypes.string.isRequired,
  visibility: PropTypes.string,
{'fraction_non_alphanumeric': 0.15134887974394148, 'fraction_numerical': 0.004572473708276178, 'mean_word_length': 2.978181818181818, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3115874', 'n_tokens_mistral': 685, 'n_tokens_neox': 686, 'n_words': 142}