-
Notifications
You must be signed in to change notification settings - Fork 2.7k
PLT-7238 Migration of create_post.jsx to redux #210
Conversation
b465460
to
cc63407
Compare
|
||
/** | ||
* Data used in notifyiing user for @all and @channel | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just minor correction on spelling - "notifying"
this.showPostDeletedModal = this.showPostDeletedModal.bind(this); | ||
this.hidePostDeletedModal = this.hidePostDeletedModal.bind(this); | ||
this.showShortcuts = this.showShortcuts.bind(this); | ||
this.handleEmojiClick = this.handleEmojiClick.bind(this); | ||
this.handlePostError = this.handlePostError.bind(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better if these remaining bind functions are changed into its equivalent arrow functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes of course.
components/create_post/index.js
Outdated
fullWidthTextBox: get(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_FULL_SCREEN, | ||
showTutorialTip: get(state, Preferences.TUTORIAL_STEP, getCurrentUserId(state), 999), | ||
messageInHistoryItem: makeGetMessageInHistoryItem('post')(state) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same constant here.
@@ -796,7 +846,3 @@ export default class CreatePost extends React.Component { | |||
); | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add tests to CreatePost
component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was hoping to add test cases was out on a trip. Just catching up with things. I will add test cases first chance I get.
@@ -46,8 +45,6 @@ export default class CreateComment extends React.Component { | |||
constructor(props) { | |||
super(props); | |||
|
|||
this.lastTime = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning up!
@@ -415,35 +468,42 @@ export default class CreatePost extends React.Component { | |||
} | |||
|
|||
componentWillMount() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggests to have these lifecycle methods to move at top location, just after the constructor and before other functions.
}); | ||
e.preventDefault(); | ||
if (e.keyCode === Constants.KeyCodes.UP) { | ||
this.props.actions.moveHistoryIndexBack('post').then(() => this.fillMessageFromHistory()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to use constant here:
import {Posts} from 'mattermost-redux/constants';
...
... moveHistoryIndexBack(Posts.MESSAGE_TYPES.POST)
if (e.keyCode === Constants.KeyCodes.UP) { | ||
this.props.actions.moveHistoryIndexBack('post').then(() => this.fillMessageFromHistory()); | ||
} else { | ||
this.props.actions.moveHistoryIndexForward('post').then(() => this.fillMessageFromHistory()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same constants here.
@@ -46,8 +45,6 @@ export default class CreateComment extends React.Component { | |||
constructor(props) { | |||
super(props); | |||
|
|||
this.lastTime = 0; | |||
|
|||
PostStore.clearCommentDraftUploads(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oo i could change this to use redux actions
726f8f8
to
1e6d361
Compare
Hey @sudheerDev, just checking in on how this is going. Let us know if you need any help and when you're ready for review :) |
@jwilander I need to make few changes and add test cases as well. I will have a look at it over the weekend and let you know if I need any help. |
Hi, I have changed a thing in create_post.jsx to fix the arrow up to edit. the PR is #339. |
@jespino Aah thanks. I came across this the other day and I thought I broke something. |
@saturninoabril @jwilander Still working on this. Need to add some more test cases and will be done. While writing test i am finding things that could be fixed :). |
* Fix typo in audit table component * Updating i18n strings as well, as requested
* Added PostMarkdown component * Fixed failing tests * Fixing styles
this blocks users from clicking messages directly behind the NewMessageIndicator compnent
@jwilander @sudheerDev sorry for the delay on testing this; it looks good to me! Did a bunch of testing, including having multiple tabs open. Tested posts, replies, editing, deleting, long messages, formatted messages, pinning, flagging, autocomplete for emoji, users, channel names, emoji reactions, mentions, DMs, permalinks, all in combinations between two users and in center and RHS. No issues found! |
* Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** * Fix Tests * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** * Fix Tests * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** * Fix Tests * Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display * Code Review Fixes * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** * Fix Tests * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** * Fix Tests * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** * Fix Tests * Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display * Code Review Fixes * WIP: Changes to testing Work in Progress, last two tests returning errors. * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display Code Review Fixes Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** WIP: Changes to testing Work in Progress, last two tests returning errors. Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display WIP: Changes to testing Work in Progress, last two tests returning errors. Code Review Fixes Merge remote-tracking branch 'avasconcelos114/PLT-7784' into PLT-7784 Fixed test errors Fix test name Merge remote-tracking branch 'avasconcelos114/PLT-7784' into PLT-7784 * Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display Code Review Fixes Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Fix Tests Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** WIP: Changes to testing Work in Progress, last two tests returning errors. Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display Code Review Fixes Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** WIP: Changes to testing Work in Progress, last two tests returning errors. Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Migrate do_verify_email to Redux **Should wait until enzyme & react version issues are resolved** Fix Tests Finalized component tests * Snapshot test * verifyEmail function test * Test mattermost-redux action & error display WIP: Changes to testing Work in Progress, last two tests returning errors. Code Review Fixes Merge remote-tracking branch 'avasconcelos114/PLT-7784' into PLT-7784 Fixed test errors Fix test name Merge remote-tracking branch 'avasconcelos114/PLT-7784' into PLT-7784 Remove useless Adapter import in test Merge remote-tracking branch 'avasconcelos114/PLT-7784' into PLT-7784 Merge remote-tracking branch 'avasconcelos114/PLT-7784' into PLT-7784 * Fix merge issue
@sudheerDev Please give this a rebase and we're good to merge this. Thanks! |
Remove channelId and channel from state as it is avaialable via props. Remove Team store dependency. Remove User store dependency Remove Preferences store dependency. * Remove preferences from store as props change trigger render. * Add selector for preferences Move REACTION_PATTERN to utils. Remove message_history_store dependency. Add redux post actions instead of flux actions. Change bind functions to class prop arrow functions. Add proptype comments. Remove couple of unused variables. * Remove all bind functions. * Add MESSAGE_TYPES constants. Remove few postStore dependent functions. Add getCurrentUsersLatestPostId redux state selector. Add Test cases for create_post Remove uploadInprogress and filesInfo from state Remove unused variable from file_preview which causes mutation on props. Fix sort on filesInfo for file_preview component. Fix draft constant Remove postStore dependecy. Add edit dispatch from redux. Add test cases Fix failing snapshots.
Change currentChannelMembersCount default value to 1 as user is part of the channel.
…ad creation it is undefined.
This reverts commit 8292b1c.
This reverts commit 8292b1c.
Spinmint test server destroyed |
Summary
WIP: Migration of create_post.jsx to redux
Ticket Link
mattermost/mattermost#7238
Checklist