Skip to content

Commit 412d347

Browse files
committed
Fix thread update log line
1 parent f6db8c3 commit 412d347

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

api/pkg/entities/message_thread.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ type MessageThread struct {
2323
}
2424

2525
// Update a message thread after a message event
26-
func (thread *MessageThread) Update(timestamp time.Time, messageID uuid.UUID, content string) *MessageThread {
26+
func (thread *MessageThread) Update(timestamp time.Time, messageID uuid.UUID, content string, status MessageStatus) *MessageThread {
2727
thread.OrderTimestamp = timestamp
2828
thread.LastMessageID = messageID
29+
thread.Status = status
2930
thread.LastMessageContent = content
3031
return thread
3132
}

api/pkg/services/message_thread_service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ func (service *MessageThreadService) UpdateThread(ctx context.Context, params Me
6767
return nil
6868
}
6969

70-
if err = service.repository.Update(ctx, thread.Update(params.Timestamp, params.MessageID, params.Content)); err != nil {
70+
thread = thread.Update(params.Timestamp, params.MessageID, params.Content, params.Status)
71+
if err = service.repository.Update(ctx, thread); err != nil {
7172
msg := fmt.Sprintf("cannot update message thread with id [%s] after adding message [%s]", thread.ID, params.MessageID)
7273
return service.tracer.WrapErrorSpan(span, stacktrace.Propagate(err, msg))
7374
}
7475

75-
ctxLogger.Info(fmt.Sprintf("thread with id [%s] updated with last message [%s]", thread.ID, thread.LastMessageID))
76+
ctxLogger.Info(fmt.Sprintf("thread with id [%s] updated with last message [%s] and status [%s]", thread.ID, thread.LastMessageID, thread.Status))
7677
return nil
7778
}
7879

0 commit comments

Comments
 (0)