Fix LatestConversationMessages preload

Load the conversation's selected root as well
This commit is contained in:
Matt Low 2024-09-16 00:37:42 +00:00
parent 434fc4672b
commit 1570988b98

View File

@ -422,7 +422,7 @@ func (s *SQLStore) LatestConversationMessages() ([]api.Message, error) {
Joins("JOIN (?) as sub on messages.conversation_id = sub.conversation_id AND messages.created_at = sub.max_created_at", subQuery). Joins("JOIN (?) as sub on messages.conversation_id = sub.conversation_id AND messages.created_at = sub.max_created_at", subQuery).
Group("messages.conversation_id"). Group("messages.conversation_id").
Order("created_at DESC"). Order("created_at DESC").
Preload("Conversation"). Preload("Conversation.SelectedRoot").
Find(&latestMessages).Error Find(&latestMessages).Error
if err != nil { if err != nil {