Skip to content

Instantly share code, notes, and snippets.

@bfontaine
Last active January 15, 2025 16:15
Show Gist options
  • Save bfontaine/f40029f0a2eec9dd28b354d84b5f424e to your computer and use it in GitHub Desktop.
Save bfontaine/f40029f0a2eec9dd28b354d84b5f424e to your computer and use it in GitHub Desktop.
diff --git app/services/search_service.rb app/services/search_service.rb
index add7938a0..f2b87591a 100644
--- app/services/search_service.rb
+++ app/services/search_service.rb
@@ -27,8 +27,13 @@ class SearchService
def filter_conversations
@conversations = current_account.conversations.where(inbox_id: accessable_inbox_ids)
.joins('INNER JOIN contacts ON conversations.contact_id = contacts.id')
- .where("cast(conversations.display_id as text) ILIKE :search OR contacts.name ILIKE :search OR contacts.email
- ILIKE :search OR contacts.phone_number ILIKE :search OR contacts.identifier ILIKE :search", search: "%#{search_query}%")
+ .where("cast(conversations.display_id as text) ILIKE :search
+ OR contacts.name ILIKE :search
+ OR contacts.email ILIKE :search
+ OR contacts.phone_number ILIKE :search
+ OR contacts.identifier ILIKE :search
+ OR conversations.additional_attributes->>'mail_subject' ILIKE :search",
+ search: "%#{search_query}%")
.order('conversations.created_at DESC')
.limit(10)
end
diff --git app/javascript/dashboard/components/ChatList.vue app/javascript/dashboard/components/ChatList.vue
index 0438d24af..0548f24d3 100644
--- app/javascript/dashboard/components/ChatList.vue
+++ app/javascript/dashboard/components/ChatList.vue
@@ -87,7 +87,7 @@ const conversationDynamicScroller = ref(null);
const activeAssigneeTab = ref(wootConstants.ASSIGNEE_TYPE.ME);
const activeStatus = ref(wootConstants.STATUS_TYPE.OPEN);
-const activeSortBy = ref(wootConstants.SORT_BY_TYPE.LAST_ACTIVITY_AT_DESC);
+const activeSortBy = ref(wootConstants.SORT_BY_TYPE.CREATED_AT_ASC);
const showAdvancedFilters = ref(false);
// chatsOnView is to store the chats that are currently visible on the screen,
// which mirrors the conversationList.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment