From c69bf5a950e903e3f8bed3abd06d80c7fd0ddac7 Mon Sep 17 00:00:00 2001 From: enahum Date: Tue, 21 Nov 2017 12:35:03 -0300 Subject: [PATCH] Remove unneded ownProps (#1177) --- app/components/at_mention/index.js | 5 ++--- app/components/autocomplete/at_mention_item/index.js | 3 +-- app/components/autocomplete/channel_mention/index.js | 1 - app/components/autocomplete/channel_mention_item/index.js | 3 +-- .../channel_drawer/channels_list/filtered_list/index.js | 5 ++--- app/components/channel_link/index.js | 5 ++--- app/components/custom_list/channel_list_row/index.js | 3 +-- app/components/custom_list/user_list_row/index.js | 3 +-- app/components/emoji/index.js | 3 +-- app/components/file_upload_preview/index.js | 1 - app/components/markdown/markdown_code_block/index.js | 5 ++--- app/components/post_body/index.js | 1 - app/components/post_header/index.js | 1 - app/components/post_profile_picture/index.js | 1 - app/components/root/index.js | 3 +-- app/components/status_bar/index.js | 3 +-- app/screens/create_channel/index.js | 1 - app/screens/edit_post/index.js | 1 - app/screens/login/index.js | 3 +-- app/screens/login_options/index.js | 3 +-- app/screens/more_channels/index.js | 3 +-- app/screens/more_dms/index.js | 3 +-- app/screens/more_dms/selected_users/index.js | 3 +-- app/screens/settings/advanced_settings/index.js | 3 +-- app/screens/settings/general/index.js | 3 +-- app/screens/sso/index.js | 3 +-- 26 files changed, 23 insertions(+), 49 deletions(-) diff --git a/app/components/at_mention/index.js b/app/components/at_mention/index.js index f3a5d412f..ca3cb49ac 100644 --- a/app/components/at_mention/index.js +++ b/app/components/at_mention/index.js @@ -9,11 +9,10 @@ import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import AtMention from './at_mention'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { theme: getTheme(state), - usersByUsername: getUsersByUsername(state), - ...ownProps + usersByUsername: getUsersByUsername(state) }; } diff --git a/app/components/autocomplete/at_mention_item/index.js b/app/components/autocomplete/at_mention_item/index.js index 001ca7e45..8df6bbebd 100644 --- a/app/components/autocomplete/at_mention_item/index.js +++ b/app/components/autocomplete/at_mention_item/index.js @@ -16,8 +16,7 @@ function mapStateToProps(state, ownProps) { firstName: user.first_name, lastName: user.last_name, username: user.username, - theme: getTheme(state), - ...ownProps + theme: getTheme(state) }; } diff --git a/app/components/autocomplete/channel_mention/index.js b/app/components/autocomplete/channel_mention/index.js index 273aaaead..d7d1208ea 100644 --- a/app/components/autocomplete/channel_mention/index.js +++ b/app/components/autocomplete/channel_mention/index.js @@ -37,7 +37,6 @@ function mapStateToProps(state, ownProps) { } return { - ...ownProps, myChannels, otherChannels, publicChannels, diff --git a/app/components/autocomplete/channel_mention_item/index.js b/app/components/autocomplete/channel_mention_item/index.js index cd48c13d8..67c9edf31 100644 --- a/app/components/autocomplete/channel_mention_item/index.js +++ b/app/components/autocomplete/channel_mention_item/index.js @@ -15,8 +15,7 @@ function mapStateToProps(state, ownProps) { return { displayName: channel.display_name, name: channel.name, - theme: getTheme(state), - ...ownProps + theme: getTheme(state) }; } diff --git a/app/components/channel_drawer/channels_list/filtered_list/index.js b/app/components/channel_drawer/channels_list/filtered_list/index.js index d895cb463..3e5a74691 100644 --- a/app/components/channel_drawer/channels_list/filtered_list/index.js +++ b/app/components/channel_drawer/channels_list/filtered_list/index.js @@ -94,7 +94,7 @@ const getGroupChannelMemberDetails = createSelector( getGroupDetails ); -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { const {currentUserId} = state.entities.users; const profiles = getUsers(state); @@ -119,8 +119,7 @@ function mapStateToProps(state, ownProps) { searchOrder, pastDirectMessages: pastDirectMessages(state), restrictDms, - theme: getTheme(state), - ...ownProps + theme: getTheme(state) }; } diff --git a/app/components/channel_link/index.js b/app/components/channel_link/index.js index 9d6c9d053..950bc996b 100644 --- a/app/components/channel_link/index.js +++ b/app/components/channel_link/index.js @@ -10,10 +10,9 @@ import {handleSelectChannel, setChannelDisplayName} from 'app/actions/views/chan import ChannelLink from './channel_link'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { - channelsByName: getChannelsNameMapInCurrentTeam(state), - ...ownProps + channelsByName: getChannelsNameMapInCurrentTeam(state) }; } diff --git a/app/components/custom_list/channel_list_row/index.js b/app/components/custom_list/channel_list_row/index.js index 679c74234..db8823128 100644 --- a/app/components/custom_list/channel_list_row/index.js +++ b/app/components/custom_list/channel_list_row/index.js @@ -15,8 +15,7 @@ function makeMapStateToProps() { return (state, ownProps) => { return { theme: getTheme(state), - channel: getChannel(state, ownProps), - ...ownProps + channel: getChannel(state, ownProps) }; }; } diff --git a/app/components/custom_list/user_list_row/index.js b/app/components/custom_list/user_list_row/index.js index fb0d0370e..d18d4c16d 100644 --- a/app/components/custom_list/user_list_row/index.js +++ b/app/components/custom_list/user_list_row/index.js @@ -12,8 +12,7 @@ function mapStateToProps(state, ownProps) { return { theme: getTheme(state), user: getUser(state, ownProps.id), - teammateNameDisplay: getTeammateNameDisplaySetting(state), - ...ownProps + teammateNameDisplay: getTeammateNameDisplaySetting(state) }; } diff --git a/app/components/emoji/index.js b/app/components/emoji/index.js index a20cf1058..d20e1a0a5 100644 --- a/app/components/emoji/index.js +++ b/app/components/emoji/index.js @@ -7,9 +7,8 @@ import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis' import Emoji from './emoji'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { - ...ownProps, customEmojis: getCustomEmojisByName(state), token: state.entities.general.credentials.token }; diff --git a/app/components/file_upload_preview/index.js b/app/components/file_upload_preview/index.js index b32fc7fc0..9e979cfb4 100644 --- a/app/components/file_upload_preview/index.js +++ b/app/components/file_upload_preview/index.js @@ -33,7 +33,6 @@ function mapStateToProps(state, ownProps) { const {deviceHeight} = getDimensions(state); return { - ...ownProps, channelIsLoading: state.views.channel.loading, createPostRequestStatus: state.requests.posts.createPost.status, deviceHeight, diff --git a/app/components/markdown/markdown_code_block/index.js b/app/components/markdown/markdown_code_block/index.js index 85ed0701e..5d7d8f7b7 100644 --- a/app/components/markdown/markdown_code_block/index.js +++ b/app/components/markdown/markdown_code_block/index.js @@ -7,10 +7,9 @@ import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import MarkdownCodeBlock from './markdown_code_block'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { - theme: getTheme(state), - ...ownProps + theme: getTheme(state) }; } diff --git a/app/components/post_body/index.js b/app/components/post_body/index.js index 3af323bf1..bbd2645cb 100644 --- a/app/components/post_body/index.js +++ b/app/components/post_body/index.js @@ -16,7 +16,6 @@ function mapStateToProps(state, ownProps) { const post = getPost(state, ownProps.postId); return { - ...ownProps, postProps: post.props || {}, fileIds: post.file_ids, hasBeenDeleted: post.state === Posts.POST_DELETED, diff --git a/app/components/post_header/index.js b/app/components/post_header/index.js index 3e84f2976..e563df4e4 100644 --- a/app/components/post_header/index.js +++ b/app/components/post_header/index.js @@ -23,7 +23,6 @@ function makeMapStateToProps() { const militaryTime = getBool(state, Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time'); return { - ...ownProps, commentedOnDisplayName: displayUsername(commentedOnUser, teammateNameDisplay), commentCount: getCommentCountForPost(state, {post}), createAt: post.create_at, diff --git a/app/components/post_profile_picture/index.js b/app/components/post_profile_picture/index.js index b29949b18..43b983c45 100644 --- a/app/components/post_profile_picture/index.js +++ b/app/components/post_profile_picture/index.js @@ -15,7 +15,6 @@ function mapStateToProps(state, ownProps) { const post = getPost(state, ownProps.postId); return { - ...ownProps, enablePostIconOverride: config.EnablePostIconOverride === 'true', fromWebHook: post.props && post.props.from_webhook === 'true', isSystemMessage: isSystemMessage(post), diff --git a/app/components/root/index.js b/app/components/root/index.js index 7176621ac..d13e6a873 100644 --- a/app/components/root/index.js +++ b/app/components/root/index.js @@ -13,13 +13,12 @@ import {removeProtocol} from 'app/utils/url'; import Root from './root'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { const locale = getCurrentLocale(state); Client.setLocale(locale); Client4.setAcceptLanguage(locale); return { - ...ownProps, theme: getTheme(state), currentChannelId: getCurrentChannelId(state), currentUrl: removeProtocol(getCurrentUrl(state)), diff --git a/app/components/status_bar/index.js b/app/components/status_bar/index.js index ff91e788d..a310c0b9a 100644 --- a/app/components/status_bar/index.js +++ b/app/components/status_bar/index.js @@ -7,9 +7,8 @@ import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import StatusBar from './status_bar'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { - ...ownProps, theme: getTheme(state) }; } diff --git a/app/screens/create_channel/index.js b/app/screens/create_channel/index.js index 966d4e405..71c37913f 100644 --- a/app/screens/create_channel/index.js +++ b/app/screens/create_channel/index.js @@ -14,7 +14,6 @@ function mapStateToProps(state, ownProps) { const {createChannel: createChannelRequest} = state.requests.channels; return { - ...ownProps, createChannelRequest, channelType: ownProps.channelType, theme: getTheme(state) diff --git a/app/screens/edit_post/index.js b/app/screens/edit_post/index.js index 5310b0f3c..c93988868 100644 --- a/app/screens/edit_post/index.js +++ b/app/screens/edit_post/index.js @@ -14,7 +14,6 @@ function mapStateToProps(state, ownProps) { const {editPost: editPostRequest} = state.requests.posts; return { - ...ownProps, editPostRequest, post: ownProps.post, theme: getTheme(state) diff --git a/app/screens/login/index.js b/app/screens/login/index.js index 168198423..681a2feb5 100644 --- a/app/screens/login/index.js +++ b/app/screens/login/index.js @@ -11,11 +11,10 @@ import {checkMfa, login} from 'mattermost-redux/actions/users'; import Login from './login.js'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { const {checkMfa: checkMfaRequest, login: loginRequest} = state.requests.users; const {config, license} = state.entities.general; return { - ...ownProps, ...state.views.login, checkMfaRequest, loginRequest, diff --git a/app/screens/login_options/index.js b/app/screens/login_options/index.js index 5c2f90601..777cb58de 100644 --- a/app/screens/login_options/index.js +++ b/app/screens/login_options/index.js @@ -7,10 +7,9 @@ import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import LoginOptions from './login_options'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { const {config, license, serverVersion} = state.entities.general; return { - ...ownProps, config, license, serverVersion, diff --git a/app/screens/more_channels/index.js b/app/screens/more_channels/index.js index 35a0eae41..ec16d4c92 100644 --- a/app/screens/more_channels/index.js +++ b/app/screens/more_channels/index.js @@ -27,7 +27,7 @@ const joinableChannels = createSelector( } ); -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { const {currentUserId} = state.entities.users; const {currentTeamId} = state.entities.teams; const {getChannels: requestStatus} = state.requests.channels; @@ -36,7 +36,6 @@ function mapStateToProps(state, ownProps) { const channels = joinableChannels(state); return { - ...ownProps, canCreateChannels: showCreateOption(config, license, General.OPEN_CHANNEL, isAdmin(roles), isSystemAdmin(roles)), currentUserId, currentTeamId, diff --git a/app/screens/more_dms/index.js b/app/screens/more_dms/index.js index 98c281076..ec444df67 100644 --- a/app/screens/more_dms/index.js +++ b/app/screens/more_dms/index.js @@ -40,7 +40,7 @@ const getUsersForMoreDirectMessages = createSelector( sortAndRemoveCurrentUser ); -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { const {searchProfiles: searchRequest} = state.requests.users; const config = getConfig(state); @@ -56,7 +56,6 @@ function mapStateToProps(state, ownProps) { } return { - ...ownProps, config, teammateNameDisplay: getTeammateNameDisplaySetting(state), allProfiles: getUsers(state), diff --git a/app/screens/more_dms/selected_users/index.js b/app/screens/more_dms/selected_users/index.js index 443f4a68c..859a2a32e 100644 --- a/app/screens/more_dms/selected_users/index.js +++ b/app/screens/more_dms/selected_users/index.js @@ -8,9 +8,8 @@ import {getUsers} from 'mattermost-redux/selectors/entities/users'; import SelectedUsers from './selected_users'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { - ...ownProps, theme: getTheme(state), profiles: getUsers(state), teammateNameDisplay: getTeammateNameDisplaySetting(state) diff --git a/app/screens/settings/advanced_settings/index.js b/app/screens/settings/advanced_settings/index.js index b14f66b59..59c43d476 100644 --- a/app/screens/settings/advanced_settings/index.js +++ b/app/screens/settings/advanced_settings/index.js @@ -9,9 +9,8 @@ import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import AdvancedSettings from './advanced_settings'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { - ...ownProps, theme: getTheme(state) }; } diff --git a/app/screens/settings/general/index.js b/app/screens/settings/general/index.js index ecca24c18..9bcb427d1 100644 --- a/app/screens/settings/general/index.js +++ b/app/screens/settings/general/index.js @@ -15,11 +15,10 @@ import {removeProtocol} from 'app/utils/url'; import Settings from './settings'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { const {config} = state.entities.general; return { - ...ownProps, config, theme: getTheme(state), errors: state.errors, diff --git a/app/screens/sso/index.js b/app/screens/sso/index.js index c9075e799..0e562632f 100644 --- a/app/screens/sso/index.js +++ b/app/screens/sso/index.js @@ -11,9 +11,8 @@ import {setStoreFromLocalData} from 'mattermost-redux/actions/general'; import SSO from './sso'; -function mapStateToProps(state, ownProps) { +function mapStateToProps(state) { return { - ...ownProps, ...state.views.selectServer, theme: getTheme(state) };