Skip to content

Commit

Permalink
fix: add option to preserve history on chat delete
Browse files Browse the repository at this point in the history
  • Loading branch information
BalogunofAfrica committed Dec 8, 2023
1 parent 238a6e2 commit 79cdfed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion protocol/messenger_chats.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,10 @@ func (m *Messenger) DeactivateChat(request *requests.DeactivateChat) (*Messenger
if err := request.Validate(); err != nil {
return nil, err
}

doClearHistory := !request.PreserveHistory

return m.deactivateChat(request.ID, 0, true, true)
return m.deactivateChat(request.ID, 0, true, doClearHistory)
}

func (m *Messenger) deactivateChat(chatID string, deactivationClock uint64, shouldBeSynced bool, doClearHistory bool) (*MessengerResponse, error) {
Expand Down
1 change: 1 addition & 0 deletions protocol/requests/deactivate_chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var ErrDeactivateChatInvalidID = errors.New("deactivate-chat: invalid id")

type DeactivateChat struct {
ID string `json:"id"`
PreserveHistory bool `json:"preserveHistory"`
}

func (j *DeactivateChat) Validate() error {
Expand Down

0 comments on commit 79cdfed

Please sign in to comment.