Skip to content

Commit

Permalink
chore!: update ChatsPreview
Browse files Browse the repository at this point in the history
  • Loading branch information
qfrank committed Nov 22, 2024
1 parent 7ef3e90 commit 7263420
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
10 changes: 1 addition & 9 deletions protocol/messenger_chats.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,8 @@ func (m *Messenger) Chats() []*Chat {
return chats
}

// ChatsPreview returns a list of chat previews.
// When onlyCommunityChats is nil, returns all chats
// When onlyCommunityChats is true, only returns community chats
// When onlyCommunityChats is false, returns all non-community chats
func (m *Messenger) ChatsPreview(filterPointer *ChatPreviewFilterType) []*ChatPreview {
func (m *Messenger) ChatsPreview(filter ChatPreviewFilterType) []*ChatPreview {
var chats []*ChatPreview
filter := ChatPreviewFilterTypeAll
if filterPointer != nil {
filter = *filterPointer
}
m.allChats.Range(func(chatID string, chat *Chat) (shouldContinue bool) {
// Skip if chat doesn't match the filter
isCommunityChat := chat.ChatType == ChatTypeCommunityChat
Expand Down
2 changes: 1 addition & 1 deletion services/ext/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func (api *PublicAPI) Chats(parent context.Context) []*protocol.Chat {
return api.service.messenger.Chats()
}

func (api *PublicAPI) ChatsPreview(parent context.Context, filterType *protocol.ChatPreviewFilterType) []*protocol.ChatPreview {
func (api *PublicAPI) ChatsPreview(parent context.Context, filterType protocol.ChatPreviewFilterType) []*protocol.ChatPreview {
return api.service.messenger.ChatsPreview(filterType)
}

Expand Down

0 comments on commit 7263420

Please sign in to comment.