Этот коммит содержится в:
Christopher Speller
2015-11-02 08:37:17 -05:00
родитель b9a3ff74dd
Коммит 1e7ac66e3b
11 изменённых файлов: 54 добавлений и 54 удалений

Просмотреть файл

@@ -2,7 +2,7 @@
// See License.txt for license information.
var CreatePost = require('../components/create_post.jsx');
var PostListContainer = require('../components/post_list_container.jsx');
var PostsViewContainer = require('../components/posts_view_container.jsx');
var ChannelHeader = require('../components/channel_header.jsx');
var Navbar = require('../components/navbar.jsx');
var FileUploadOverlay = require('../components/file_upload_overlay.jsx');
@@ -32,7 +32,7 @@ export default class CenterPanel extends React.Component {
<ChannelHeader />
</div>
<div id='post-list'>
<PostListContainer />
<PostsViewContainer />
</div>
<div
className='post-create__container'

Просмотреть файл

@@ -176,7 +176,7 @@ export default class CreatePost extends React.Component {
PostStore.storePendingPost(post);
PostStore.storeDraft(channel.id, null);
PostStore.jumpPostListBottom();
PostStore.jumpPostsViewToBottom();
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
Client.createPost(post, channel,

Просмотреть файл

@@ -120,7 +120,7 @@ export default class EditPostModal extends React.Component {
PreferenceStore.addChangeListener(this.onPreferenceChange);
}
componentWillUnmount() {
PostStore.removeEditPostListener(this.handleEditPostEvent);
PostStore.removeEditPostListner(this.handleEditPostEvent);
PreferenceStore.removeChangeListener(this.onPreferenceChange);
}
render() {

Просмотреть файл

@@ -3,7 +3,7 @@
var UserStore = require('../stores/user_store.jsx');
var utils = require('../utils/utils.jsx');
var UpdatingTimeSinceCounter = require('./updating_time_since_counter.jsx');
var TimeSince = require('./time_since.jsx');
var Constants = require('../utils/constants.jsx');
@@ -146,7 +146,7 @@ export default class PostInfo extends React.Component {
return (
<ul className='post-header post-info'>
<li className='post-header-col'>
<UpdatingTimeSinceCounter
<TimeSince
eventTime={post.create_at}
/>
</li>

Просмотреть файл

@@ -47,7 +47,7 @@ export default class PostsView extends React.Component {
// --- --------
this.props.postListScrolled(this.isAtBottom());
this.props.postViewScrolled(this.isAtBottom());
this.prevScrollHeight = this.refs.postlist.scrollHeight;
}
loadMorePostsTop() {
@@ -293,7 +293,7 @@ PostsView.propTypes = {
postList: React.PropTypes.object,
scrollPost: React.PropTypes.string,
scrollType: React.PropTypes.number,
postListScrolled: React.PropTypes.func.isRequired,
postViewScrolled: React.PropTypes.func.isRequired,
loadMorePostsTopClicked: React.PropTypes.func.isRequired,
numPostsToDisplay: React.PropTypes.number,
introText: React.PropTypes.element,

Просмотреть файл

@@ -14,18 +14,18 @@ const LoadingScreen = require('./loading_screen.jsx');
import {createChannelIntroMessage} from '../utils/channel_intro_mssages.jsx';
export default class PostListContainer extends React.Component {
export default class PostsViewContainer extends React.Component {
constructor() {
super();
this.onChannelChange = this.onChannelChange.bind(this);
this.onChannelLeave = this.onChannelLeave.bind(this);
this.onPostsChange = this.onPostsChange.bind(this);
this.handlePostListScroll = this.handlePostListScroll.bind(this);
this.handlePostsViewScroll = this.handlePostsViewScroll.bind(this);
this.loadMorePostsTop = this.loadMorePostsTop.bind(this);
this.postsLoaded = this.postsLoaded.bind(this);
this.postsLoadedFailure = this.postsLoadedFailure.bind(this);
this.handlePostListJumpRequest = this.handlePostListJumpRequest.bind(this);
this.handlePostsViewJumpRequest = this.handlePostsViewJumpRequest.bind(this);
const currentChannelId = ChannelStore.getCurrentId();
const state = {
@@ -53,26 +53,26 @@ export default class PostListContainer extends React.Component {
ChannelStore.addChangeListener(this.onChannelChange);
ChannelStore.addLeaveListener(this.onChannelLeave);
PostStore.addChangeListener(this.onPostsChange);
PostStore.addPostListJumpListener(this.handlePostListJumpRequest);
PostStore.addPostsViewJumpListener(this.handlePostsViewJumpRequest);
}
componentWillUnmount() {
ChannelStore.removeChangeListener(this.onChannelChange);
ChannelStore.removeLeaveListener(this.onChannelLeave);
PostStore.removeChangeListener(this.onPostsChange);
PostStore.removePostListJumpListener(this.handlePostListJumpRequest);
PostStore.removePostsViewJumpListener(this.handlePostsViewJumpRequest);
}
handlePostListJumpRequest(type, post) {
handlePostsViewJumpRequest(type, post) {
switch (type) {
case Constants.PostListJumpTypes.BOTTOM:
case Constants.PostsViewJumpTypes.BOTTOM:
this.setState({scrollType: PostsView.SCROLL_TYPE_BOTTOM});
break;
case Constants.PostListJumpTypes.POST:
case Constants.PostsViewJumpTypes.POST:
this.setState({
scrollType: PostsView.SCROLL_TYPE_POST,
scrollPost: post
});
break;
case Constants.PostListJumpTypes.SIDEBAR_OPEN:
case Constants.PostsViewJumpTypes.SIDEBAR_OPEN:
this.setState({scrollType: PostsView.SIDEBAR_OPEN});
break;
}
@@ -121,9 +121,9 @@ export default class PostListContainer extends React.Component {
onPostsChange() {
const channels = this.state.channels;
const postLists = Object.assign({}, this.state.postLists);
const newPostList = this.getChannelPosts(channels[this.state.currentChannelIndex]);
const newPostsView = this.getChannelPosts(channels[this.state.currentChannelIndex]);
postLists[this.state.currentChannelIndex] = newPostList;
postLists[this.state.currentChannelIndex] = newPostsView;
this.setState({postLists});
}
getChannelPosts(id) {
@@ -210,7 +210,7 @@ export default class PostListContainer extends React.Component {
postsLoadedFailure(err) {
AsyncClient.dispatchError(err, 'getPosts');
}
handlePostListScroll(atBottom) {
handlePostsViewScroll(atBottom) {
if (atBottom) {
this.setState({scrollType: PostsView.SCROLL_TYPE_BOTTOM});
} else {
@@ -240,7 +240,7 @@ export default class PostListContainer extends React.Component {
postList={postLists[i]}
scrollType={this.state.scrollType}
scrollPost={this.state.scrollPost}
postListScrolled={this.handlePostListScroll}
postViewScrolled={this.handlePostsViewScroll}
loadMorePostsTopClicked={this.loadMorePostsTop}
numPostsToDisplay={this.state.numPostsToDisplay}
introText={channel ? createChannelIntroMessage(channel) : null}

Просмотреть файл

@@ -34,12 +34,12 @@ export default class RhsThread extends React.Component {
}
var channelId = postList.posts[postList.order[0]].channel_id;
var pendingPostList = PostStore.getPendingPosts(channelId);
var pendingPostsList = PostStore.getPendingPosts(channelId);
if (pendingPostList) {
for (var pid in pendingPostList.posts) {
if (pendingPostList.posts.hasOwnProperty(pid)) {
postList.posts[pid] = pendingPostList.posts[pid];
if (pendingPostsList) {
for (var pid in pendingPostsList.posts) {
if (pendingPostsList.posts.hasOwnProperty(pid)) {
postList.posts[pid] = pendingPostsList.posts[pid];
}
}
}

Просмотреть файл

@@ -34,7 +34,7 @@ export default class SidebarRight extends React.Component {
PostStore.removeSelectedPostChangeListener(this.onSelectedChange);
}
componentWillUpdate() {
PostStore.jumpPostListSidebarOpen();
PostStore.jumpPostsViewSidebarOpen();
}
doStrangeThings() {
// We should have a better way to do this stuff

Просмотреть файл

@@ -6,7 +6,7 @@ var Utils = require('../utils/utils.jsx');
var Tooltip = ReactBootstrap.Tooltip;
var OverlayTrigger = ReactBootstrap.OverlayTrigger;
export default class UpdatingTimeSinceCounter extends React.Component {
export default class TimeSince extends React.Component {
constructor(props) {
super(props);
}
@@ -41,10 +41,10 @@ export default class UpdatingTimeSinceCounter extends React.Component {
);
}
}
UpdatingTimeSinceCounter.defaultProps = {
TimeSince.defaultProps = {
eventTime: 0
};
UpdatingTimeSinceCounter.propTypes = {
TimeSince.propTypes = {
eventTime: React.PropTypes.number.isRequired
};

Просмотреть файл

@@ -14,7 +14,7 @@ var ActionTypes = Constants.ActionTypes;
var CHANGE_EVENT = 'change';
var SELECTED_POST_CHANGE_EVENT = 'selected_post_change';
var EDIT_POST_EVENT = 'edit_post';
var POST_LIST_JUMP_EVENT = 'post_list_jump';
var POSTS_VIEW_JUMP_EVENT = 'post_list_jump';
class PostStoreClass extends EventEmitter {
constructor() {
@@ -30,11 +30,11 @@ class PostStoreClass extends EventEmitter {
this.emitEditPost = this.emitEditPost.bind(this);
this.addEditPostListener = this.addEditPostListener.bind(this);
this.removeEditPostListener = this.removeEditPostListener.bind(this);
this.removeEditPostListener = this.removeEditPostListner.bind(this);
this.emitPostListJump = this.emitPostListJump.bind(this);
this.addPostListJumpListener = this.addPostListJumpListener.bind(this);
this.removePostListJumpListener = this.removePostListJumpListener.bind(this);
this.emitPostsViewJump = this.emitPostsViewJump.bind(this);
this.addPostsViewJumpListener = this.addPostsViewJumpListener.bind(this);
this.removePostsViewJumpListener = this.removePostsViewJumpListener.bind(this);
this.getCurrentPosts = this.getCurrentPosts.bind(this);
this.storePosts = this.storePosts.bind(this);
@@ -101,32 +101,32 @@ class PostStoreClass extends EventEmitter {
this.on(EDIT_POST_EVENT, callback);
}
removeEditPostListener(callback) {
removeEditPostListner(callback) {
this.removeListener(EDIT_POST_EVENT, callback);
}
emitPostListJump(type, post) {
this.emit(POST_LIST_JUMP_EVENT, type, post);
emitPostsViewJump(type, post) {
this.emit(POSTS_VIEW_JUMP_EVENT, type, post);
}
addPostListJumpListener(callback) {
this.on(POST_LIST_JUMP_EVENT, callback);
addPostsViewJumpListener(callback) {
this.on(POSTS_VIEW_JUMP_EVENT, callback);
}
removePostListJumpListener(callback) {
this.removeListener(POST_LIST_JUMP_EVENT, callback);
removePostsViewJumpListener(callback) {
this.removeListener(POSTS_VIEW_JUMP_EVENT, callback);
}
jumpPostListBottom() {
this.emitPostListJump(Constants.PostListJumpTypes.BOTTOM, null);
jumpPostsViewToBottom() {
this.emitPostsViewJump(Constants.PostsViewJumpTypes.BOTTOM, null);
}
jumpPostListToPost(post) {
this.emitPostListJump(Constants.PostListJumpTypes.POST, post);
jumpPostsViewToPost(post) {
this.emitPostsViewJump(Constants.PostsViewJumpTypes.POST, post);
}
jumpPostListSidebarOpen() {
this.emitPostListJump(Constants.PostListJumpTypes.SIDEBAR_OPEN, null);
jumpPostsViewSidebarOpen() {
this.emitPostsViewJump(Constants.PostsViewJumpTypes.SIDEBAR_OPEN, null);
}
getCurrentPosts() {
@@ -137,16 +137,16 @@ class PostStoreClass extends EventEmitter {
}
return null;
}
storePosts(channelId, newPostList) {
if (isPostListNull(newPostList)) {
storePosts(channelId, newPostsView) {
if (isPostListNull(newPostsView)) {
return;
}
var postList = makePostListNonNull(this.getPosts(channelId));
for (const pid in newPostList.posts) {
if (newPostList.posts.hasOwnProperty(pid)) {
const np = newPostList.posts[pid];
for (const pid in newPostsView.posts) {
if (newPostsView.posts.hasOwnProperty(pid)) {
const np = newPostsView.posts[pid];
if (np.delete_at === 0) {
postList.posts[pid] = np;
if (postList.order.indexOf(pid) === -1) {

Просмотреть файл

@@ -351,7 +351,7 @@ module.exports = {
java: 'Java',
ini: 'ini'
},
PostListJumpTypes: {
PostsViewJumpTypes: {
BOTTOM: 1,
POST: 2,
SIDEBAR_OPEN: 3