Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kozakura913 committed Nov 9, 2024
1 parent 05dca98 commit 5ba7403
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/core/AvatarDecorationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class AvatarDecorationService implements OnApplicationShutdown {
const userHostUrl = `https://${user.host}`;
const showUserApiUrl = `${userHostUrl}/api/users/show`;

if (!['misskey', 'cherrypick', 'sharkey'].includes(<string>instance?.softwareName)) return;
if (!instance || !['misskey', 'cherrypick', 'sharkey'].includes(<string>instance.softwareName)) return;

const res = await this.httpRequestService.send(showUserApiUrl, {
method: 'POST',
Expand Down
10 changes: 9 additions & 1 deletion packages/backend/src/core/WebhookTestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function generateAbuseReport(override?: Partial<MiAbuseUserReport>): MiAbuseUser
function generateDummyUser(override?: Partial<MiUser>): MiUser {
return {
id: 'dummy-user-1',
isIndexable: true,
searchableBy: 'public',
outbox: null,
updatedAt: new Date(Date.now() - oneDayMillis * 7),
lastFetchedAt: new Date(Date.now() - oneDayMillis * 5),
lastActiveDate: new Date(Date.now() - oneDayMillis * 3),
Expand Down Expand Up @@ -68,7 +71,6 @@ function generateDummyUser(override?: Partial<MiUser>): MiUser {
isHibernated: false,
isDeleted: false,
emojis: [],
score: 0,
host: null,
inbox: null,
sharedInbox: null,
Expand All @@ -83,6 +85,12 @@ function generateDummyUser(override?: Partial<MiUser>): MiUser {
function generateDummyNote(override?: Partial<MiNote>): MiNote {
return {
id: 'dummy-note-1',
updatedAt: null,
updatedAtHistory: null,
noteEditHistory: [],
hasEvent: false,
disableRightClick: false,
searchableBy: 'public',
replyId: null,
reply: null,
renoteId: null,
Expand Down
25 changes: 23 additions & 2 deletions packages/backend/src/models/json-schema/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,31 @@ export const packedNotificationSchema = {
optional: false, nullable: false,
enum: ['groupInvited'],
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
group: {
type: 'object',
properties: {
name: {
type: 'string',
optional: false, nullable: false,
},
},
optional: false, nullable: false,
},
invitation: {
type: 'string',
type: 'object',
properties: {
id: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
optional: false, nullable: false,
format: 'id',
},
},
}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ class ReversiGameChannel extends Channel {
this.putStone(body.pos, body.id);
break;
case 'claimTimeIsUp': this.claimTimeIsUp(); break;
case 'reaction': this.sendReaction(body); break;
case 'reaction':
if (typeof body !== 'string') return;
this.sendReaction(body);
break;
}
}

Expand Down
10 changes: 8 additions & 2 deletions packages/cherrypick-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4697,8 +4697,14 @@ export type components = {
createdAt: string;
/** @enum {string} */
type: 'groupInvited';
/** Format: id */
invitation: string;
user: components['schemas']['UserLite'];
group: {
name: string;
};
invitation: {
/** Format: id */
id: string;
};
};
DriveFile: {
/**
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/src/components/MkNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<span v-else-if="notification.type === 'reaction:grouped'">{{ i18n.tsx._notification.reactedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }}</span>
<span v-else-if="notification.type === 'note:grouped'">{{ i18n.tsx._notification.notedBySomeUsers({ n: notification.noteIds.length }) }}</span>
<span v-else-if="notification.type === 'renote:grouped'">{{ i18n.tsx._notification.renotedBySomeUsers({ n: notification.users.length }) }}</span>
<span v-else-if="notification.type === 'note:grouped'">{{ i18n.tsx._notification.notedBySomeUsers({ n: notification.noteIds.length }) }}</span>
<span v-else-if="notification.type === 'app'">{{ notification.header }}</span>
<MkTime v-if="withTime" :time="notification.createdAt" :class="$style.headerTime" :mode="defaultStore.state.enableAbsoluteTime ? 'absolute' : 'relative'"/>
<div v-if="withDelete">
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/scripts/get-user-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter
listId: list.id,
userId: user.id,
}).then(() => {
list.userIds?.splice(list.userIds?.indexOf(user.id), 1);
list.userIds?.splice(list.userIds.indexOf(user.id), 1);
});
}
}));
Expand Down Expand Up @@ -630,7 +630,7 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter
icon: 'ti ti-refresh',
text: i18n.ts.updateRemoteUser,
action: userInfoUpdate,
},{
}, {
icon: 'ti ti-refresh-dot',
text: i18n.ts.fetchOutbox,
action: userFetchOutbox,
Expand Down
3 changes: 1 addition & 2 deletions packages/sw/src/scripts/create-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ async function composeNotification(data: PushNotificationDataMap[keyof PushNotif

const tag = `reaction:${data.body.note.id}`;
return [i18n.tsx._notification.youGotReact({ name: getUserName(data.body.user) }), {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
body: (reaction1.startsWith(':') ? `:${ reaction }:` : `${ reaction }` + '\n' + data.body.note.text) ?? '',
body: reaction1.startsWith(':') ? `:${ reaction }:` : `${ reaction }` + '\n' + data.body.note.text,
icon: data.body.user.avatarUrl ?? undefined,
tag,
badge,
Expand Down

0 comments on commit 5ba7403

Please sign in to comment.