diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-06-18 14:42:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-18 14:42:32 -0400 |
commit | ab67f6e257f6e8f08145a02a7b93550f99641be4 (patch) | |
tree | d33d1c58a3d229f7e37db58bc2c397ac3806c503 /webapp/components/create_post.jsx | |
parent | 0231e95f1c5a8c42ba97875f0d2301815f552974 (diff) | |
download | chat-ab67f6e257f6e8f08145a02a7b93550f99641be4.tar.gz chat-ab67f6e257f6e8f08145a02a7b93550f99641be4.tar.bz2 chat-ab67f6e257f6e8f08145a02a7b93550f99641be4.zip |
PLT-6215 Major post list refactor (#6501)
* Major post list refactor
* Fix post and thread deletion
* Fix preferences not selecting correctly
* Fix military time displaying
* Fix UP key for editing posts
* Fix ESLint error
* Various fixes and updates per feedback
* Fix for permalink view
* Revert to old scrolling method and various fixes
* Add floating timestamp, new message indicator, scroll arrows
* Update post loading for focus mode and add visibility limit
* Fix pinning posts and a react warning
* Add loading UI updates from Asaad
* Fix refreshing loop
* Temporarily bump post visibility limit
* Update infinite scrolling
* Remove infinite scrolling
Diffstat (limited to 'webapp/components/create_post.jsx')
-rw-r--r-- | webapp/components/create_post.jsx | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx index d2f64a266..124728c3d 100644 --- a/webapp/components/create_post.jsx +++ b/webapp/components/create_post.jsx @@ -77,7 +77,7 @@ export default class CreatePost extends React.Component { PostStore.clearDraftUploads(); const channelId = ChannelStore.getCurrentId(); - const draft = PostStore.getPostDraft(channelId); + const draft = PostStore.getDraft(channelId); const stats = ChannelStore.getCurrentStats(); const members = stats.member_count - 1; @@ -141,7 +141,7 @@ export default class CreatePost extends React.Component { const isReaction = REACTION_PATTERN.exec(post.message); if (post.message.indexOf('/') === 0) { - PostActions.storePostDraft(this.state.channelId, null); + PostStore.storeDraft(this.state.channelId, null); this.setState({message: '', postError: null, fileInfos: [], enableSendButton: false}); const args = {}; @@ -228,7 +228,6 @@ export default class CreatePost extends React.Component { sendMessage(post) { post.channel_id = this.state.channelId; - post.file_ids = this.state.fileInfos.map((info) => info.id); const time = Utils.getTimestamp(); const userId = UserStore.getCurrentId(); @@ -247,7 +246,7 @@ export default class CreatePost extends React.Component { }); } - PostActions.queuePost(post, false, null, + PostActions.createPost(post, this.state.fileInfos, null, (err) => { if (err.id === 'api.post.create_post.root_id.app_error') { // this should never actually happen since you can't reply from this textbox @@ -267,7 +266,7 @@ export default class CreatePost extends React.Component { const action = isReaction[1]; const emojiName = isReaction[2]; - const postId = PostStore.getLatestNonEphemeralPost(this.state.channelId).id; + const postId = PostStore.getLatestPostId(this.state.channelId); if (postId && action === '+') { PostActions.addReaction(this.state.channelId, postId, emojiName); @@ -275,7 +274,7 @@ export default class CreatePost extends React.Component { PostActions.removeReaction(this.state.channelId, postId, emojiName); } - PostActions.storePostDraft(this.state.channelId, null); + PostStore.storeDraft(this.state.channelId, null); } focusTextbox(keepFocus = false) { @@ -305,9 +304,9 @@ export default class CreatePost extends React.Component { enableSendButton }); - const draft = PostStore.getPostDraft(this.state.channelId); + const draft = PostStore.getDraft(this.state.channelId); draft.message = message; - PostActions.storePostDraft(this.state.channelId, draft); + PostStore.storeDraft(this.state.channelId, draft); } handleFileUploadChange() { @@ -315,10 +314,10 @@ export default class CreatePost extends React.Component { } handleUploadStart(clientIds, channelId) { - const draft = PostStore.getPostDraft(channelId); + const draft = PostStore.getDraft(channelId); draft.uploadsInProgress = draft.uploadsInProgress.concat(clientIds); - PostActions.storePostDraft(channelId, draft); + PostStore.storeDraft(channelId, draft); this.setState({uploadsInProgress: draft.uploadsInProgress}); @@ -328,7 +327,7 @@ export default class CreatePost extends React.Component { } handleFileUploadComplete(fileInfos, clientIds, channelId) { - const draft = PostStore.getPostDraft(channelId); + const draft = PostStore.getDraft(channelId); // remove each finished file from uploads for (let i = 0; i < clientIds.length; i++) { @@ -340,7 +339,7 @@ export default class CreatePost extends React.Component { } draft.fileInfos = draft.fileInfos.concat(fileInfos); - PostActions.storePostDraft(channelId, draft); + PostStore.storeDraft(channelId, draft); if (channelId === this.state.channelId) { this.setState({ @@ -359,14 +358,14 @@ export default class CreatePost extends React.Component { } if (clientId !== -1) { - const draft = PostStore.getPostDraft(channelId); + const draft = PostStore.getDraft(channelId); const index = draft.uploadsInProgress.indexOf(clientId); if (index !== -1) { draft.uploadsInProgress.splice(index, 1); } - PostActions.storePostDraft(channelId, draft); + PostStore.storeDraft(channelId, draft); if (channelId === this.state.channelId) { this.setState({uploadsInProgress: draft.uploadsInProgress}); @@ -396,10 +395,10 @@ export default class CreatePost extends React.Component { fileInfos.splice(index, 1); } - const draft = PostStore.getPostDraft(this.state.channelId); + const draft = PostStore.getDraft(this.state.channelId); draft.fileInfos = fileInfos; draft.uploadsInProgress = uploadsInProgress; - PostActions.storePostDraft(this.state.channelId, draft); + PostStore.storeDraft(this.state.channelId, draft); const enableSendButton = this.handleEnableSendButton(this.state.message, fileInfos); this.setState({fileInfos, uploadsInProgress, enableSendButton}); @@ -462,7 +461,7 @@ export default class CreatePost extends React.Component { onChange() { const channelId = ChannelStore.getCurrentId(); if (this.state.channelId !== channelId) { - const draft = PostStore.getPostDraft(channelId); + const draft = PostStore.getDraft(channelId); this.setState({channelId, message: draft.message, submitting: false, serverError: null, postError: null, fileInfos: draft.fileInfos, uploadsInProgress: draft.uploadsInProgress}); } @@ -483,7 +482,7 @@ export default class CreatePost extends React.Component { return this.state.fileInfos.length + this.state.uploadsInProgress.length; } - const draft = PostStore.getPostDraft(channelId); + const draft = PostStore.getDraft(channelId); return draft.fileInfos.length + draft.uploadsInProgress.length; } |