Skip to content

Commit

Permalink
Add minor comment fixes in avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
Kicu committed May 23, 2024
1 parent 0319ead commit b87b586
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function Avatar({

const isWorkspace = type === CONST.ICON_TYPE_WORKSPACE;

// if it's user avatar then accountID will be a number
// If it's user avatar then accountID will be a number
const source = isWorkspace ? originalSource : UserUtils.getAvatar(originalSource, avatarID as number);
const useFallBackAvatar = imageError || !source || source === Expensicons.FallbackAvatar;
const fallbackAvatar = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatar(name) : fallbackIcon || Expensicons.FallbackAvatar;
Expand Down
2 changes: 1 addition & 1 deletion src/components/AvatarWithIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type AvatarWithIndicatorProps = {
/** URL for the avatar */
source?: UserUtils.AvatarSource;

/** account id if it's user avatar */
/** Account id if it's user avatar */
accountID?: number;

/** To show a tooltip on hover */
Expand Down
8 changes: 4 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6496,10 +6496,10 @@ function hasMissingPaymentMethod(userWallet: OnyxEntry<UserWallet>, iouReportID:

/**
* Used from expense actions to decide if we need to build an optimistic expense report.
Create a new report if:
- we don't have an iouReport set in the chatReport
- we have one, but it's waiting on the payee adding a bank account
- we have one but we can't add more transactions to it due to: report is approved or settled, or report is processing and policy isn't on Instant submit reporting frequency
* Create a new report if:
* - we don't have an iouReport set in the chatReport
* - we have one, but it's waiting on the payee adding a bank account
* - we have one, but we can't add more transactions to it due to: report is approved or settled, or report is processing and policy isn't on Instant submit reporting frequency
*/
function shouldCreateNewMoneyRequestReport(existingIOUReport: OnyxEntry<Report> | undefined | null, chatReport: OnyxEntry<Report> | null): boolean {
return !existingIOUReport || hasIOUWaitingOnCurrentUserBankAccount(chatReport) || !canAddOrDeleteTransactions(existingIOUReport);
Expand Down
3 changes: 1 addition & 2 deletions src/libs/UserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function generateAccountID(searchValue: string): number {

/**
* Helper method to return the default avatar associated with the given accountID
* @returns
*/
function getDefaultAvatar(accountID = -1, avatarURL?: string): IconAsset | undefined {
if (accountID === CONST.ACCOUNT_ID.CONCIERGE) {
Expand All @@ -92,7 +91,7 @@ function getDefaultAvatar(accountID = -1, avatarURL?: string): IconAsset | undef
// There are 24 possible default avatars, so we choose which one this user has based
// on a simple modulo operation of their login number. Note that Avatar count starts at 1.

// When creating a chat, we generate an avatar using an ID and the backend response will modify the ID to the actual user ID.
// When creating a chat the backend response will return the actual user ID.
// But the avatar link still corresponds to the original ID-generated link. So we extract the SVG image number from the backend's link instead of using the user ID directly
let accountIDHashBucket: AvatarRange | undefined;
if (avatarURL) {
Expand Down

0 comments on commit b87b586

Please sign in to comment.