diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-05-03 12:17:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 12:17:54 +0300 |
commit | 254a54036a6055c04580890b825f7764504904ef (patch) | |
tree | a94f7237ce9f5c136c91631971f7436b39536398 /src | |
parent | 79c6c08cdcae368aa3b6c781b2b5b127e588ed11 (diff) | |
parent | cfcdde4eb14e21ccc25ece3f0a45ade3c7768874 (diff) |
Merge pull request #5538 from nextcloud/bugfix/3023/only-show-public-messages-as-last-messages
Only show public messages as last messages
Diffstat (limited to 'src')
-rw-r--r-- | src/components/LeftSidebar/ConversationsList/Conversation.vue | 12 | ||||
-rw-r--r-- | src/store/conversationsStore.js | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/components/LeftSidebar/ConversationsList/Conversation.vue b/src/components/LeftSidebar/ConversationsList/Conversation.vue index 275b1476a..96dbd178a 100644 --- a/src/components/LeftSidebar/ConversationsList/Conversation.vue +++ b/src/components/LeftSidebar/ConversationsList/Conversation.vue @@ -257,7 +257,17 @@ export default { const messagesKeys = Object.keys(this.messages) const lastMessageId = messagesKeys[messagesKeys.length - 1] - if (this.messages[lastMessageId].timestamp > lastMessageTimestamp) { + /** + * Only use the last message as lastmessage when: + * 1. It's newer than the conversations last message + * 2. It's not a command reply + * 3. It's not a temporary message starting with "/" which is a user posting a command + */ + if (this.messages[lastMessageId].timestamp > lastMessageTimestamp + && (this.messages[lastMessageId].actorType !== 'bots' + || this.messages[lastMessageId].actorId === 'changelog') + && (!lastMessageId.startsWith('temp-') + || !this.messages[lastMessageId].message.startsWith('/'))) { return this.messages[lastMessageId] } } diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js index ae044a4ca..eab4e982f 100644 --- a/src/store/conversationsStore.js +++ b/src/store/conversationsStore.js @@ -331,7 +331,17 @@ const actions = { }, async updateConversationLastMessage({ commit }, { token, lastMessage }) { - commit('updateConversationLastMessage', { token, lastMessage }) + /** + * Only use the last message as lastmessage when: + * 1. It's not a command reply + * 2. It's not a temporary message starting with "/" which is a user posting a command + */ + if ((lastMessage.actorType !== 'bots' + || lastMessage.actorId === 'changelog') + && ((typeof lastMessage.id.startsWith === 'function' && !lastMessage.id.startsWith('temp-')) + || !lastMessage.message.startsWith('/'))) { + commit('updateConversationLastMessage', { token, lastMessage }) + } }, async updateConversationLastReadMessage({ commit }, { token, lastReadMessage }) { |