Updated chat in profile

- Chat in profile now directs to private message with user
This commit is contained in:
mgabdev 2020-03-23 18:26:05 -04:00
parent 3d3b51ee1a
commit 02ca61f669
2 changed files with 3 additions and 16 deletions

View File

@ -36,6 +36,8 @@ export default class IconButton extends React.PureComponent {
}; };
handleClick = (e) => { handleClick = (e) => {
if (!this.props.onClick) return;
e.preventDefault(); e.preventDefault();
if (!this.props.disabled) { if (!this.props.disabled) {
@ -89,6 +91,7 @@ export default class IconButton extends React.PureComponent {
style={style} style={style}
tabIndex={tabIndex} tabIndex={tabIndex}
disabled={disabled} disabled={disabled}
type={type}
> >
<Icon id={icon} fixedWidth aria-hidden='true' /> <Icon id={icon} fixedWidth aria-hidden='true' />
</button> </button>

View File

@ -4,7 +4,6 @@ import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import axios from 'axios';
import Button from 'gabsocial/components/button'; import Button from 'gabsocial/components/button';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { autoPlayGif, me, isStaff } from 'gabsocial/initial_state'; import { autoPlayGif, me, isStaff } from 'gabsocial/initial_state';
@ -94,20 +93,6 @@ class Header extends ImmutablePureComponent {
window.removeEventListener('resize', this.handleResize); window.removeEventListener('resize', this.handleResize);
} }
onChat = () => {
const { account } = this.props;
axios.post('https://chat.gab.com/private-message', {
username: account.get('username'),
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
handleResize = debounce(() => { handleResize = debounce(() => {
this.setState({ isSmallScreen: (window.innerWidth <= 895) }); this.setState({ isSmallScreen: (window.innerWidth <= 895) });
}, 5, { }, 5, {
@ -343,7 +328,6 @@ class Header extends ImmutablePureComponent {
type='submit' type='submit'
icon='comments' icon='comments'
className='button button-alternative-2 chat-button' className='button button-alternative-2 chat-button'
onClick={this.onChat}
title={intl.formatMessage(messages.chat)} title={intl.formatMessage(messages.chat)}
/> />
</form> </form>