Этот коммит содержится в:
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. // See License.txt for license information.
var CreatePost = require('../components/create_post.jsx'); 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 ChannelHeader = require('../components/channel_header.jsx');
var Navbar = require('../components/navbar.jsx'); var Navbar = require('../components/navbar.jsx');
var FileUploadOverlay = require('../components/file_upload_overlay.jsx'); var FileUploadOverlay = require('../components/file_upload_overlay.jsx');
@@ -32,7 +32,7 @@ export default class CenterPanel extends React.Component {
<ChannelHeader /> <ChannelHeader />
</div> </div>
<div id='post-list'> <div id='post-list'>
<PostListContainer /> <PostsViewContainer />
</div> </div>
<div <div
className='post-create__container' className='post-create__container'

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

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

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

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

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

@@ -3,7 +3,7 @@
var UserStore = require('../stores/user_store.jsx'); var UserStore = require('../stores/user_store.jsx');
var utils = require('../utils/utils.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'); var Constants = require('../utils/constants.jsx');
@@ -146,7 +146,7 @@ export default class PostInfo extends React.Component {
return ( return (
<ul className='post-header post-info'> <ul className='post-header post-info'>
<li className='post-header-col'> <li className='post-header-col'>
<UpdatingTimeSinceCounter <TimeSince
eventTime={post.create_at} eventTime={post.create_at}
/> />
</li> </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; this.prevScrollHeight = this.refs.postlist.scrollHeight;
} }
loadMorePostsTop() { loadMorePostsTop() {
@@ -293,7 +293,7 @@ PostsView.propTypes = {
postList: React.PropTypes.object, postList: React.PropTypes.object,
scrollPost: React.PropTypes.string, scrollPost: React.PropTypes.string,
scrollType: React.PropTypes.number, scrollType: React.PropTypes.number,
postListScrolled: React.PropTypes.func.isRequired, postViewScrolled: React.PropTypes.func.isRequired,
loadMorePostsTopClicked: React.PropTypes.func.isRequired, loadMorePostsTopClicked: React.PropTypes.func.isRequired,
numPostsToDisplay: React.PropTypes.number, numPostsToDisplay: React.PropTypes.number,
introText: React.PropTypes.element, introText: React.PropTypes.element,

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

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

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

@@ -34,7 +34,7 @@ export default class SidebarRight extends React.Component {
PostStore.removeSelectedPostChangeListener(this.onSelectedChange); PostStore.removeSelectedPostChangeListener(this.onSelectedChange);
} }
componentWillUpdate() { componentWillUpdate() {
PostStore.jumpPostListSidebarOpen(); PostStore.jumpPostsViewSidebarOpen();
} }
doStrangeThings() { doStrangeThings() {
// We should have a better way to do this stuff // 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 Tooltip = ReactBootstrap.Tooltip;
var OverlayTrigger = ReactBootstrap.OverlayTrigger; var OverlayTrigger = ReactBootstrap.OverlayTrigger;
export default class UpdatingTimeSinceCounter extends React.Component { export default class TimeSince extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
} }
@@ -41,10 +41,10 @@ export default class UpdatingTimeSinceCounter extends React.Component {
); );
} }
} }
UpdatingTimeSinceCounter.defaultProps = { TimeSince.defaultProps = {
eventTime: 0 eventTime: 0
}; };
UpdatingTimeSinceCounter.propTypes = { TimeSince.propTypes = {
eventTime: React.PropTypes.number.isRequired eventTime: React.PropTypes.number.isRequired
}; };

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

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

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

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