Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Fix page error when no notification message #452

Merged
merged 1 commit into from
Aug 26, 2022
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
105 changes: 53 additions & 52 deletions src/pages/notifications/Notifications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,58 +100,59 @@ export default function Notifications() {
const createdDate = notification?.created;
const timeSince =
calculatePrettyTimeElapsedSince(createdDate);
const notificationText = (
<Text
key={notification?.guid}
style={{
color: read
? theme.palette.text.secondary
: theme.palette.text.primary,
}}
variant="body2"
>
{intl.formatMessage(
{
id: currentNotificationSchema?.notificationMessage,
},
{
userName: (
<span>
<Link
newTab
href={`/users/${userNameGuid}`}
>
{userName}
</Link>
</span>
),
user1Name,
user2Name,
yourIndividualName: (
<span>
<Link
newTab
href={`/individuals/${yourIndividualGuid}`}
>
{yourIndName}
</Link>
</span>
),
theirIndividualName: (
<span>
<Link
newTab
href={`/individuals/${theirIndividualGuid}`}
>
{theirIndividualName}
</Link>
</span>
),
formattedDeadline,
},
)}
</Text>
);
const notificationText =
currentNotificationSchema?.notificationMessage ? (
Copy link
Contributor Author

@Emily-Ke Emily-Ke Aug 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost all of this diff is formatting caused by adding this line. Everything was indented because of this.

<Text
key={notification?.guid}
style={{
color: read
? theme.palette.text.secondary
: theme.palette.text.primary,
}}
variant="body2"
>
{intl.formatMessage(
{
id: currentNotificationSchema.notificationMessage,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the one other change. I removed the optional chaining operator because the new condition above that determines if this code should be run is that currentNotificationSchema.notificationMessage exists.

},
{
userName: (
<span>
<Link
newTab
href={`/users/${userNameGuid}`}
>
{userName}
</Link>
</span>
),
user1Name,
user2Name,
yourIndividualName: (
<span>
<Link
newTab
href={`/individuals/${yourIndividualGuid}`}
>
{yourIndName}
</Link>
</span>
),
theirIndividualName: (
<span>
<Link
newTab
href={`/individuals/${theirIndividualGuid}`}
>
{theirIndividualName}
</Link>
</span>
),
formattedDeadline,
},
)}
</Text>
) : null;
const howLongAgoText = (
<Text
style={{
Expand Down