diff options
author | Florian Orben <florian.orben@gmail.com> | 2015-10-15 21:22:08 +0200 |
---|---|---|
committer | Florian Orben <florian.orben@gmail.com> | 2015-10-15 21:25:31 +0200 |
commit | fcce3168b2776af6baf87096704465fc71fe28ac (patch) | |
tree | a45ca971ed2f0b4ca901d2238d3a71fa7a8e92fe /web/react/components/create_post.jsx | |
parent | 551b07960ed8ec36c24341f96f2b06fee25ceab3 (diff) | |
download | chat-fcce3168b2776af6baf87096704465fc71fe28ac.tar.gz chat-fcce3168b2776af6baf87096704465fc71fe28ac.tar.bz2 chat-fcce3168b2776af6baf87096704465fc71fe28ac.zip |
PLT-74: Enable Up Arrow keyboard shortcut to edit your last message
- fix bug where channel_id was not set if update_post ajax was "too fast"
- fix bug js error if there is no last post, i.e. empty channel
- renamed lastPostId to postId so it has a nicer api to be triggered from everywhere
- fix a typo
- automatically focus textarea on modal open
Diffstat (limited to 'web/react/components/create_post.jsx')
-rw-r--r-- | web/react/components/create_post.jsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index ed6818dc8..2581bdcca 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -300,14 +300,17 @@ export default class CreatePost extends React.Component { const channelId = ChannelStore.getCurrentId(); const lastPost = PostStore.getCurrentUsersLatestPost(channelId); + if (!lastPost) { + return; + } var type = (lastPost.root_id && lastPost.root_id.length > 0) ? 'Comment' : 'Post'; AppDispatcher.handleViewAction({ type: ActionTypes.RECIEVED_EDIT_POST, - refoucsId: '#post_textbox', + refocusId: '#post_textbox', title: type, message: lastPost.message, - lastPostId: lastPost.id, + postId: lastPost.id, channelId: lastPost.channel_id }); } |