aboutsummaryrefslogtreecommitdiff
path: root/src/components/notifications
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/notifications')
-rw-r--r--src/components/notifications/Notification.tsx29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx
index e648b554..c754f941 100644
--- a/src/components/notifications/Notification.tsx
+++ b/src/components/notifications/Notification.tsx
@@ -85,19 +85,44 @@ const Notification: React.FC<NotificationProps> = (props) => {
break;
case 'CMT':
// find the moment we need to display
- const moment = loggedInUserMoments?.find(
+ let moment: MomentType | undefined = loggedInUserMoments?.find(
(m) => m.moment_id === notification_object?.moment_id,
);
+ let userXId;
+
+ //This needs to be done if user replies to a comment on a moment that is not user's own moment
+ if (!moment) {
+ try {
+ if (!userXInStore(state, screenType, id)) {
+ await fetchUserX(
+ dispatch,
+ {userId: id, username: username},
+ screenType,
+ );
+ }
+
+ //Wait for data to be loaded
+ setTimeout(() => {}, 200);
+ const {moments} = state.userX[screenType][id];
+ moment = moments?.find(
+ (m) => m.moment_id === notification_object?.moment_id,
+ );
+ userXId = id;
+ } catch (err) {
+ console.log(err);
+ }
+ }
if (moment) {
navigation.push('IndividualMoment', {
moment,
- userXId: undefined, // we're only viewing our own moment here
+ userXId: userXId, // we're only viewing our own moment here
screenType,
});
setTimeout(() => {
navigation.push('MomentCommentsScreen', {
moment_id: moment.moment_id,
screenType,
+ comment_id: notification_object?.comment_id,
});
}, 500);
}