Allow to leave chat without removing it
This commit is contained in:
parent
f3fc6812cd
commit
4d2fb67add
|
@ -1020,7 +1020,7 @@ func (m *Messenger) ConfirmJoiningGroup(ctx context.Context, chatID string) (*Me
|
|||
return &response, m.saveChat(chat)
|
||||
}
|
||||
|
||||
func (m *Messenger) LeaveGroupChat(ctx context.Context, chatID string) (*MessengerResponse, error) {
|
||||
func (m *Messenger) LeaveGroupChat(ctx context.Context, chatID string, remove bool) (*MessengerResponse, error) {
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
|
||||
|
@ -1077,7 +1077,9 @@ func (m *Messenger) LeaveGroupChat(ctx context.Context, chatID string) (*Messeng
|
|||
}
|
||||
|
||||
chat.updateChatFromProtocolGroup(group)
|
||||
chat.Active = false
|
||||
if remove {
|
||||
chat.Active = false
|
||||
}
|
||||
|
||||
response.Chats = []*Chat{chat}
|
||||
response.Messages = buildSystemMessages([]v1protocol.MembershipUpdateEvent{event}, m.systemMessagesTranslations)
|
||||
|
|
|
@ -202,8 +202,8 @@ func (api *PublicAPI) Leave(chat protocol.Chat) error {
|
|||
return api.service.messenger.Leave(chat)
|
||||
}
|
||||
|
||||
func (api *PublicAPI) LeaveGroupChat(ctx Context, chatID string) (*protocol.MessengerResponse, error) {
|
||||
return api.service.messenger.LeaveGroupChat(ctx, chatID)
|
||||
func (api *PublicAPI) LeaveGroupChat(ctx Context, chatID string, remove bool) (*protocol.MessengerResponse, error) {
|
||||
return api.service.messenger.LeaveGroupChat(ctx, chatID, remove)
|
||||
}
|
||||
|
||||
func (api *PublicAPI) CreateGroupChatWithMembers(ctx Context, name string, members []string) (*protocol.MessengerResponse, error) {
|
||||
|
|
Loading…
Reference in New Issue