Add Ability to DM myself from the User Profile screen (#1560)
This commit is contained in:
parent
f84d6f76e0
commit
1d72f46031
2 changed files with 10 additions and 8 deletions
|
|
@ -18,7 +18,6 @@ function mapStateToProps(state, ownProps) {
|
|||
const {createChannel: createChannelRequest} = state.requests.channels;
|
||||
|
||||
return {
|
||||
navigator: ownProps.navigator,
|
||||
config,
|
||||
createChannelRequest,
|
||||
currentChannel: getCurrentChannel(state) || {},
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
View,
|
||||
Linking,
|
||||
} from 'react-native';
|
||||
import {injectIntl, intlShape} from 'react-intl';
|
||||
import {intlShape} from 'react-intl';
|
||||
|
||||
import {getDirectChannelName} from 'mattermost-redux/utils/channel_utils';
|
||||
import {displayUsername} from 'mattermost-redux/utils/user_utils';
|
||||
|
|
@ -22,7 +22,7 @@ import {changeOpacity, makeStyleSheetFromTheme, setNavigatorStyles} from 'app/ut
|
|||
import UserProfileRow from './user_profile_row';
|
||||
import Config from 'assets/config';
|
||||
|
||||
class UserProfile extends PureComponent {
|
||||
export default class UserProfile extends PureComponent {
|
||||
static propTypes = {
|
||||
actions: PropTypes.shape({
|
||||
makeDirectChannel: PropTypes.func.isRequired,
|
||||
|
|
@ -32,13 +32,16 @@ class UserProfile extends PureComponent {
|
|||
currentChannel: PropTypes.object.isRequired,
|
||||
currentDisplayName: PropTypes.string,
|
||||
currentUserId: PropTypes.string.isRequired,
|
||||
intl: intlShape.isRequired,
|
||||
navigator: PropTypes.object,
|
||||
teammateNameDisplay: PropTypes.string,
|
||||
theme: PropTypes.object.isRequired,
|
||||
user: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
static contextTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (this.props.theme !== nextProps.theme) {
|
||||
setNavigatorStyles(this.props.navigator, nextProps.theme);
|
||||
|
|
@ -65,7 +68,7 @@ class UserProfile extends PureComponent {
|
|||
displaySendMessageOption = () => {
|
||||
const {currentChannel, currentUserId, user} = this.props;
|
||||
|
||||
return currentUserId !== user.id && currentChannel.name !== getDirectChannelName(currentUserId, user.id);
|
||||
return currentChannel.name !== getDirectChannelName(currentUserId, user.id);
|
||||
};
|
||||
|
||||
getDisplayName = () => {
|
||||
|
|
@ -98,7 +101,8 @@ class UserProfile extends PureComponent {
|
|||
};
|
||||
|
||||
sendMessage = async () => {
|
||||
const {actions, currentDisplayName, intl, teammateNameDisplay, user} = this.props;
|
||||
const {intl} = this.context;
|
||||
const {actions, currentDisplayName, teammateNameDisplay, user} = this.props;
|
||||
|
||||
// save the current channel display name in case it fails
|
||||
const currentChannelDisplayName = currentDisplayName;
|
||||
|
|
@ -164,7 +168,7 @@ class UserProfile extends PureComponent {
|
|||
});
|
||||
|
||||
return additionalOptions;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {config, theme, user} = this.props;
|
||||
|
|
@ -255,4 +259,3 @@ const createStyleSheet = makeStyleSheetFromTheme((theme) => {
|
|||
};
|
||||
});
|
||||
|
||||
export default injectIntl(UserProfile);
|
||||
|
|
|
|||
Loading…
Reference in a new issue