型エラー修正とちょっとした修正

Signed-off-by: mattyatea <mattyacocacora0@gmail.com>
This commit is contained in:
mattyatea 2023-11-09 18:35:47 +09:00
parent 12b7ec3046
commit d6fb3c3342
No known key found for this signature in database
GPG Key ID: 068E54E2C33BEF9A
2 changed files with 56 additions and 12 deletions

View File

@ -20,7 +20,31 @@ export const meta = {
items: {
type: 'object',
optional: false, nullable: false,
ref: 'Note',
properties: {
id: { type: 'string', optional: false, nullable: false },
note: {
type: 'object',
optional: false, nullable: false,
properties: {
id: { type: 'string', optional: false, nullable: false },
text: { type: 'string', optional: false, nullable: false },
files: { type: 'array', optional: false, nullable: false, items: { type: 'any' } },
localOnly: { type: 'boolean', optional: false, nullable: false },
visibility: { type: 'string', optional: false, nullable: false },
visibleUsers: { type: 'array', optional: false, nullable: false, items: { type: 'any' } },
reactionAcceptance: { type: 'string', optional: false, nullable: false },
user: {
type: 'object',
optional: false, nullable: false,
ref: 'User',
},
createdAt: { type: 'string', optional: false, nullable: false },
isSchedule: { type: 'boolean', optional: false, nullable: false },
},
},
userId: { type: 'string', optional: false, nullable: false },
expiresAt: { type: 'string', optional: false, nullable: false },
},
},
},
limit: {
@ -33,10 +57,6 @@ export const meta = {
} as const;
export const paramDef = {
type: 'object',
properties: {
},
required: [],
} as const;
@Injectable()
@ -49,13 +69,36 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
const scheduleNotes = await this.noteScheduleRepository.findBy({ userId: me.id });
const user = await this.userEntityService.pack(me, me);
scheduleNotes.forEach((item: any) => {
item.note.user = user;
item.note.createdAt = new Date(item.expiresAt);
item.note.isSchedule = true;
item.note.id = item.id;
const scheduleNotesPack: {
id: string;
note: {
id: string;
text: string;
files: any[];
localOnly: boolean;
visibility: string;
visibleUsers: any[];
reactionAcceptance: string;
user: any;
createdAt: string;
isSchedule: boolean;
};
userId: string;
expiresAt: string;
}[] = scheduleNotes.map((item: any) => {
return {
...item,
note: {
...item.note,
user: user,
createdAt: new Date(item.expiresAt),
isSchedule: true,
id: item.id,
},
};
});
return scheduleNotes;
return scheduleNotesPack;
});
}
}

View File

@ -563,6 +563,7 @@ function removeVisibleUser(user) {
function clear() {
text = '';
schedule = null;
files = [];
poll = null;
quoteId = null;
@ -802,7 +803,7 @@ async function post(ev?: MouseEvent) {
if (notesCount === 1) {
claimAchievement('notes1');
}
poll = null;
const text = postData.text ?? '';
const lowerCase = text.toLowerCase();
if ((lowerCase.includes('love') || lowerCase.includes('❤')) && lowerCase.includes('misskey')) {