fix message mutation responses

This commit is contained in:
richjohnrambo
2026-09-23 10:47:31 +08:00
parent b413560455
commit ac20f1ed25
2 changed files with 48 additions and 5 deletions
+28 -4
View File
@@ -2463,7 +2463,13 @@ func (a *adapter) TenantMessageRecall(id t.TenantID, topic string, seq int64, ac
if err = tx.Commit(); err != nil {
return nil, err
}
return a.TenantMessageGetOne(id, topic, seq)
msg.UpdatedAt = recalledAt
msg.Version++
msg.RecalledAt = &recalledAt
msg.RecalledBy = actor.String()
msg.Head = nil
msg.Content = nil
return msg, nil
}
func (a *adapter) TenantGroupMessageRecall(id t.TenantID, topic string, seq int64, actor t.Uid, expectedVersion int, recalledAt time.Time) (*t.Message, error) {
@@ -2512,7 +2518,13 @@ func (a *adapter) TenantGroupMessageRecall(id t.TenantID, topic string, seq int6
if err = tx.Commit(); err != nil {
return nil, err
}
return a.TenantGroupMessageGetOne(id, topic, seq)
msg.UpdatedAt = recalledAt
msg.Version++
msg.RecalledAt = &recalledAt
msg.RecalledBy = actor.String()
msg.Head = nil
msg.Content = nil
return msg, nil
}
func (a *adapter) TenantMessageEdit(id t.TenantID, topic string, seq int64, actor t.Uid, expectedVersion int, head t.KVMap, content any, reason string, editedAt time.Time) (*t.Message, error) {
@@ -2569,7 +2581,13 @@ func (a *adapter) TenantMessageEdit(id t.TenantID, topic string, seq int64, acto
if err = tx.Commit(); err != nil {
return nil, err
}
return a.TenantMessageGetOne(id, topic, seq)
msg.UpdatedAt = editedAt
msg.Version++
msg.Head = head
msg.Content = storedContent
msg.ContentNonce = nonce
msg.KeyVersion = keyVersion
return msg, nil
}
func (a *adapter) TenantGroupMessageEdit(id t.TenantID, topic string, seq int64, actor t.Uid, expectedVersion int, head t.KVMap, content any, reason string, editedAt time.Time) (*t.Message, error) {
@@ -2625,7 +2643,13 @@ func (a *adapter) TenantGroupMessageEdit(id t.TenantID, topic string, seq int64,
if err = tx.Commit(); err != nil {
return nil, err
}
return a.TenantGroupMessageGetOne(id, topic, seq)
msg.UpdatedAt = editedAt
msg.Version++
msg.Head = head
msg.Content = storedContent
msg.ContentNonce = nonce
msg.KeyVersion = keyVersion
return msg, nil
}
func (a *adapter) TenantMessageGetAll(id t.TenantID, topic string, uid t.Uid, opts *t.QueryOpt) ([]t.Message, error) {