fix: add option to preserve history on chat delete (#4324)
This commit is contained in:
parent
0f98a1294c
commit
1b8b53b118
|
@ -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) {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue