summaryrefslogtreecommitdiffstats
path: root/webapp/components/pending_post_actions.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-05-27 16:01:28 -0400
committerChristopher Speller <crspeller@gmail.com>2016-05-27 16:01:28 -0400
commit6399a94ce221be3d15e7132654c28cd953075ec6 (patch)
tree4b1927fdd8374e8bd3cb809ecb720f2689043358 /webapp/components/pending_post_actions.jsx
parentca9f348be6bf62fc888df9a710c9af155872528e (diff)
downloadchat-6399a94ce221be3d15e7132654c28cd953075ec6.tar.gz
chat-6399a94ce221be3d15e7132654c28cd953075ec6.tar.bz2
chat-6399a94ce221be3d15e7132654c28cd953075ec6.zip
PLT-2672 Refactored posts view with caching (#3054)
* Refactored posts view to use view controller design * Add post view caching * Required updates after rebase * Fixed bug where current channel not set yet was causing breakage
Diffstat (limited to 'webapp/components/pending_post_actions.jsx')
-rw-r--r--webapp/components/pending_post_actions.jsx92
1 files changed, 0 insertions, 92 deletions
diff --git a/webapp/components/pending_post_actions.jsx b/webapp/components/pending_post_actions.jsx
deleted file mode 100644
index 7528ef207..000000000
--- a/webapp/components/pending_post_actions.jsx
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import PostStore from 'stores/post_store.jsx';
-import ChannelStore from 'stores/channel_store.jsx';
-
-import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
-
-import Client from 'utils/web_client.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
-
-import Constants from 'utils/constants.jsx';
-const ActionTypes = Constants.ActionTypes;
-
-import {FormattedMessage} from 'react-intl';
-
-import React from 'react';
-
-export default class PendingPostActions extends React.Component {
- constructor(props) {
- super(props);
- this.retryPost = this.retryPost.bind(this);
- this.cancelPost = this.cancelPost.bind(this);
- this.state = {};
- }
- retryPost(e) {
- e.preventDefault();
-
- var post = this.props.post;
- Client.createPost(post,
- (data) => {
- AsyncClient.getPosts(post.channel_id);
-
- var channel = ChannelStore.get(post.channel_id);
- var member = ChannelStore.getMember(post.channel_id);
- member.msg_count = channel.total_msg_count;
- member.last_viewed_at = (new Date()).getTime();
- ChannelStore.setChannelMember(member);
-
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_POST,
- post: data
- });
- },
- () => {
- post.state = Constants.POST_FAILED;
- PostStore.updatePendingPost(post);
- this.forceUpdate();
- }
- );
-
- post.state = Constants.POST_LOADING;
- PostStore.updatePendingPost(post);
- this.forceUpdate();
- }
- cancelPost(e) {
- e.preventDefault();
-
- var post = this.props.post;
- PostStore.removePendingPost(post.channel_id, post.pending_post_id);
- this.forceUpdate();
- }
- render() {
- return (<span className='pending-post-actions'>
- <a
- className='post-retry'
- href='#'
- onClick={this.retryPost}
- >
- <FormattedMessage
- id='pending_post_actions.retry'
- defaultMessage='Retry'
- />
- </a>
- {' - '}
- <a
- className='post-cancel'
- href='#'
- onClick={this.cancelPost}
- >
- <FormattedMessage
- id='pending_post_actions.cancel'
- defaultMessage='Cancel'
- />
- </a>
- </span>);
- }
-}
-
-PendingPostActions.propTypes = {
- post: React.PropTypes.object
-};