diff --git a/app/controllers/api/v1/accounts/conversations_controller.rb b/app/controllers/api/v1/accounts/conversations_controller.rb
index 2d91e1cbd..22eee629e 100644
--- a/app/controllers/api/v1/accounts/conversations_controller.rb
+++ b/app/controllers/api/v1/accounts/conversations_controller.rb
@@ -74,9 +74,10 @@ class Api::V1::Accounts::ConversationsController < Api::V1::Accounts::BaseContro
end
def update_last_seen
- @conversation.agent_last_seen_at = DateTime.now.utc
- @conversation.assignee_last_seen_at = DateTime.now.utc if assignee?
- @conversation.save!
+ # rubocop:disable Rails/SkipsModelValidations
+ @conversation.update_column(:agent_last_seen_at, DateTime.now.utc)
+ @conversation.update_column(:assignee_last_seen_at, DateTime.now.utc) if assignee?
+ # rubocop:enable Rails/SkipsModelValidations
end
def custom_attributes
diff --git a/app/javascript/dashboard/components/SidemenuIcon.vue b/app/javascript/dashboard/components/SidemenuIcon.vue
index f17a1c865..89668449a 100644
--- a/app/javascript/dashboard/components/SidemenuIcon.vue
+++ b/app/javascript/dashboard/components/SidemenuIcon.vue
@@ -3,10 +3,12 @@
diff --git a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue
index db042b5b7..db13011ca 100644
--- a/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue
+++ b/app/javascript/dashboard/components/widgets/conversation/MessagesView.vue
@@ -243,25 +243,31 @@ export default {
},
created() {
- bus.$on('scrollToMessage', () => {
- this.$nextTick(() => this.scrollToBottom());
- this.makeMessagesRead();
- });
-
- bus.$on(BUS_EVENTS.SET_TWEET_REPLY, selectedTweetId => {
- this.selectedTweetId = selectedTweetId;
- });
+ bus.$on(BUS_EVENTS.SCROLL_TO_MESSAGE, this.onScrollToMessage);
+ bus.$on(BUS_EVENTS.SET_TWEET_REPLY, this.setSelectedTweet);
},
mounted() {
this.addScrollListener();
},
- unmounted() {
+ beforeDestroy() {
+ this.removeBusListeners();
this.removeScrollListener();
},
methods: {
+ removeBusListeners() {
+ bus.$off(BUS_EVENTS.SCROLL_TO_MESSAGE, this.onScrollToMessage);
+ bus.$off(BUS_EVENTS.SET_TWEET_REPLY, this.setSelectedTweet);
+ },
+ setSelectedTweet(tweetId) {
+ this.selectedTweetId = tweetId;
+ },
+ onScrollToMessage() {
+ this.$nextTick(() => this.scrollToBottom());
+ this.makeMessagesRead();
+ },
showPopoutReplyBox() {
this.isPopoutReplyBox = !this.isPopoutReplyBox;
},
diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
index d6f5e1c0c..952b81bbc 100644
--- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
+++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
@@ -93,6 +93,7 @@ import { REPLY_EDITOR_MODES } from 'dashboard/components/widgets/WootWriter/cons
import WootMessageEditor from 'dashboard/components/widgets/WootWriter/Editor';
import { checkFileSizeLimit } from 'shared/helpers/FileHelper';
import { MAXIMUM_FILE_UPLOAD_SIZE } from 'shared/constants/messages';
+import { BUS_EVENTS } from 'shared/constants/busEvents';
import {
isEscape,
@@ -368,7 +369,7 @@ export default {
this.clearMessage();
try {
await this.$store.dispatch('sendMessage', messagePayload);
- this.$emit('scrollToMessage');
+ this.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
} catch (error) {
const errorMessage =
error?.response?.data?.error ||
diff --git a/app/javascript/dashboard/routes/dashboard/Dashboard.vue b/app/javascript/dashboard/routes/dashboard/Dashboard.vue
index 123863eb7..7bb0bd847 100644
--- a/app/javascript/dashboard/routes/dashboard/Dashboard.vue
+++ b/app/javascript/dashboard/routes/dashboard/Dashboard.vue
@@ -11,6 +11,7 @@
diff --git a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue
index f66ef9587..e81b29c1c 100644
--- a/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue
+++ b/app/javascript/dashboard/routes/dashboard/conversation/ConversationView.vue
@@ -23,6 +23,7 @@ import ChatList from '../../../components/ChatList';
import ConversationBox from '../../../components/widgets/conversation/ConversationBox';
import PopOverSearch from './search/PopOverSearch';
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
+import { BUS_EVENTS } from 'shared/constants/busEvents';
export default {
components: {
@@ -108,7 +109,7 @@ export default {
return;
}
this.$store.dispatch('setActiveChat', chat).then(() => {
- bus.$emit('scrollToMessage');
+ bus.$emit(BUS_EVENTS.SCROLL_TO_MESSAGE);
});
} else {
this.$store.dispatch('clearSelectedState');
diff --git a/app/javascript/shared/constants/busEvents.js b/app/javascript/shared/constants/busEvents.js
index 0c496818f..380fcbe5a 100644
--- a/app/javascript/shared/constants/busEvents.js
+++ b/app/javascript/shared/constants/busEvents.js
@@ -3,4 +3,6 @@ export const BUS_EVENTS = {
SHOW_ALERT: 'SHOW_ALERT',
START_NEW_CONVERSATION: 'START_NEW_CONVERSATION',
FOCUS_CUSTOM_ATTRIBUTE: 'FOCUS_CUSTOM_ATTRIBUTE',
+ SCROLL_TO_MESSAGE: 'SCROLL_TO_MESSAGE',
+ TOGGLE_SIDEMENU: 'TOGGLE_SIDEMENU',
};