status-im/status-app

Return `seq[ContactsDetails]` from `getContactsByGroup`

Aberta

#10.807 aberto em 25 de mai. de 2023

 (1 comentário) (0 reação) (0 responsável)QML (96 forks)auto 404
core-teamgood first issuerefactor

Métricas do repositório

Stars
 (363 estrelas)
Métricas de merge de PR
 (Mesclagem média 4d 23h) (178 fundiu PRs em 30d)

Description

TLDR: the getContactsByGroup function in src/app_service/service/contacts/service.nim currently returns seq[ContactsDto], but that return value is most of the time used to get ContactsDetails and the original property is already ContactsDetails, so we're doing type transfers uselessly. So change the signature to return seq[ContactsDetails] directly

          Maybe return `seq[ContactsDetails]` from this function?

Originally posted by @igor-sirotin in https://github.com/status-im/status-desktop/pull/10805#discussion_r1205503613

          This function is called with `getContacts` in `initContactRequestsModel`.
          And then for each contact we call `createItemFromPublicKey` which calls `getContactDetails`.

          So we do have `ContactDetails` in the beginning, then switch it to `ContactDto` and eventually back to `ContactDetails`.

Originally posted by @igor-sirotin in https://github.com/status-im/status-desktop/pull/10805#discussion_r1205535598

Guia do colaborador