dont send if empty images

This commit is contained in:
Andrea Maria Piana 2020-12-10 09:42:36 +01:00
parent e8ffee3892
commit b7a6bbf1e7
1 changed files with 11 additions and 0 deletions

View File

@ -561,6 +561,17 @@ func (m *Messenger) handleStandaloneChatIdentity(chat *Chat) error {
// shouldPublishChatIdentity returns true if the last time the ChatIdentity was attached was more than 24 hours ago
func (m *Messenger) shouldPublishChatIdentity(chatID string) (bool, error) {
// Check we have at least one image
imgs, err := m.multiAccounts.GetIdentityImages(m.account.KeyUID)
if err != nil {
return false, err
}
if len(imgs) == 0 {
return false, nil
}
lp, err := m.persistence.GetWhenChatIdentityLastPublished(chatID)
if err != nil {
return false, err