This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate delete_post_modal.jsx to be pure and use Redux (#989)
* Migrate DeletePostModal to be pure and use Redux Migrate DeletePostModal to be pure and use Redux * Fix styling problem * Changes based on reviews * Removed old post action Added some functionality from the old action to the component * Remove unused imports from post_actions * Add browserhistory test Clean up test baseProps Pass teamname instead of team object * Fix styling problem
- Loading branch information
1 parent
5c2d636
commit bc48cd4
Showing
17 changed files
with
498 additions
and
141 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See License.txt for license information. | ||
|
||
import {bindActionCreators} from 'redux'; | ||
import {connect} from 'react-redux'; | ||
import {deletePost} from 'mattermost-redux/actions/posts'; | ||
import {getChannel} from 'mattermost-redux/selectors/entities/channels'; | ||
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams'; | ||
|
||
import DeletePostModal from './delete_post_modal.jsx'; | ||
|
||
function mapStateToProps(state, ownProps) { | ||
const channel = getChannel(state, ownProps.post.channel_id); | ||
let channelName = ''; | ||
if (channel) { | ||
channelName = channel.name; | ||
} | ||
|
||
const {focusedPostId} = state.views.channel; | ||
|
||
return { | ||
channelName, | ||
focusedPostId, | ||
teamName: getCurrentTeam(state).name, | ||
}; | ||
} | ||
|
||
function mapDispatchToProps(dispatch) { | ||
return { | ||
actions: bindActionCreators({ | ||
deletePost, | ||
}, dispatch), | ||
}; | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(DeletePostModal); |
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
Oops, something went wrong.