From ab67f6e257f6e8f08145a02a7b93550f99641be4 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Sun, 18 Jun 2017 14:42:32 -0400 Subject: 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 --- webapp/stores/reaction_store.jsx | 92 ---------------------------------------- 1 file changed, 92 deletions(-) delete mode 100644 webapp/stores/reaction_store.jsx (limited to 'webapp/stores/reaction_store.jsx') diff --git a/webapp/stores/reaction_store.jsx b/webapp/stores/reaction_store.jsx deleted file mode 100644 index ebebd4374..000000000 --- a/webapp/stores/reaction_store.jsx +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; -import Constants from 'utils/constants.jsx'; -import EventEmitter from 'events'; - -const ActionTypes = Constants.ActionTypes; - -const CHANGE_EVENT = 'changed'; - -class ReactionStore extends EventEmitter { - constructor() { - super(); - - this.dispatchToken = AppDispatcher.register(this.handleEventPayload.bind(this)); - - this.reactions = new Map(); - - this.setMaxListeners(600); - } - - addChangeListener(postId, callback) { - this.on(CHANGE_EVENT + postId, callback); - } - - removeChangeListener(postId, callback) { - this.removeListener(CHANGE_EVENT + postId, callback); - } - - emitChange(postId) { - this.emit(CHANGE_EVENT + postId, postId); - } - - setReactions(postId, reactions) { - this.reactions.set(postId, reactions); - } - - addReaction(postId, reaction) { - let reactions = this.getReactions(postId) || []; - - // Make sure not to add duplicates - const existingIndex = reactions.findIndex((existing) => { - return existing.user_id === reaction.user_id && existing.post_id === reaction.post_id && existing.emoji_name === reaction.emoji_name; - }); - - if (existingIndex === -1) { - reactions = [...reactions, reaction]; - } - - this.setReactions(postId, reactions); - } - - removeReaction(postId, reaction) { - let reactions = this.getReactions(postId) || []; - - const existingIndex = reactions.findIndex((existing) => { - return existing.user_id === reaction.user_id && existing.post_id === reaction.post_id && existing.emoji_name === reaction.emoji_name; - }); - - if (existingIndex !== -1) { - reactions = reactions.slice(0, existingIndex).concat(reactions.slice(existingIndex + 1)); - } - - this.setReactions(postId, reactions); - } - - getReactions(postId) { - return this.reactions.get(postId); - } - - handleEventPayload(payload) { - const action = payload.action; - - switch (action.type) { - case ActionTypes.RECEIVED_REACTIONS: - this.setReactions(action.postId, action.reactions); - this.emitChange(action.postId); - break; - case ActionTypes.ADDED_REACTION: - this.addReaction(action.postId, action.reaction); - this.emitChange(action.postId); - break; - case ActionTypes.REMOVED_REACTION: - this.removeReaction(action.postId, action.reaction); - this.emitChange(action.postId); - break; - } - } -} - -export default new ReactionStore(); -- cgit v1.2.3-1-g7c22