Skip to content

Commit 2c84d06

Browse files
authored
Fix type checking (#14052)
1 parent e88f08a commit 2c84d06

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/frontend/src/components/MkNotification.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ SPDX-License-Identifier: AGPL-3.0-only
66
<template>
77
<div :class="$style.root">
88
<div :class="$style.head">
9-
<MkAvatar v-if="['pollEnded', 'note'].includes(notification.type) && notification.note" :class="$style.icon" :user="notification.note.user" link preview/>
9+
<MkAvatar v-if="['pollEnded', 'note'].includes(notification.type) && 'note' in notification" :class="$style.icon" :user="notification.note.user" link preview/>
1010
<MkAvatar v-else-if="['roleAssigned', 'achievementEarned'].includes(notification.type)" :class="$style.icon" :user="$i" link preview/>
1111
<div v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'" :class="[$style.icon, $style.icon_reactionGroupHeart]"><i class="ti ti-heart" style="line-height: 1;"></i></div>
1212
<div v-else-if="notification.type === 'reaction:grouped'" :class="[$style.icon, $style.icon_reactionGroup]"><i class="ti ti-plus" style="line-height: 1;"></i></div>
1313
<div v-else-if="notification.type === 'renote:grouped'" :class="[$style.icon, $style.icon_renoteGroup]"><i class="ti ti-repeat" style="line-height: 1;"></i></div>
1414
<img v-else-if="notification.type === 'test'" :class="$style.icon" :src="infoImageUrl"/>
15-
<MkAvatar v-else-if="notification.user" :class="$style.icon" :user="notification.user" link preview/>
16-
<img v-else-if="notification.icon" :class="[$style.icon, $style.icon_app]" :src="notification.icon" alt=""/>
15+
<MkAvatar v-else-if="'user' in notification" :class="$style.icon" :user="notification.user" link preview/>
16+
<img v-else-if="'icon' in notification" :class="[$style.icon, $style.icon_app]" :src="notification.icon" alt=""/>
1717
<div
1818
:class="[$style.subIcon, {
1919
[$style.t_follow]: notification.type === 'follow',
@@ -164,13 +164,13 @@ const props = withDefaults(defineProps<{
164164
const followRequestDone = ref(false);
165165

166166
const acceptFollowRequest = () => {
167-
if (props.notification.user == null) return;
167+
if (!('user' in props.notification)) return;
168168
followRequestDone.value = true;
169169
misskeyApi('following/requests/accept', { userId: props.notification.user.id });
170170
};
171171

172172
const rejectFollowRequest = () => {
173-
if (props.notification.user == null) return;
173+
if (!('user' in props.notification)) return;
174174
followRequestDone.value = true;
175175
misskeyApi('following/requests/reject', { userId: props.notification.user.id });
176176
};

0 commit comments

Comments
 (0)