Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ Onyx.connect({
callback: val => lastViewedReportID = val ? Number(val) : null,
});

let myPersonalDetails;
let personalDetails;
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS,
callback: val => myPersonalDetails = val[currentUserEmail],
callback: val => personalDetails = val,
});

const allReports = {};
Expand Down Expand Up @@ -859,7 +859,7 @@ function buildOptimisticReportAction(reportID, text, file) {
person: [
{
style: 'strong',
text: myPersonalDetails.displayName || currentUserEmail,
text: lodashGet(personalDetails, [currentUserEmail, 'displayName'], currentUserEmail),
type: 'TEXT',
},
],
Expand All @@ -868,7 +868,7 @@ function buildOptimisticReportAction(reportID, text, file) {
// Use the client generated ID as a optimistic action ID so we can remove it later
sequenceNumber: optimisticReportActionID,
clientID: optimisticReportActionID,
avatar: myPersonalDetails.avatar,
avatar: lodashGet(personalDetails, [currentUserEmail, 'avatar'], ReportUtils.getDefaultAvatar(currentUserEmail)),
timestamp: moment().unix(),
message: [
{
Expand Down