fix: add option to preserve history on chat delete (#4324)

This commit is contained in:
BalogunofAfrica 2023-12-11 13:29:56 +01:00 committed by GitHub
parent 0f98a1294c
commit 1b8b53b118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -383,7 +383,9 @@ func (m *Messenger) DeactivateChat(request *requests.DeactivateChat) (*Messenger
return nil, err return nil, err
} }
return m.deactivateChat(request.ID, 0, true, true) doClearHistory := !request.PreserveHistory
return m.deactivateChat(request.ID, 0, true, doClearHistory)
} }
func (m *Messenger) deactivateChat(chatID string, deactivationClock uint64, shouldBeSynced bool, doClearHistory bool) (*MessengerResponse, error) { func (m *Messenger) deactivateChat(chatID string, deactivationClock uint64, shouldBeSynced bool, doClearHistory bool) (*MessengerResponse, error) {

View File

@ -7,7 +7,8 @@ import (
var ErrDeactivateChatInvalidID = errors.New("deactivate-chat: invalid id") var ErrDeactivateChatInvalidID = errors.New("deactivate-chat: invalid id")
type DeactivateChat struct { type DeactivateChat struct {
ID string `json:"id"` ID string `json:"id"`
PreserveHistory bool `json:"preserveHistory"`
} }
func (j *DeactivateChat) Validate() error { func (j *DeactivateChat) Validate() error {