From 1e7ac66e3bcc796c705ed6a833161cab6bd5b65d Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 2 Nov 2015 08:37:17 -0500 Subject: Some renaming --- web/react/components/center_panel.jsx | 4 +- web/react/components/create_post.jsx | 2 +- web/react/components/edit_post_modal.jsx | 2 +- web/react/components/post_info.jsx | 4 +- web/react/components/post_list_container.jsx | 264 --------------------- web/react/components/posts_view.jsx | 4 +- web/react/components/posts_view_container.jsx | 264 +++++++++++++++++++++ web/react/components/rhs_thread.jsx | 10 +- web/react/components/sidebar_right.jsx | 2 +- web/react/components/time_since.jsx | 50 ++++ .../components/updating_time_since_counter.jsx | 50 ---- web/react/stores/post_store.jsx | 46 ++-- web/react/utils/constants.jsx | 2 +- 13 files changed, 352 insertions(+), 352 deletions(-) delete mode 100644 web/react/components/post_list_container.jsx create mode 100644 web/react/components/posts_view_container.jsx create mode 100644 web/react/components/time_since.jsx delete mode 100644 web/react/components/updating_time_since_counter.jsx (limited to 'web/react') diff --git a/web/react/components/center_panel.jsx b/web/react/components/center_panel.jsx index 7cb55898f..b871fe81a 100644 --- a/web/react/components/center_panel.jsx +++ b/web/react/components/center_panel.jsx @@ -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 {
- +
  • -
  • diff --git a/web/react/components/post_list_container.jsx b/web/react/components/post_list_container.jsx deleted file mode 100644 index 90468ab66..000000000 --- a/web/react/components/post_list_container.jsx +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -const PostsView = require('./posts_view.jsx'); -const ChannelStore = require('../stores/channel_store.jsx'); -const PostStore = require('../stores/post_store.jsx'); -const Constants = require('../utils/constants.jsx'); -const ActionTypes = Constants.ActionTypes; -const Utils = require('../utils/utils.jsx'); -const Client = require('../utils/client.jsx'); -const AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); -const AsyncClient = require('../utils/async_client.jsx'); -const LoadingScreen = require('./loading_screen.jsx'); - -import {createChannelIntroMessage} from '../utils/channel_intro_mssages.jsx'; - -export default class PostListContainer 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.loadMorePostsTop = this.loadMorePostsTop.bind(this); - this.postsLoaded = this.postsLoaded.bind(this); - this.postsLoadedFailure = this.postsLoadedFailure.bind(this); - this.handlePostListJumpRequest = this.handlePostListJumpRequest.bind(this); - - const currentChannelId = ChannelStore.getCurrentId(); - const state = { - scrollType: PostsView.SCROLL_TYPE_BOTTOM, - scrollPost: null, - numPostsToDisplay: Constants.POST_CHUNK_SIZE - }; - if (currentChannelId) { - Object.assign(state, { - currentChannelIndex: 0, - channels: [currentChannelId], - postLists: [this.getChannelPosts(currentChannelId)] - }); - } else { - Object.assign(state, { - currentChannelIndex: null, - channels: [], - postLists: [] - }); - } - - this.state = state; - } - componentDidMount() { - ChannelStore.addChangeListener(this.onChannelChange); - ChannelStore.addLeaveListener(this.onChannelLeave); - PostStore.addChangeListener(this.onPostsChange); - PostStore.addPostListJumpListener(this.handlePostListJumpRequest); - } - componentWillUnmount() { - ChannelStore.removeChangeListener(this.onChannelChange); - ChannelStore.removeLeaveListener(this.onChannelLeave); - PostStore.removeChangeListener(this.onPostsChange); - PostStore.removePostListJumpListener(this.handlePostListJumpRequest); - } - handlePostListJumpRequest(type, post) { - switch (type) { - case Constants.PostListJumpTypes.BOTTOM: - this.setState({scrollType: PostsView.SCROLL_TYPE_BOTTOM}); - break; - case Constants.PostListJumpTypes.POST: - this.setState({ - scrollType: PostsView.SCROLL_TYPE_POST, - scrollPost: post - }); - break; - case Constants.PostListJumpTypes.SIDEBAR_OPEN: - this.setState({scrollType: PostsView.SIDEBAR_OPEN}); - break; - } - } - onChannelChange() { - const postLists = Object.assign({}, this.state.postLists); - const channels = this.state.channels.slice(); - const channelId = ChannelStore.getCurrentId(); - - // Has the channel really changed? - if (channelId === channels[this.state.currentChannelIndex]) { - return; - } - - PostStore.clearUnseenDeletedPosts(channelId); - - let lastViewed = Number.MAX_VALUE; - const member = ChannelStore.getMember(channelId); - if (member != null) { - lastViewed = member.last_viewed_at; - } - - let newIndex = channels.indexOf(channelId); - if (newIndex === -1) { - newIndex = channels.length; - channels.push(channelId); - postLists[newIndex] = this.getChannelPosts(channelId); - } - this.setState({ - currentChannelIndex: newIndex, - currentLastViewed: lastViewed, - scrollType: PostsView.SCROLL_TYPE_BOTTOM, - channels, - postLists}); - } - onChannelLeave(id) { - const postLists = Object.assign({}, this.state.postLists); - const channels = this.state.channels.slice(); - const index = channels.indexOf(id); - if (index !== -1) { - postLists.splice(index, 1); - channels.splice(index, 1); - } - this.setState({channels, postLists}); - } - onPostsChange() { - const channels = this.state.channels; - const postLists = Object.assign({}, this.state.postLists); - const newPostList = this.getChannelPosts(channels[this.state.currentChannelIndex]); - - postLists[this.state.currentChannelIndex] = newPostList; - this.setState({postLists}); - } - getChannelPosts(id) { - const postList = PostStore.getPosts(id); - - if (postList != null) { - const deletedPosts = PostStore.getUnseenDeletedPosts(id); - - if (deletedPosts && Object.keys(deletedPosts).length > 0) { - for (const pid in deletedPosts) { - if (deletedPosts.hasOwnProperty(pid)) { - postList.posts[pid] = deletedPosts[pid]; - postList.order.unshift(pid); - } - } - - postList.order.sort((a, b) => { - if (postList.posts[a].create_at > postList.posts[b].create_at) { - return -1; - } - if (postList.posts[a].create_at < postList.posts[b].create_at) { - return 1; - } - return 0; - }); - } - - const pendingPostList = PostStore.getPendingPosts(id); - - if (pendingPostList) { - postList.order = pendingPostList.order.concat(postList.order); - for (const ppid in pendingPostList.posts) { - if (pendingPostList.posts.hasOwnProperty(ppid)) { - postList.posts[ppid] = pendingPostList.posts[ppid]; - } - } - } - } - - return postList; - } - loadMorePostsTop() { - const postLists = this.state.postLists; - const channels = this.state.channels; - const currentChannelId = channels[this.state.currentChannelIndex]; - const currentPostList = postLists[this.state.currentChannelIndex]; - - this.setState({numPostsToDisplay: this.state.numPostsToDisplay + Constants.POST_CHUNK_SIZE}); - - Client.getPostsPage( - currentChannelId, - currentPostList.order.length, - Constants.POST_CHUNK_SIZE, - this.postsLoaded, - this.postsLoadedFailure - ); - } - postsLoaded(data) { - if (!data) { - return; - } - - if (data.order.length === 0) { - return; - } - - const postLists = this.state.postLists; - const currentPostList = postLists[this.state.currentChannelIndex]; - const channels = this.state.channels; - const currentChannelId = channels[this.state.currentChannelIndex]; - - var newPostList = {}; - newPostList.posts = Object.assign(currentPostList.posts, data.posts); - newPostList.order = currentPostList.order.concat(data.order); - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECIEVED_POSTS, - id: currentChannelId, - post_list: newPostList - }); - - Client.getProfiles(); - } - postsLoadedFailure(err) { - AsyncClient.dispatchError(err, 'getPosts'); - } - handlePostListScroll(atBottom) { - if (atBottom) { - this.setState({scrollType: PostsView.SCROLL_TYPE_BOTTOM}); - } else { - this.setState({scrollType: PostsView.SCROLL_TYPE_FREE}); - } - } - shouldComponentUpdate(nextProps, nextState) { - if (Utils.areStatesEqual(this.state, nextState)) { - return false; - } - - return true; - } - render() { - const postLists = this.state.postLists; - const channels = this.state.channels; - const currentChannelId = channels[this.state.currentChannelIndex]; - const channel = ChannelStore.get(currentChannelId); - - const postListCtls = []; - for (let i = 0; i < channels.length; i++) { - const isActive = (channels[i] === currentChannelId); - postListCtls.push( - - ); - if ((!postLists[i] || !channel) && isActive) { - postListCtls.push( - - ); - } - } - - return ( -
    {postListCtls}
    - ); - } -} diff --git a/web/react/components/posts_view.jsx b/web/react/components/posts_view.jsx index 57e7abd35..5cefb4885 100644 --- a/web/react/components/posts_view.jsx +++ b/web/react/components/posts_view.jsx @@ -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, diff --git a/web/react/components/posts_view_container.jsx b/web/react/components/posts_view_container.jsx new file mode 100644 index 000000000..9eda2a158 --- /dev/null +++ b/web/react/components/posts_view_container.jsx @@ -0,0 +1,264 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +const PostsView = require('./posts_view.jsx'); +const ChannelStore = require('../stores/channel_store.jsx'); +const PostStore = require('../stores/post_store.jsx'); +const Constants = require('../utils/constants.jsx'); +const ActionTypes = Constants.ActionTypes; +const Utils = require('../utils/utils.jsx'); +const Client = require('../utils/client.jsx'); +const AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); +const AsyncClient = require('../utils/async_client.jsx'); +const LoadingScreen = require('./loading_screen.jsx'); + +import {createChannelIntroMessage} from '../utils/channel_intro_mssages.jsx'; + +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.handlePostsViewScroll = this.handlePostsViewScroll.bind(this); + this.loadMorePostsTop = this.loadMorePostsTop.bind(this); + this.postsLoaded = this.postsLoaded.bind(this); + this.postsLoadedFailure = this.postsLoadedFailure.bind(this); + this.handlePostsViewJumpRequest = this.handlePostsViewJumpRequest.bind(this); + + const currentChannelId = ChannelStore.getCurrentId(); + const state = { + scrollType: PostsView.SCROLL_TYPE_BOTTOM, + scrollPost: null, + numPostsToDisplay: Constants.POST_CHUNK_SIZE + }; + if (currentChannelId) { + Object.assign(state, { + currentChannelIndex: 0, + channels: [currentChannelId], + postLists: [this.getChannelPosts(currentChannelId)] + }); + } else { + Object.assign(state, { + currentChannelIndex: null, + channels: [], + postLists: [] + }); + } + + this.state = state; + } + componentDidMount() { + ChannelStore.addChangeListener(this.onChannelChange); + ChannelStore.addLeaveListener(this.onChannelLeave); + PostStore.addChangeListener(this.onPostsChange); + PostStore.addPostsViewJumpListener(this.handlePostsViewJumpRequest); + } + componentWillUnmount() { + ChannelStore.removeChangeListener(this.onChannelChange); + ChannelStore.removeLeaveListener(this.onChannelLeave); + PostStore.removeChangeListener(this.onPostsChange); + PostStore.removePostsViewJumpListener(this.handlePostsViewJumpRequest); + } + handlePostsViewJumpRequest(type, post) { + switch (type) { + case Constants.PostsViewJumpTypes.BOTTOM: + this.setState({scrollType: PostsView.SCROLL_TYPE_BOTTOM}); + break; + case Constants.PostsViewJumpTypes.POST: + this.setState({ + scrollType: PostsView.SCROLL_TYPE_POST, + scrollPost: post + }); + break; + case Constants.PostsViewJumpTypes.SIDEBAR_OPEN: + this.setState({scrollType: PostsView.SIDEBAR_OPEN}); + break; + } + } + onChannelChange() { + const postLists = Object.assign({}, this.state.postLists); + const channels = this.state.channels.slice(); + const channelId = ChannelStore.getCurrentId(); + + // Has the channel really changed? + if (channelId === channels[this.state.currentChannelIndex]) { + return; + } + + PostStore.clearUnseenDeletedPosts(channelId); + + let lastViewed = Number.MAX_VALUE; + const member = ChannelStore.getMember(channelId); + if (member != null) { + lastViewed = member.last_viewed_at; + } + + let newIndex = channels.indexOf(channelId); + if (newIndex === -1) { + newIndex = channels.length; + channels.push(channelId); + postLists[newIndex] = this.getChannelPosts(channelId); + } + this.setState({ + currentChannelIndex: newIndex, + currentLastViewed: lastViewed, + scrollType: PostsView.SCROLL_TYPE_BOTTOM, + channels, + postLists}); + } + onChannelLeave(id) { + const postLists = Object.assign({}, this.state.postLists); + const channels = this.state.channels.slice(); + const index = channels.indexOf(id); + if (index !== -1) { + postLists.splice(index, 1); + channels.splice(index, 1); + } + this.setState({channels, postLists}); + } + onPostsChange() { + const channels = this.state.channels; + const postLists = Object.assign({}, this.state.postLists); + const newPostsView = this.getChannelPosts(channels[this.state.currentChannelIndex]); + + postLists[this.state.currentChannelIndex] = newPostsView; + this.setState({postLists}); + } + getChannelPosts(id) { + const postList = PostStore.getPosts(id); + + if (postList != null) { + const deletedPosts = PostStore.getUnseenDeletedPosts(id); + + if (deletedPosts && Object.keys(deletedPosts).length > 0) { + for (const pid in deletedPosts) { + if (deletedPosts.hasOwnProperty(pid)) { + postList.posts[pid] = deletedPosts[pid]; + postList.order.unshift(pid); + } + } + + postList.order.sort((a, b) => { + if (postList.posts[a].create_at > postList.posts[b].create_at) { + return -1; + } + if (postList.posts[a].create_at < postList.posts[b].create_at) { + return 1; + } + return 0; + }); + } + + const pendingPostList = PostStore.getPendingPosts(id); + + if (pendingPostList) { + postList.order = pendingPostList.order.concat(postList.order); + for (const ppid in pendingPostList.posts) { + if (pendingPostList.posts.hasOwnProperty(ppid)) { + postList.posts[ppid] = pendingPostList.posts[ppid]; + } + } + } + } + + return postList; + } + loadMorePostsTop() { + const postLists = this.state.postLists; + const channels = this.state.channels; + const currentChannelId = channels[this.state.currentChannelIndex]; + const currentPostList = postLists[this.state.currentChannelIndex]; + + this.setState({numPostsToDisplay: this.state.numPostsToDisplay + Constants.POST_CHUNK_SIZE}); + + Client.getPostsPage( + currentChannelId, + currentPostList.order.length, + Constants.POST_CHUNK_SIZE, + this.postsLoaded, + this.postsLoadedFailure + ); + } + postsLoaded(data) { + if (!data) { + return; + } + + if (data.order.length === 0) { + return; + } + + const postLists = this.state.postLists; + const currentPostList = postLists[this.state.currentChannelIndex]; + const channels = this.state.channels; + const currentChannelId = channels[this.state.currentChannelIndex]; + + var newPostList = {}; + newPostList.posts = Object.assign(currentPostList.posts, data.posts); + newPostList.order = currentPostList.order.concat(data.order); + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECIEVED_POSTS, + id: currentChannelId, + post_list: newPostList + }); + + Client.getProfiles(); + } + postsLoadedFailure(err) { + AsyncClient.dispatchError(err, 'getPosts'); + } + handlePostsViewScroll(atBottom) { + if (atBottom) { + this.setState({scrollType: PostsView.SCROLL_TYPE_BOTTOM}); + } else { + this.setState({scrollType: PostsView.SCROLL_TYPE_FREE}); + } + } + shouldComponentUpdate(nextProps, nextState) { + if (Utils.areStatesEqual(this.state, nextState)) { + return false; + } + + return true; + } + render() { + const postLists = this.state.postLists; + const channels = this.state.channels; + const currentChannelId = channels[this.state.currentChannelIndex]; + const channel = ChannelStore.get(currentChannelId); + + const postListCtls = []; + for (let i = 0; i < channels.length; i++) { + const isActive = (channels[i] === currentChannelId); + postListCtls.push( + + ); + if ((!postLists[i] || !channel) && isActive) { + postListCtls.push( + + ); + } + } + + return ( +
    {postListCtls}
    + ); + } +} diff --git a/web/react/components/rhs_thread.jsx b/web/react/components/rhs_thread.jsx index bcdec2870..fe57bed28 100644 --- a/web/react/components/rhs_thread.jsx +++ b/web/react/components/rhs_thread.jsx @@ -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]; } } } diff --git a/web/react/components/sidebar_right.jsx b/web/react/components/sidebar_right.jsx index 020db6d88..e2ef60959 100644 --- a/web/react/components/sidebar_right.jsx +++ b/web/react/components/sidebar_right.jsx @@ -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 diff --git a/web/react/components/time_since.jsx b/web/react/components/time_since.jsx new file mode 100644 index 000000000..c37739b9c --- /dev/null +++ b/web/react/components/time_since.jsx @@ -0,0 +1,50 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +var Utils = require('../utils/utils.jsx'); + +var Tooltip = ReactBootstrap.Tooltip; +var OverlayTrigger = ReactBootstrap.OverlayTrigger; + +export default class TimeSince extends React.Component { + constructor(props) { + super(props); + } + componentDidMount() { + this.intervalId = setInterval(() => { + this.forceUpdate(); + }, 30000); + } + componentWillUnmount() { + clearInterval(this.intervalId); + } + render() { + const displayDate = Utils.displayDate(this.props.eventTime); + const displayTime = Utils.displayTime(this.props.eventTime); + + const tooltip = ( + + {displayDate + ' at ' + displayTime} + + ); + + return ( + + + + ); + } +} +TimeSince.defaultProps = { + eventTime: 0 +}; + +TimeSince.propTypes = { + eventTime: React.PropTypes.number.isRequired +}; diff --git a/web/react/components/updating_time_since_counter.jsx b/web/react/components/updating_time_since_counter.jsx deleted file mode 100644 index d06ffb842..000000000 --- a/web/react/components/updating_time_since_counter.jsx +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -var Utils = require('../utils/utils.jsx'); - -var Tooltip = ReactBootstrap.Tooltip; -var OverlayTrigger = ReactBootstrap.OverlayTrigger; - -export default class UpdatingTimeSinceCounter extends React.Component { - constructor(props) { - super(props); - } - componentDidMount() { - this.intervalId = setInterval(() => { - this.forceUpdate(); - }, 30000); - } - componentWillUnmount() { - clearInterval(this.intervalId); - } - render() { - const displayDate = Utils.displayDate(this.props.eventTime); - const displayTime = Utils.displayTime(this.props.eventTime); - - const tooltip = ( - - {displayDate + ' at ' + displayTime} - - ); - - return ( - - - - ); - } -} -UpdatingTimeSinceCounter.defaultProps = { - eventTime: 0 -}; - -UpdatingTimeSinceCounter.propTypes = { - eventTime: React.PropTypes.number.isRequired -}; diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 19b200ac8..0fe253310 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -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) { diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index c97e4d982..8884d1d10 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -351,7 +351,7 @@ module.exports = { java: 'Java', ini: 'ini' }, - PostListJumpTypes: { + PostsViewJumpTypes: { BOTTOM: 1, POST: 2, SIDEBAR_OPEN: 3 -- cgit v1.2.3-1-g7c22