Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix members page spinner (and lack of icon on participant page) #12364

Merged
merged 4 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ export {
isPolicyExpenseChat,
getDefaultAvatar,
getIcons,
getDisplayNameForParticipant,
getRoomWelcomeMessage,
getDisplayNamesWithTooltips,
getReportName,
Expand Down
17 changes: 10 additions & 7 deletions src/pages/DetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import CONST from '../CONST';
import * as ReportUtils from '../libs/ReportUtils';
import DateUtils from '../libs/DateUtils';
import * as Expensicons from '../components/Icon/Expensicons';
import FullscreenLoadingIndicator from '../components/FullscreenLoadingIndicator';
import MenuItem from '../components/MenuItem';
import AttachmentModal from '../components/AttachmentModal';
import PressableWithoutFocus from '../components/PressableWithoutFocus';
Expand Down Expand Up @@ -82,19 +81,23 @@ class DetailsPage extends React.PureComponent {
}

render() {
const details = lodashGet(this.props.personalDetails, lodashGet(this.props.route.params, 'login'));
let details = lodashGet(this.props.personalDetails, lodashGet(this.props.route.params, 'login'));
if (!details) {
// Personal details have not loaded yet
return <FullscreenLoadingIndicator />;
const login = lodashGet(this.props.route.params, 'login');
details = {
login,
displayName: ReportUtils.getDisplayNameForParticipant({login}),
avatar: ReportUtils.getDefaultAvatar(),
};
}
const isSMSLogin = Str.isSMSLogin(details.login);

// If we have a reportID param this means that we
// arrived here via the ParticipantsPage and should be allowed to navigate back to it
const shouldShowBackButton = Boolean(this.props.route.params.reportID);
const timezone = DateUtils.getLocalMomentFromTimestamp(this.props.preferredLocale, null, details.timezone.selected);
const GMTTime = `${timezone.toString().split(/[+-]/)[0].slice(-3)} ${timezone.zoneAbbr()}`;
const currentTime = Number.isNaN(Number(timezone.zoneAbbr())) ? timezone.zoneAbbr() : GMTTime;
const timezone = details.timezone ? DateUtils.getLocalMomentFromTimestamp(this.props.preferredLocale, null, details.timezone.selected) : null;
const GMTTime = timezone ? `${timezone.toString().split(/[+-]/)[0].slice(-3)} ${timezone.zoneAbbr()}` : '';
const currentTime = (timezone && Number.isNaN(Number(timezone.zoneAbbr()))) ? timezone.zoneAbbr() : GMTTime;
const shouldShowLocalTime = !ReportUtils.hasExpensifyEmails([details.login]);

let pronouns = details.pronouns;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReportParticipantsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const getAllParticipants = (report, personalDetails) => {
return ({
alternateText: userLogin,
displayName: userPersonalDetail.displayName,
icons: [userPersonalDetail.avatar],
icons: userPersonalDetail.avatar ? [userPersonalDetail.avatar] : [ReportUtils.getDefaultAvatar()],
keyForList: userLogin,
login,
text: userPersonalDetail.displayName,
Expand Down