This repository has been archived by the owner on Sep 28, 2020. It is now read-only.
forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Profile popover new component: DM, calendar, whober, @mentions
* UCHAT-181 Add button to DM a user from their profile preview popover tile, UCHAT-76 Add link to user's whober profile from their profile preview popover tile, UCHAT-342 Redesign profile hovercard to match whober style spec * UCHAT-562 Show @username button on profile popover (#26) * UCHAT-562 add tooltip to popover mention button * UCHAT-76 Add Tooltip to link to whober profile in profile popover (#32) * UCHAT-361 Add calendar link to profile hovercard UCHAT-1854 Display position in user hovecard under name
- Loading branch information
David Meza
committed
May 2, 2019
1 parent
ba22a4a
commit ee7a0dc
Showing
17 changed files
with
587 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {connect} from 'react-redux'; | ||
import {bindActionCreators} from 'redux'; | ||
|
||
import {getCurrentUserId, getStatusForUserId, getUser} from 'mattermost-redux/selectors/entities/users'; | ||
import { | ||
getCurrentTeam, | ||
getCurrentRelativeTeamUrl, | ||
getTeamMember, | ||
} from 'mattermost-redux/selectors/entities/teams'; | ||
import {getCurrentChannel, getChannelMembersInChannels} from 'mattermost-redux/selectors/entities/channels'; | ||
|
||
import {openDirectChannelToUserId} from 'actions/channel_actions.jsx'; | ||
import {getMembershipForCurrentEntities} from 'actions/views/profile_popover'; | ||
import {openModal} from 'actions/views/modals'; | ||
import {areTimezonesEnabledAndSupported} from 'selectors/general'; | ||
import {getSelectedPost, getRhsState} from 'selectors/rhs'; | ||
|
||
import ProfilePopoverUChat from './profile_popover_uchat.jsx'; | ||
|
||
function mapStateToProps(state, ownProps) { | ||
const userId = ownProps.userId; | ||
const team = getCurrentTeam(state); | ||
const teamMember = getTeamMember(state, team.id, userId); | ||
|
||
let isTeamAdmin = false; | ||
if (teamMember && teamMember.scheme_admin) { | ||
isTeamAdmin = true; | ||
} | ||
|
||
const selectedPost = getSelectedPost(state); | ||
const currentChannel = getCurrentChannel(state); | ||
|
||
let channelId; | ||
if (selectedPost.exists === false) { | ||
channelId = currentChannel.id; | ||
} else { | ||
channelId = selectedPost.channel_id; | ||
} | ||
|
||
const channelMember = getChannelMembersInChannels(state)[channelId][userId]; | ||
|
||
let isChannelAdmin = false; | ||
if (getRhsState(state) !== 'search' && channelMember != null && channelMember.scheme_admin) { | ||
isChannelAdmin = true; | ||
} | ||
|
||
return { | ||
enableTimezone: areTimezonesEnabledAndSupported(state), | ||
currentUserId: getCurrentUserId(state), | ||
isTeamAdmin, | ||
isChannelAdmin, | ||
status: getStatusForUserId(state, userId), | ||
teamUrl: getCurrentRelativeTeamUrl(state), | ||
user: getUser(state, userId), | ||
}; | ||
} | ||
|
||
function mapDispatchToProps(dispatch) { | ||
return { | ||
actions: bindActionCreators({ | ||
openDirectChannelToUserId, | ||
openModal, | ||
getMembershipForCurrentEntities, | ||
}, dispatch), | ||
}; | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(ProfilePopoverUChat); |
Oops, something went wrong.