status-im/status-app

Return `seq[ContactsDetails]` from `getContactsByGroup`

开放

#10,807 创建于 2023年5月25日

 (1 条评论) (0 个反应) (0 位负责人)QML (96 个派生)auto 404
core-teamgood first issuerefactor

仓库指标

星标
 (363 个星标)
PR 合并指标
 (平均合并 4天 23小时) (30 天内合并 178 个 PR)

描述

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

贡献者指南