diff --git a/protocol/messenger_chats.go b/protocol/messenger_chats.go index beb0a554f..f1bf681f6 100644 --- a/protocol/messenger_chats.go +++ b/protocol/messenger_chats.go @@ -383,7 +383,9 @@ func (m *Messenger) DeactivateChat(request *requests.DeactivateChat) (*Messenger 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) { diff --git a/protocol/requests/deactivate_chat.go b/protocol/requests/deactivate_chat.go index 8b48df589..27c1eec93 100644 --- a/protocol/requests/deactivate_chat.go +++ b/protocol/requests/deactivate_chat.go @@ -7,7 +7,8 @@ import ( var ErrDeactivateChatInvalidID = errors.New("deactivate-chat: invalid id") type DeactivateChat struct { - ID string `json:"id"` + ID string `json:"id"` + PreserveHistory bool `json:"preserveHistory"` } func (j *DeactivateChat) Validate() error {