<commit_before>import { Components, registerComponent, withCurrentUser, getSetting } from 'meteor/vulcan:core';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';

import { Meteor } from 'meteor/meteor';
import { Link } from 'react-router';
import Users from 'meteor/vulcan:users';
import { withApollo } from 'react-apollo';

import Popover from 'material-ui/Popover';
import Menu from 'material-ui/Menu';
import MenuItem from 'material-ui/MenuItem';
import Button from '@material-ui/core/Button';

import { withStyles } from '@material-ui/core/styles';

const styles = theme => ({
  userButton: {
    textTransform: 'none',
    fontSize: '16px',
    fontWeight: 400,
  }
})

class UsersMenu extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      open: false,
    }
  }

  handleClick = (event) => {
    event.preventDefault();
    this.setState({
      open:true,
      anchorEl: event.currentTarget,
    });
  };

  handleRequestClose = () => {
    this.setState({
      open: false,
    });
  }

  render() {
    let { currentUser, client, classes, color } = this.props;

    return (
      <div className="users-menu">
        <Button onClick={this.handleClick}>
          <span className={classes.userButton} style={{ color: color }}>
            {Users.getDisplayName(currentUser)}
          </span>
        </Button>
        <Popover
          open={this.state.open}
          anchorEl={this.state.anchorEl}
          anchorOrigin={{horizontal: 'right', vertical: 'bottom'}}
          targetOrigin={{horizontal: 'right', vertical: 'top'}}
          onRequestClose={this.handleRequestClose}
        >
          <Menu className="users-menu-contents">
            { !getSetting('AlignmentForum')
                ? <MenuItem primaryText="New Post" containerElement={<Link to={`/newPost`}/>} />
                : Users.canDo(currentUser, 'posts.alignment.new')
                  ? <MenuItem primaryText="New Post" containerElement={<Link to={`/newPost`}/>} />
                  : null
            }
            <MenuItem primaryText="Profile" containerElement={<Link to={`/users/${currentUser.slug}`}/>} />
            <MenuItem primaryText="Edit Account" containerElement={<Link to={`/account`}/>} />
            <MenuItem primaryText="Log Out" onClick={() => Meteor.logout(() => client.resetStore())} />
          </Menu>
        </Popover>
      </div>
    )
  }
}

UsersMenu.propTypes = {
  color: PropTypes.string,
};

UsersMenu.defaultProps = {
  color: "rgba(0, 0, 0, 0.6)"
}

registerComponent('UsersMenu', UsersMenu, withCurrentUser, withApollo, withStyles(styles));
<commit_msg>Profile menu PM link<commit_after>import { Components, registerComponent, withCurrentUser, getSetting } from 'meteor/vulcan:core';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';

import { Meteor } from 'meteor/meteor';
import { Link } from 'react-router';
import Users from 'meteor/vulcan:users';
import { withApollo } from 'react-apollo';

import Popover from 'material-ui/Popover';
import Menu from 'material-ui/Menu';
import MenuItem from 'material-ui/MenuItem';
import Button from '@material-ui/core/Button';

import { withStyles } from '@material-ui/core/styles';

const styles = theme => ({
  userButton: {
    textTransform: 'none',
    fontSize: '16px',
    fontWeight: 400,
  }
})

class UsersMenu extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      open: false,
    }
  }

  handleClick = (event) => {
    event.preventDefault();
    this.setState({
      open:true,
      anchorEl: event.currentTarget,
    });
  };

  handleRequestClose = () => {
    this.setState({
      open: false,
    });
  }

  render() {
    let { currentUser, client, classes, color } = this.props;

    return (
      <div className="users-menu">
        <Button onClick={this.handleClick}>
          <span className={classes.userButton} style={{ color: color }}>
            {Users.getDisplayName(currentUser)}
          </span>
        </Button>
        <Popover
          open={this.state.open}
          anchorEl={this.state.anchorEl}
          anchorOrigin={{horizontal: 'right', vertical: 'bottom'}}
          targetOrigin={{horizontal: 'right', vertical: 'top'}}
          onRequestClose={this.handleRequestClose}
        >
          <Menu className="users-menu-contents">
            { !getSetting('AlignmentForum')
                ? <MenuItem primaryText="New Post" containerElement={<Link to={`/newPost`}/>} />
                : Users.canDo(currentUser, 'posts.alignment.new')
                  ? <MenuItem primaryText="New Post" containerElement={<Link to={`/newPost`}/>} />
                  : null
            }
            <MenuItem primaryText="Profile" containerElement={<Link to={`/users/${currentUser.slug}`}/>} />
            <MenuItem primaryText="Edit Account" containerElement={<Link to={`/account`}/>} />
            <MenuItem primaryText="Private Messages" containerElement={<Link to={`/inbox`}/>} />
            <MenuItem primaryText="Log Out" onClick={() => Meteor.logout(() => client.resetStore())} />
          </Menu>
        </Popover>
      </div>
    )
  }
}

UsersMenu.propTypes = {
  color: PropTypes.string,
};

UsersMenu.defaultProps = {
  color: "rgba(0, 0, 0, 0.6)"
}

registerComponent('UsersMenu', UsersMenu, withCurrentUser, withApollo, withStyles(styles));

{'fraction_non_alphanumeric': 0.15336289726533628, 'fraction_numerical': 0.003695491500369549, 'mean_word_length': 2.8747315676449534, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 53, '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': '4434548', 'n_tokens_mistral': 1629, 'n_tokens_neox': 1606, 'n_words': 332}