diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:04:13 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-09-06 23:11:58 -0700 |
commit | d8bd57901e33a7057e26e782e295099ffcc0da89 (patch) | |
tree | e12dfc8cad42b1576756d19d7fbfd82646a009bf /webapp/stores/message_history_store.jsx | |
parent | 7bc8e9a08dfde56387f946fdf5086252aa4d0491 (diff) | |
download | chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.gz chat-d8bd57901e33a7057e26e782e295099ffcc0da89.tar.bz2 chat-d8bd57901e33a7057e26e782e295099ffcc0da89.zip |
Removing webapp
Diffstat (limited to 'webapp/stores/message_history_store.jsx')
-rw-r--r-- | webapp/stores/message_history_store.jsx | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/webapp/stores/message_history_store.jsx b/webapp/stores/message_history_store.jsx deleted file mode 100644 index 6c758fb05..000000000 --- a/webapp/stores/message_history_store.jsx +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import Constants from 'utils/constants.jsx'; - -const TYPE_POST = 'post'; -const TYPE_COMMENT = 'comment'; - -class MessageHistoryStoreClass { - constructor() { - this.messageHistory = []; - this.index = []; - this.index[TYPE_POST] = 0; - this.index[TYPE_COMMENT] = 0; - } - - getMessageInHistory(type) { - if (this.index[type] >= this.messageHistory.length) { - return ''; - } else if (this.index[type] < 0) { - return null; - } - - return this.messageHistory[this.index[type]]; - } - - getHistoryLength() { - if (this.messageHistory === null) { - return 0; - } - return this.messageHistory.length; - } - - storeMessageInHistory(message) { - this.messageHistory.push(message); - this.resetAllHistoryIndex(); - if (this.messageHistory.length > Constants.MAX_PREV_MSGS) { - this.messageHistory = this.messageHistory.slice(1, Constants.MAX_PREV_MSGS + 1); - } - } - - storeMessageInHistoryByIndex(index, message) { - this.messageHistory[index] = message; - } - - resetAllHistoryIndex() { - this.index[TYPE_POST] = this.messageHistory.length; - this.index[TYPE_COMMENT] = this.messageHistory.length; - } - - resetHistoryIndex(type) { - this.index[type] = this.messageHistory.length; - } - - nextMessageInHistory(keyCode, messageText, type) { - if (messageText !== '' && messageText !== this.getMessageInHistory(type)) { - return null; - } - - if (keyCode === Constants.KeyCodes.UP) { - this.index[type]--; - } else if (keyCode === Constants.KeyCodes.DOWN) { - this.index[type]++; - } - - if (this.index[type] < 0) { - this.index[type] = 0; - return null; - } else if (this.index[type] >= this.getHistoryLength()) { - this.index[type] = this.getHistoryLength(); - } - - return this.getMessageInHistory(type); - } -} - -var MessageHistoryStore = new MessageHistoryStoreClass(); - -export default MessageHistoryStore; |