diff options
author | Ivan Chen <ivan@tagg.id> | 2021-01-15 17:53:05 -0500 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-01-15 20:18:33 -0500 |
commit | b138c10822e399c84e54c35e2775e4eb53da1567 (patch) | |
tree | 95b50204fd23605b82054e9ffe3c67479b6360bc /src | |
parent | a296cf6e26ad57f951487c94009cb1693c281c1f (diff) |
fixed some bugs
Diffstat (limited to 'src')
-rw-r--r-- | src/components/notifications/Notification.tsx | 6 | ||||
-rw-r--r-- | src/screens/main/NotificationsScreen.tsx | 8 | ||||
-rw-r--r-- | src/services/MomentServices.ts | 4 |
3 files changed, 5 insertions, 13 deletions
diff --git a/src/components/notifications/Notification.tsx b/src/components/notifications/Notification.tsx index 62aa0a0b..5efa8b98 100644 --- a/src/components/notifications/Notification.tsx +++ b/src/components/notifications/Notification.tsx @@ -15,7 +15,6 @@ import { interface NotificationProps { item: NotificationType; - userXId: string | undefined; screenType: ScreenType; } @@ -28,7 +27,6 @@ const Notification: React.FC<NotificationProps> = (props) => { notification_object, unread, }, - userXId, screenType, } = props; const navigation = useNavigation(); @@ -62,7 +60,7 @@ const Notification: React.FC<NotificationProps> = (props) => { let mounted = true; const loadMomentImage = async (moment_id: string) => { const response = await loadMomentThumbnail(moment_id); - if (mounted) { + if (mounted && response) { setMomentURI(response); } }; @@ -97,7 +95,7 @@ const Notification: React.FC<NotificationProps> = (props) => { if (moment) { navigation.push('IndividualMoment', { moment, - userXId, + userXId: undefined, // we're only viewing our own moment here screenType, }); setTimeout(() => { diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx index ba52d988..da1e7a2b 100644 --- a/src/screens/main/NotificationsScreen.tsx +++ b/src/screens/main/NotificationsScreen.tsx @@ -96,13 +96,7 @@ const NotificationsScreen: React.FC = () => { }, [lastViewed, notifications]); const renderNotification = ({item}: {item: NotificationType}) => ( - <Notification - item={item} - userXId={ - item.actor.id === loggedInUser.userId ? undefined : item.actor.id - } - screenType={ScreenType.Notifications} - /> + <Notification item={item} screenType={ScreenType.Notifications} /> ); const renderSectionHeader = ({section: {title, data}}) => diff --git a/src/services/MomentServices.ts b/src/services/MomentServices.ts index 6d16de96..514b674c 100644 --- a/src/services/MomentServices.ts +++ b/src/services/MomentServices.ts @@ -209,10 +209,10 @@ export const loadMomentThumbnail = async (momentId: string) => { if (status === 200) { return response.path(); } else { - return ''; + return undefined; } } catch (error) { console.log(error); - return ''; + return undefined; } }; |