Skip to content

[HOLD for payment 2024-02-14] [HOLD for payment 2024-01-18] Consolidate GetDislplayName methods #31312

Closed

Description

@puneetlath

We have a bunch of different methods that are used to get the display name:

  • PersonalDetails.getDisplayNameForTypingIndicator
  • PersonalDetails.getDisplayName
  • ReportUtils.getDisplayNamesStringFromTooltips
  • ReportUtils.getDisplayNameForParticipant
  • ReportUtils.getDisplayNamesWithTooltips
  • PersonalDetailsUtils.getDisplayNameOrDefault

I would like to do two things:

  1. Conslidate these as much as possible. They probably can't all be consolidated, but I would think at least PersonalDetailsUtils.getDisplayNameOrDefault and PersonalDetails.getDisplayName and ReportUtils.getDisplayNameForParticipant could be
  2. Make sure that we are falling back on the login if we have it. Right now ReportUtils.getDisplayNameForParticipant doesn't fall back on the login, even if it is available, and I would like to update it to do so

Activity

  1. self-assigned this
    on Nov 14, 2023
  2. melvin-bot commented on Nov 14, 2023

    @melvin-bot

    Current assignee @puneetlath is eligible for the NewFeature assigner, not assigning anyone new.

  3. koko57 commented on Nov 15, 2023

    @koko57
    Contributor

    ready to work on this issue

  4. koko57 commented on Nov 16, 2023

    @koko57
    Contributor

    @puneetlath I've analyzed the methods you mentioned and looking for another parts of code that have to do something with creating a displayName. For now leaving my findings for each method:

    • PersonalDetails.getDisplayNameForTypingIndicator
      only used in:
      <TextWithEllipsis
      leadingText={PersonalDetails.getDisplayNameForTypingIndicator(usersTyping[0], props.translate('common.someone'))}
      - we can try to use getDisplayName instead
    • PersonalDetails.getDisplayName
      it could be possibly merged with getDisplayNameOrDefault and getDisplayNameForParticipant
    • ReportUtils.getDisplayNamesStringFromTooltips
      it's only used here:
      function getGroupChatName(report: Report): string {
      const participants = report.participantAccountIDs ?? [];
      const isMultipleParticipantReport = participants.length > 1;
      const participantPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(participants, allPersonalDetails ?? {});
      const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(participantPersonalDetails, isMultipleParticipantReport);
      return ReportUtils.getDisplayNamesStringFromTooltips(displayNamesWithTooltips);
      }

      and it uses getDisplayNamesWithTooltips. So we're creating a list of objects just to extract a display name from them 🤔. I think this logic should be simplified not to iterate over a list twice
    • ReportUtils.getDisplayNameForParticipant
      maybe we could replace this method, getDisplayName and getDisplayNameOrDefault and create one that will be used instead of these 3
    • ReportUtils.getDisplayNamesWithTooltips
      iterates over personalDetailsList array, uses getDisplayNameForParticipant
    • PersonalDetailsUtils.getDisplayNameOrDefault
      same as in getDisplayNameForParticipant
  5. koko57 commented on Nov 16, 2023

    @koko57
    Contributor

    for your PR - I think we can merge it and then I will work on mine. I would rather split the whole refactor into several smaller PRs. It would be easier to test for regressions.

  6. puneetlath commented on Nov 16, 2023

    @puneetlath
    ContributorAuthor

    Ok sounds good. I'll get it ready for review.

  7. puneetlath commented on Nov 16, 2023

    @puneetlath
    ContributorAuthor

    @koko57 my PR was merged.

  8. 78 remaining items

  9. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  10. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.37-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2024-02-14. 🎊

    For reference, here are some details about the assignees on this issue:

    • @koko57 does not require payment (Contractor)
    • @situchan requires payment (Needs manual offer from BZ)
  11. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@situchan] Please propose regression test steps to ensure the new feature will work correctly on production in further releases.
    • [@puneetlath] Link the GH issue for creating/updating the regression test once above steps have been agreed upon.
  12. koko57 commented on Feb 7, 2024

    @koko57
    Contributor

    @puneetlath I suggested to merge getDisplayNameForParticipant with getDisplayNameOrDefault. It's a big change, I'm still looking if there won't be any edge cases and we can use only one method everywhere.

  13. puneetlath commented on Feb 7, 2024

    @puneetlath
    ContributorAuthor

    Ok, sounds good. Thanks for keeping me in the loop.

  14. koko57 commented on Feb 14, 2024

    @koko57
    Contributor

    @puneetlath After analyzing the usages of both methods I'm not convinced that we should go with merging them - they are slightly different and I would need to introduce an additional layer of complexity to cover all the cases. For now, I think that both methods serve their purpose in the places they are used and are easy to use.
    If you agree, we can close this issue.

  15. melvin-bot commented on Feb 14, 2024

    @melvin-bot

    Payment Summary

    Upwork Job

    • Contributor: @koko57 is from an agency-contributor and not due payment
    • ROLE: @situchan paid $(AMOUNT) via Upwork (LINK)

    BugZero Checklist (@puneetlath)

    • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. puneetlath commented on Feb 14, 2024

    @puneetlath
    ContributorAuthor

    Ok sounds good to me. @situchan do you agree?

    Thanks for all your effort on this @koko57!

  17. situchan commented on Feb 14, 2024

    @situchan
    Contributor

    Agree. Thanks

  18. puneetlath commented on Feb 14, 2024

    @puneetlath
    ContributorAuthor

    Ok sounds good. @situchan I see two "payment summary" posts in the issue. Is that correct? I feel like there were more PRs than that 😅

  19. puneetlath commented on Feb 14, 2024

    @puneetlath
    ContributorAuthor

    Great, thanks. Offer sent: https://www.upwork.com/nx/wm/offer/100915132

    Please ping me here when you've accepted.

  20. situchan commented on Feb 14, 2024

    @situchan
    Contributor

    Accepted thanks

  21. puneetlath commented on Feb 14, 2024

    @puneetlath
    ContributorAuthor

    Paid. Thanks y'all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionNewFeatureSomething to build that is a new item.WeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions