diff --git a/src/components/Reactions/ReactionTooltipContent.js b/src/components/Reactions/ReactionTooltipContent.js index 981441925906..8dddc106efbf 100644 --- a/src/components/Reactions/ReactionTooltipContent.js +++ b/src/components/Reactions/ReactionTooltipContent.js @@ -22,7 +22,7 @@ const propTypes = { /** * A list of account IDs to display in the tooltip. */ - accountIDs: PropTypes.arrayOf(PropTypes.string).isRequired, + accountIDs: PropTypes.arrayOf(PropTypes.number).isRequired, ...withCurrentUserPersonalDetailsPropTypes, }; diff --git a/src/components/Reactions/ReportActionItemReactions.js b/src/components/Reactions/ReportActionItemReactions.js index b1194daef773..1753b2def625 100644 --- a/src/components/Reactions/ReportActionItemReactions.js +++ b/src/components/Reactions/ReportActionItemReactions.js @@ -57,7 +57,7 @@ function ReportActionItemReactions(props) { > {_.map(reactionsWithCount, (reaction) => { const reactionCount = reaction.users.length; - const reactionUsers = _.map(reaction.users, (sender) => sender.accountID.toString()); + const reactionUsers = _.map(reaction.users, (sender) => sender.accountID); const emoji = _.find(emojis, (e) => e.name === reaction.emoji); const emojiCodes = EmojiUtils.getUniqueEmojiCodes(emoji, reaction.users); const hasUserReacted = Report.hasAccountIDReacted(props.currentUserPersonalDetails.accountID, reactionUsers); @@ -80,7 +80,7 @@ function ReportActionItemReactions(props) { currentUserPersonalDetails={props.currentUserPersonalDetails} /> )} - renderTooltipContentKey={[...reactionUsers, ...emojiCodes]} + renderTooltipContentKey={[..._.map(reactionUsers, (user) => user.toString()), ...emojiCodes]} key={reaction.emoji} > diff --git a/src/libs/PersonalDetailsUtils.js b/src/libs/PersonalDetailsUtils.js index 199b4a64399d..26c0a67aae48 100644 --- a/src/libs/PersonalDetailsUtils.js +++ b/src/libs/PersonalDetailsUtils.js @@ -24,8 +24,8 @@ function getDisplayNameOrDefault(passedPersonalDetails, pathToDisplayName, defau } /** - * Given a list of account IDs (as string) it will return an array of personal details objects. - * @param {Array} accountIDs - Array of accountIDs + * Given a list of account IDs (as number) it will return an array of personal details objects. + * @param {Array} accountIDs - Array of accountIDs * @param {Number} currentUserAccountID * @param {Boolean} shouldChangeUserDisplayName - It will replace the current user's personal detail object's displayName with 'You'. * @returns {Array} - Array of personal detail objects @@ -35,7 +35,7 @@ function getPersonalDetailsByIDs(accountIDs, currentUserAccountID, shouldChangeU _.each( _.filter(personalDetails, (detail) => accountIDs.includes(detail.accountID)), (detail) => { - if (shouldChangeUserDisplayName && currentUserAccountID.toString() === detail.accountID) { + if (shouldChangeUserDisplayName && currentUserAccountID === detail.accountID) { result.push({ ...detail, displayName: Localize.translateLocal('common.you'), diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 99cd84dc842e..dddd2aefb265 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1451,8 +1451,8 @@ function getOptimisticDataForReportActionUpdate(originalReportAction, message, r /** * Returns true if the accountID has reacted to the report action (with the given skin tone). - * @param {String} accountID - * @param {Array} users + * @param {Number} accountID + * @param {Array} users * @param {Number} [skinTone] * @returns {boolean} */ @@ -1461,12 +1461,12 @@ function hasAccountIDReacted(accountID, users, skinTone) { _.find(users, (user) => { let userAccountID; if (typeof user === 'object') { - userAccountID = `${user.accountID}`; + userAccountID = user.accountID; } else { - userAccountID = `${user}`; + userAccountID = user; } - return userAccountID === `${accountID}` && (skinTone == null ? true : user.skinTone === skinTone); + return userAccountID === accountID && (skinTone == null ? true : user.skinTone === skinTone); }) !== undefined ); } diff --git a/src/libs/actions/User.js b/src/libs/actions/User.js index 9e2ae4abd637..c60f510fccd6 100644 --- a/src/libs/actions/User.js +++ b/src/libs/actions/User.js @@ -787,12 +787,10 @@ function setContactMethodAsDefault(newDefaultContactMethod) { onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.PERSONAL_DETAILS_LIST, value: { - [newDefaultContactMethod]: { - ...myPersonalDetails, + [currentUserAccountID]: { login: newDefaultContactMethod, displayName: PersonalDetails.getDisplayName(newDefaultContactMethod, myPersonalDetails), }, - [oldDefaultContactMethod]: null, }, }, ]; @@ -835,8 +833,7 @@ function setContactMethodAsDefault(newDefaultContactMethod) { onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.PERSONAL_DETAILS_LIST, value: { - [newDefaultContactMethod]: null, - [oldDefaultContactMethod]: {...myPersonalDetails}, + [currentUserAccountID]: {...myPersonalDetails}, }, }, ]; diff --git a/src/pages/home/report/ReactionList/PopoverReactionList.js b/src/pages/home/report/ReactionList/PopoverReactionList.js index f0dd786dff76..3cff316561b0 100644 --- a/src/pages/home/report/ReactionList/PopoverReactionList.js +++ b/src/pages/home/report/ReactionList/PopoverReactionList.js @@ -184,7 +184,7 @@ class PopoverReactionList extends React.Component { }; } const emojiCount = selectedReaction.users.length; - const reactionUsers = _.map(selectedReaction.users, (sender) => sender.accountID.toString()); + const reactionUsers = _.map(selectedReaction.users, (sender) => sender.accountID); const emoji = _.find(emojis, (e) => e.name === selectedReaction.emoji); const emojiCodes = EmojiUtils.getUniqueEmojiCodes(emoji, selectedReaction.users); const hasUserReacted = Report.hasAccountIDReacted(this.props.currentUserPersonalDetails.accountID, reactionUsers);