Skip to content

Commit

Permalink
Merge pull request #10181 from misskey-dev/develop
Browse files Browse the repository at this point in the history
Release: 13.9.1
  • Loading branch information
syuilo authored Mar 3, 2023
2 parents 5bd68aa + 7e87005 commit b23a9b1
Show file tree
Hide file tree
Showing 11 changed files with 345 additions and 89 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
You should also include the user name that made the change.
-->

## 13.9.1 (2023/03/03)

### Bugfixes
- ノートに添付したファイルが表示されない場合があるのを修正

## 13.9.0 (2023/03/03)

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ _achievements:
_loggedInOnNewYearsDay:
title: "Happy New Year!"
description: "Logged in on the first day of the year"
flavor: "To another great year on this instance"
flavor: "To another great year!"
_cookieClicked:
title: "A game in which you click cookies"
description: "Clicked the cookie"
Expand Down
1 change: 1 addition & 0 deletions locales/es-ES.yml
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ tenMinutes: "10 minutos"
oneHour: "1 hora"
oneDay: "1 día"
oneWeek: "1 semana"
oneMonth: "1 mes"
reflectMayTakeTime: "Puede pasar un tiempo hasta que se reflejen los cambios"
failedToFetchAccountInformation: "No se pudo obtener información de la cuenta"
rateLimitExceeded: "Se excedió el límite de peticiones"
Expand Down
2 changes: 1 addition & 1 deletion locales/fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ updateRemoteUser: "Mettre à jour les informations de l’utilisateur·rice dist
deleteAllFiles: "Supprimer tous les fichiers"
deleteAllFilesConfirm: "Êtes-vous sûr·e de vouloir supprimer tous les fichiers ?"
removeAllFollowing: "Retenir tous les abonnements"
removeAllFollowingDescription: "Se désabonner de tous les comptes de {host}. Veuillez lancer cette action uniquement si l’instance n’existe plus."
removeAllFollowingDescription: "Se désabonner de tous les comptes de {host}. Veuillez lancer cette action dans les cas où l’instance n’existe plus, etc."
userSuspended: "Cet·te utilisateur·rice a été suspendu·e."
userSilenced: "Cette utilisateur·trice a été mis·e en sourdine."
yourAccountSuspendedTitle: "Ce compte est suspendu"
Expand Down
77 changes: 39 additions & 38 deletions locales/ko-KR.yml

Large diffs are not rendered by default.

307 changes: 290 additions & 17 deletions locales/vi-VN.yml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ aboutX: "關於{x}"
emojiStyle: "表情符號的風格"
native: "原生"
disableDrawer: "不顯示下拉式選單"
showNoteActionsOnlyHover: "僅在游標停留時顯示貼文的操作選項"
noHistory: "沒有歷史紀錄"
signinHistory: "登入歷史"
enableAdvancedMfm: "啟用高級MFM"
Expand Down Expand Up @@ -853,6 +854,7 @@ tenMinutes: "10分鐘"
oneHour: "1小時"
oneDay: "1天"
oneWeek: "1週"
oneMonth: "1個月"
reflectMayTakeTime: "可能需要一些時間才會出現效果。"
failedToFetchAccountInformation: "取得帳戶資訊失敗"
rateLimitExceeded: "已超過速率限制"
Expand Down Expand Up @@ -952,6 +954,7 @@ joinThisServer: "在此伺服器上註冊"
exploreOtherServers: "探索其他伺服器"
letsLookAtTimeline: "看看時間軸"
disableFederationWarn: "聯邦被停用了。即使停用也不會讓您的貼文不公開,在大多數情況下,不需要啟用這個選項。"
invitationRequiredToRegister: "目前這個伺服器為邀請制,必須擁有邀請碼才能註冊。"
_achievements:
earnedAt: "獲得日期"
_types:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "13.9.0",
"version": "13.9.1",
"codename": "nasubi",
"repository": {
"type": "git",
Expand Down
24 changes: 2 additions & 22 deletions packages/backend/src/core/entities/DriveFileEntityService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { forwardRef, Inject, Injectable } from '@nestjs/common';
import { DataSource, In } from 'typeorm';
import { DataSource } from 'typeorm';
import { DI } from '@/di-symbols.js';
import type { NotesRepository, DriveFilesRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
Expand All @@ -21,7 +21,6 @@ type PackOptions = {
};
import { bindThis } from '@/decorators.js';
import { isMimeImage } from '@/misc/is-mime-image.js';
import { isNotNull } from '@/misc/is-not-null.js';

@Injectable()
export class DriveFileEntityService {
Expand Down Expand Up @@ -256,29 +255,10 @@ export class DriveFileEntityService {

@bindThis
public async packMany(
files: DriveFile[],
files: (DriveFile['id'] | DriveFile)[],
options?: PackOptions,
): Promise<Packed<'DriveFile'>[]> {
const items = await Promise.all(files.map(f => this.packNullable(f, options)));
return items.filter((x): x is Packed<'DriveFile'> => x != null);
}

@bindThis
public async packManyByIdsMap(
fileIds: DriveFile['id'][],
options?: PackOptions,
): Promise<Map<Packed<'DriveFile'>['id'], Packed<'DriveFile'>>> {
const files = await this.driveFilesRepository.findBy({ id: In(fileIds) });
const packedFiles = await this.packMany(files, options);
return new Map(packedFiles.map(f => [f.id, f]));
}

@bindThis
public async packManyByIds(
fileIds: DriveFile['id'][],
options?: PackOptions,
): Promise<Packed<'DriveFile'>[]> {
const filesMap = await this.packManyByIdsMap(fileIds, options);
return fileIds.map(id => filesMap.get(id)).filter(isNotNull);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export class GalleryPostEntityService {
title: post.title,
description: post.description,
fileIds: post.fileIds,
// TODO: packMany causes N+1 queries
files: this.driveFileEntityService.packManyByIds(post.fileIds),
files: this.driveFileEntityService.packMany(post.fileIds),
tags: post.tags.length > 0 ? post.tags : undefined,
isSensitive: post.isSensitive,
likedCount: post.likedCount,
Expand Down
8 changes: 1 addition & 7 deletions packages/backend/src/core/entities/NoteEntityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type { Note } from '@/models/entities/Note.js';
import type { NoteReaction } from '@/models/entities/NoteReaction.js';
import type { UsersRepository, NotesRepository, FollowingsRepository, PollsRepository, PollVotesRepository, NoteReactionsRepository, ChannelsRepository, DriveFilesRepository } from '@/models/index.js';
import { bindThis } from '@/decorators.js';
import { isNotNull } from '@/misc/is-not-null.js';
import type { OnModuleInit } from '@nestjs/common';
import type { CustomEmojiService } from '../CustomEmojiService.js';
import type { ReactionService } from '../ReactionService.js';
Expand Down Expand Up @@ -258,7 +257,6 @@ export class NoteEntityService implements OnModuleInit {
skipHide?: boolean;
_hint_?: {
myReactions: Map<Note['id'], NoteReaction | null>;
packedFiles: Map<Note['fileIds'][number], Packed<'DriveFile'>>;
};
},
): Promise<Packed<'Note'>> {
Expand Down Expand Up @@ -286,7 +284,6 @@ export class NoteEntityService implements OnModuleInit {
const reactionEmojiNames = Object.keys(note.reactions)
.filter(x => x.startsWith(':') && x.includes('@') && !x.includes('@.')) // リモートカスタム絵文字のみ
.map(x => this.reactionService.decodeReaction(x).reaction.replaceAll(':', ''));
const packedFiles = options?._hint_?.packedFiles;

const packed: Packed<'Note'> = await awaitAll({
id: note.id,
Expand All @@ -307,7 +304,7 @@ export class NoteEntityService implements OnModuleInit {
emojis: host != null ? this.customEmojiService.populateEmojis(note.emojis, host) : undefined,
tags: note.tags.length > 0 ? note.tags : undefined,
fileIds: note.fileIds,
files: packedFiles != null ? note.fileIds.map(fi => packedFiles.get(fi)).filter(isNotNull) : this.driveFileEntityService.packManyByIds(note.fileIds),
files: this.driveFileEntityService.packMany(note.fileIds),
replyId: note.replyId,
renoteId: note.renoteId,
channelId: note.channelId ?? undefined,
Expand Down Expand Up @@ -391,14 +388,11 @@ export class NoteEntityService implements OnModuleInit {
}

await this.customEmojiService.prefetchEmojis(this.customEmojiService.aggregateNoteEmojis(notes));
const fileIds = notes.flatMap(n => n.fileIds);
const packedFiles = await this.driveFileEntityService.packManyByIdsMap(fileIds);

return await Promise.all(notes.map(n => this.pack(n, me, {
...options,
_hint_: {
myReactions: myReactionsMap,
packedFiles,
},
})));
}
Expand Down

0 comments on commit b23a9b1

Please sign in to comment.