egirlskey/packages/backend/src/core/activitypub/models/ApPersonService.ts

730 lines
28 KiB
TypeScript
Raw Normal View History

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Inject, Injectable } from '@nestjs/common';
2022-09-17 18:27:08 +00:00
import promiseLimit from 'promise-limit';
import { DataSource } from 'typeorm';
import { ModuleRef } from '@nestjs/core';
import { DI } from '@/di-symbols.js';
import type { FollowingsRepository, InstancesRepository, UserProfilesRepository, UserPublickeysRepository, UsersRepository } from '@/models/_.js';
2022-09-20 20:33:11 +00:00
import type { Config } from '@/config.js';
import type { MiLocalUser, MiRemoteUser } from '@/models/User.js';
import { MiUser } from '@/models/User.js';
2022-09-17 18:27:08 +00:00
import { truncate } from '@/misc/truncate.js';
2023-04-04 08:32:09 +00:00
import type { CacheService } from '@/core/CacheService.js';
2022-09-17 18:27:08 +00:00
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
import type Logger from '@/logger.js';
import type { MiNote } from '@/models/Note.js';
2022-09-17 18:27:08 +00:00
import type { IdService } from '@/core/IdService.js';
import type { MfmService } from '@/core/MfmService.js';
import { toArray } from '@/misc/prelude/array.js';
import type { GlobalEventService } from '@/core/GlobalEventService.js';
import type { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
import type { FetchInstanceMetadataService } from '@/core/FetchInstanceMetadataService.js';
import { MiUserProfile } from '@/models/UserProfile.js';
import { MiUserPublickey } from '@/models/UserPublickey.js';
2022-09-17 18:27:08 +00:00
import type UsersChart from '@/core/chart/charts/users.js';
import type InstanceChart from '@/core/chart/charts/instance.js';
import type { HashtagService } from '@/core/HashtagService.js';
import { MiUserNotePining } from '@/models/UserNotePining.js';
2022-09-17 18:27:08 +00:00
import { StatusError } from '@/misc/status-error.js';
import type { UtilityService } from '@/core/UtilityService.js';
import type { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
import { MetaService } from '@/core/MetaService.js';
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
import type { AccountMoveService } from '@/core/AccountMoveService.js';
import { checkHttps } from '@/misc/check-https.js';
import { isNotNull } from '@/misc/is-not-null.js';
2022-09-17 18:27:08 +00:00
import { getApId, getApType, getOneApHrefNullable, isActor, isCollection, isCollectionOrOrderedCollection, isPropertyValue } from '../type.js';
import { extractApHashtags } from './tag.js';
import type { OnModuleInit } from '@nestjs/common';
import type { ApNoteService } from './ApNoteService.js';
import type { ApMfmService } from '../ApMfmService.js';
import type { ApResolverService, Resolver } from '../ApResolverService.js';
import type { ApLoggerService } from '../ApLoggerService.js';
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
import type { ApImageService } from './ApImageService.js';
import type { IActor, IObject } from '../type.js';
2022-09-17 18:27:08 +00:00
const nameLength = 128;
2024-03-07 01:24:35 +00:00
const summaryLength = 65536;
2022-09-17 18:27:08 +00:00
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
type Field = Record<'name' | 'value', string>;
2022-09-17 18:27:08 +00:00
@Injectable()
export class ApPersonService implements OnModuleInit {
private utilityService: UtilityService;
private userEntityService: UserEntityService;
private driveFileEntityService: DriveFileEntityService;
2022-09-17 18:27:08 +00:00
private idService: IdService;
private globalEventService: GlobalEventService;
private metaService: MetaService;
2022-09-17 18:27:08 +00:00
private federatedInstanceService: FederatedInstanceService;
private fetchInstanceMetadataService: FetchInstanceMetadataService;
2023-04-04 08:32:09 +00:00
private cacheService: CacheService;
2022-09-17 18:27:08 +00:00
private apResolverService: ApResolverService;
private apNoteService: ApNoteService;
private apImageService: ApImageService;
private apMfmService: ApMfmService;
private mfmService: MfmService;
private hashtagService: HashtagService;
private usersChart: UsersChart;
private instanceChart: InstanceChart;
private apLoggerService: ApLoggerService;
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
private accountMoveService: AccountMoveService;
2022-09-18 18:11:50 +00:00
private logger: Logger;
2022-09-17 18:27:08 +00:00
constructor(
private moduleRef: ModuleRef,
@Inject(DI.config)
private config: Config,
@Inject(DI.db)
private db: DataSource,
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
@Inject(DI.userProfilesRepository)
private userProfilesRepository: UserProfilesRepository,
@Inject(DI.userPublickeysRepository)
private userPublickeysRepository: UserPublickeysRepository,
@Inject(DI.instancesRepository)
private instancesRepository: InstancesRepository,
@Inject(DI.followingsRepository)
private followingsRepository: FollowingsRepository,
) {
}
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
onModuleInit(): void {
2022-09-17 18:27:08 +00:00
this.utilityService = this.moduleRef.get('UtilityService');
this.userEntityService = this.moduleRef.get('UserEntityService');
this.driveFileEntityService = this.moduleRef.get('DriveFileEntityService');
2022-09-17 18:27:08 +00:00
this.idService = this.moduleRef.get('IdService');
this.globalEventService = this.moduleRef.get('GlobalEventService');
this.metaService = this.moduleRef.get('MetaService');
2022-09-17 18:27:08 +00:00
this.federatedInstanceService = this.moduleRef.get('FederatedInstanceService');
this.fetchInstanceMetadataService = this.moduleRef.get('FetchInstanceMetadataService');
2023-04-04 08:32:09 +00:00
this.cacheService = this.moduleRef.get('CacheService');
2022-09-17 18:27:08 +00:00
this.apResolverService = this.moduleRef.get('ApResolverService');
this.apNoteService = this.moduleRef.get('ApNoteService');
this.apImageService = this.moduleRef.get('ApImageService');
this.apMfmService = this.moduleRef.get('ApMfmService');
this.mfmService = this.moduleRef.get('MfmService');
this.hashtagService = this.moduleRef.get('HashtagService');
this.usersChart = this.moduleRef.get('UsersChart');
this.instanceChart = this.moduleRef.get('InstanceChart');
this.apLoggerService = this.moduleRef.get('ApLoggerService');
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
this.accountMoveService = this.moduleRef.get('AccountMoveService');
2022-09-18 18:11:50 +00:00
this.logger = this.apLoggerService.logger;
2022-09-17 18:27:08 +00:00
}
/**
* Validate and convert to actor object
* @param x Fetched object
* @param uri Fetch target URI
*/
@bindThis
2022-09-18 18:11:50 +00:00
private validateActor(x: IObject, uri: string): IActor {
2024-03-30 11:05:58 +00:00
const expectHost = this.utilityService.punyHost(uri);
2022-09-17 18:27:08 +00:00
if (!isActor(x)) {
throw new Error(`invalid Actor type '${x.type}'`);
}
if (!(typeof x.id === 'string' && x.id.length > 0)) {
throw new Error('invalid Actor: wrong id');
}
if (!(typeof x.inbox === 'string' && x.inbox.length > 0)) {
throw new Error('invalid Actor: wrong inbox');
}
2024-03-30 11:05:58 +00:00
if (this.utilityService.punyHost(x.inbox) !== expectHost) {
throw new Error('invalid Actor: inbox has different host');
}
for (const collection of ['outbox', 'followers', 'following'] as (keyof IActor)[]) {
const collectionUri = (x as IActor)[collection];
if (typeof collectionUri === 'string' && collectionUri.length > 0) {
if (this.utilityService.punyHost(collectionUri) !== expectHost) {
throw new Error(`invalid Actor: ${collection} has different host`);
}
}
}
2022-09-17 18:27:08 +00:00
if (!(typeof x.preferredUsername === 'string' && x.preferredUsername.length > 0 && x.preferredUsername.length <= 128 && /^\w([\w-.]*\w)?$/.test(x.preferredUsername))) {
throw new Error('invalid Actor: wrong username');
}
// These fields are only informational, and some AP software allows these
// fields to be very long. If they are too long, we cut them off. This way
// we can at least see these users and their activities.
if (x.name) {
if (!(typeof x.name === 'string' && x.name.length > 0)) {
throw new Error('invalid Actor: wrong name');
}
x.name = truncate(x.name, nameLength);
} else if (x.name === '') {
// Mastodon emits empty string when the name is not set.
x.name = undefined;
2022-09-17 18:27:08 +00:00
}
if (x.summary) {
if (!(typeof x.summary === 'string' && x.summary.length > 0)) {
throw new Error('invalid Actor: wrong summary');
}
x.summary = truncate(x.summary, summaryLength);
}
2024-03-30 11:05:58 +00:00
const idHost = this.utilityService.punyHost(x.id);
2022-09-17 18:27:08 +00:00
if (idHost !== expectHost) {
throw new Error('invalid Actor: id has different host');
}
if (x.publicKey) {
if (typeof x.publicKey.id !== 'string') {
throw new Error('invalid Actor: publicKey.id is not a string');
}
2024-03-30 11:05:58 +00:00
const publicKeyIdHost = this.utilityService.punyHost(x.publicKey.id);
2022-09-17 18:27:08 +00:00
if (publicKeyIdHost !== expectHost) {
throw new Error('invalid Actor: publicKey.id has different host');
}
}
return x;
}
/**
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
* uriからUser(Person)
2022-09-17 18:27:08 +00:00
*
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
* Misskeyに対象のPersonが登録されていればそれを返しnullを返します
2022-09-17 18:27:08 +00:00
*/
@bindThis
public async fetchPerson(uri: string): Promise<MiLocalUser | MiRemoteUser | null> {
const cached = this.cacheService.uriPersonCache.get(uri) as MiLocalUser | MiRemoteUser | null | undefined;
2022-09-17 18:27:08 +00:00
if (cached) return cached;
// URIがこのサーバーを指しているならデータベースからフェッチ
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
if (uri.startsWith(`${this.config.url}/`)) {
2022-09-17 18:27:08 +00:00
const id = uri.split('/').pop();
const u = await this.usersRepository.findOneBy({ id }) as MiLocalUser | null;
2023-04-04 08:32:09 +00:00
if (u) this.cacheService.uriPersonCache.set(uri, u);
2022-09-17 18:27:08 +00:00
return u;
}
//#region このサーバーに既に登録されていたらそれを返す
const exist = await this.usersRepository.findOneBy({ uri }) as MiLocalUser | MiRemoteUser | null;
2022-09-17 18:27:08 +00:00
if (exist) {
2023-04-04 08:32:09 +00:00
this.cacheService.uriPersonCache.set(uri, exist);
2022-09-17 18:27:08 +00:00
return exist;
}
//#endregion
return null;
}
2024-02-06 20:23:37 +00:00
private async resolveAvatarAndBanner(user: MiRemoteUser, icon: any, image: any, bgimg: any): Promise<Partial<Pick<MiRemoteUser, 'avatarId' | 'bannerId' | 'backgroundId' | 'avatarUrl' | 'bannerUrl' | 'backgroundUrl' | 'avatarBlurhash' | 'bannerBlurhash' | 'backgroundBlurhash'>>> {
if (user == null) throw new Error('failed to create user: user is null');
const [avatar, banner, background] = await Promise.all([icon, image, bgimg].map(img => {
2024-02-06 20:23:37 +00:00
// if we have an explicitly missing image, return an
// explicitly-null set of values
if ((img == null) || (typeof img === 'object' && img.url == null)) {
return { id: null, url: null, blurhash: null };
}
return this.apImageService.resolveImage(user, img).catch(() => null);
}));
2024-02-06 20:23:37 +00:00
/*
we don't want to return nulls on errors! if the database fields
are already null, nothing changes; if the database has old
values, we should keep those. The exception is if the remote has
actually removed the images: in that case, the block above
returns the special {id:null}&c value, and we return those
*/
return {
2024-02-06 20:23:37 +00:00
...( avatar ? {
avatarId: avatar.id,
avatarUrl: avatar.url ? this.driveFileEntityService.getPublicUrl(avatar, 'avatar') : null,
avatarBlurhash: avatar.blurhash,
} : {}),
...( banner ? {
bannerId: banner.id,
bannerUrl: banner.url ? this.driveFileEntityService.getPublicUrl(banner) : null,
bannerBlurhash: banner.blurhash,
} : {}),
...( background ? {
backgroundId: background.id,
backgroundUrl: background.url ? this.driveFileEntityService.getPublicUrl(background) : null,
backgroundBlurhash: background.blurhash,
} : {}),
};
}
2022-09-17 18:27:08 +00:00
/**
* Personを作成します
*/
@bindThis
public async createPerson(uri: string, resolver?: Resolver): Promise<MiRemoteUser> {
2022-09-17 18:27:08 +00:00
if (typeof uri !== 'string') throw new Error('uri is not string');
if (uri.startsWith(this.config.url)) {
throw new StatusError('cannot resolve local user', 400, 'cannot resolve local user');
}
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
// eslint-disable-next-line no-param-reassign
2022-09-17 18:27:08 +00:00
if (resolver == null) resolver = this.apResolverService.createResolver();
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
const object = await resolver.resolve(uri);
if (object.id == null) throw new Error('invalid object.id: ' + object.id);
2022-09-17 18:27:08 +00:00
2022-09-18 18:11:50 +00:00
const person = this.validateActor(object, uri);
2022-09-17 18:27:08 +00:00
2022-09-18 18:11:50 +00:00
this.logger.info(`Creating the Person: ${person.id}`);
2022-09-17 18:27:08 +00:00
2024-03-30 11:05:58 +00:00
const host = this.utilityService.punyHost(object.id);
2022-09-17 18:27:08 +00:00
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
const fields = this.analyzeAttachments(person.attachment ?? []);
2022-09-17 18:27:08 +00:00
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
const tags = extractApHashtags(person.tag).map(normalizeForSearch).splice(0, 32);
2022-09-17 18:27:08 +00:00
const isBot = getApType(object) === 'Service' || getApType(object) === 'Application';
2022-09-17 18:27:08 +00:00
const bday = person['vcard:bday']?.match(/^\d{4}-\d{2}-\d{2}/);
const url = getOneApHrefNullable(person.url);
if (url && !checkHttps(url)) {
throw new Error('unexpected schema of person url: ' + url);
}
2022-09-17 18:27:08 +00:00
// Create user
let user: MiRemoteUser | null = null;
//#region カスタム絵文字取得
const emojis = await this.apNoteService.extractEmojis(person.tag ?? [], host)
.then(_emojis => _emojis.map(emoji => emoji.name))
.catch(err => {
2023-08-05 04:56:33 +00:00
this.logger.error('error occurred while fetching user emojis', { stack: err });
return [];
});
//#endregion
//#region resolve counts
const _resolver = resolver ?? this.apResolverService.createResolver();
2023-10-17 19:08:15 +00:00
const outboxcollection = await _resolver.resolveCollection(person.outbox).catch(() => { return null; });
const followerscollection = await _resolver.resolveCollection(person.followers!).catch(() => { return null; });
const followingcollection = await _resolver.resolveCollection(person.following!).catch(() => { return null; });
2022-09-17 18:27:08 +00:00
try {
// Start transaction
2022-09-17 18:27:08 +00:00
await this.db.transaction(async transactionalEntityManager => {
user = await transactionalEntityManager.save(new MiUser({
id: this.idService.gen(),
2022-09-17 18:27:08 +00:00
avatarId: null,
bannerId: null,
backgroundId: null,
2022-09-17 18:27:08 +00:00
lastFetchedAt: new Date(),
name: truncate(person.name, nameLength),
noindex: (person as any).noindex ?? false,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo,
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
movedAt: person.movedTo ? new Date() : null,
alsoKnownAs: person.alsoKnownAs,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
isExplorable: person.discoverable,
2022-09-17 18:27:08 +00:00
username: person.preferredUsername,
2023-10-18 18:56:41 +00:00
approved: true,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
usernameLower: person.preferredUsername?.toLowerCase(),
2022-09-17 18:27:08 +00:00
host,
inbox: person.inbox,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
sharedInbox: person.sharedInbox ?? person.endpoints?.sharedInbox,
2023-10-17 19:08:15 +00:00
notesCount: outboxcollection?.totalItems ?? 0,
followersCount: followerscollection?.totalItems ?? 0,
followingCount: followingcollection?.totalItems ?? 0,
2022-09-17 18:27:08 +00:00
followersUri: person.followers ? getApId(person.followers) : undefined,
featured: person.featured ? getApId(person.featured) : undefined,
uri: person.id,
tags,
isBot,
isCat: (person as any).isCat === true,
2023-10-04 02:35:58 +00:00
speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true,
emojis,
})) as MiRemoteUser;
2022-09-17 18:27:08 +00:00
let _description: string | null = null;
if (person._misskey_summary) {
_description = truncate(person._misskey_summary, summaryLength);
} else if (person.summary) {
_description = this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag);
}
await transactionalEntityManager.save(new MiUserProfile({
2022-09-17 18:27:08 +00:00
userId: user.id,
description: _description,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
url,
2022-09-17 18:27:08 +00:00
fields,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
birthday: bday?.[0] ?? null,
2022-09-17 18:27:08 +00:00
location: person['vcard:Address'] ?? null,
userHost: host,
listenbrainz: person.listenbrainz ?? null,
2022-09-17 18:27:08 +00:00
}));
if (person.publicKey) {
await transactionalEntityManager.save(new MiUserPublickey({
2022-09-17 18:27:08 +00:00
userId: user.id,
keyId: person.publicKey.id,
keyPem: person.publicKey.publicKeyPem,
}));
}
});
} catch (e) {
// duplicate key error
2022-09-17 18:27:08 +00:00
if (isDuplicateKeyValueError(e)) {
// /users/@a => /users/:id のように入力がaliasなときにエラーになることがあるのを対応
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
const u = await this.usersRepository.findOneBy({ uri: person.id });
if (u == null) throw new Error('already registered');
2022-09-17 18:27:08 +00:00
user = u as MiRemoteUser;
2022-09-17 18:27:08 +00:00
} else {
2022-09-18 18:11:50 +00:00
this.logger.error(e instanceof Error ? e : new Error(e as string));
2022-09-17 18:27:08 +00:00
throw e;
}
}
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
if (user == null) throw new Error('failed to create user: user is null');
// Register to the cache
this.cacheService.uriPersonCache.set(user.uri, user);
2022-09-17 18:27:08 +00:00
// Register host
this.federatedInstanceService.fetch(host).then(async i => {
2022-09-17 18:27:08 +00:00
this.instancesRepository.increment({ id: i.id }, 'usersCount', 1);
this.fetchInstanceMetadataService.fetchInstanceMetadata(i);
if ((await this.metaService.fetch()).enableChartsForFederatedInstances) {
this.instanceChart.newUser(i.host);
}
2022-09-17 18:27:08 +00:00
});
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
this.usersChart.update(user, true);
2022-09-17 18:27:08 +00:00
// ハッシュタグ更新
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
this.hashtagService.updateUsertags(user, tags);
2022-09-17 18:27:08 +00:00
//#region アバターとヘッダー画像をフェッチ
try {
const updates = await this.resolveAvatarAndBanner(user, person.icon, person.image, person.backgroundUrl);
await this.usersRepository.update(user.id, updates);
user = { ...user, ...updates };
// Register to the cache
this.cacheService.uriPersonCache.set(user.uri, user);
} catch (err) {
2023-08-05 04:56:33 +00:00
this.logger.error('error occurred while fetching user avatar/banner', { stack: err });
}
//#endregion
2022-09-17 18:27:08 +00:00
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
await this.updateFeatured(user.id, resolver).catch(err => this.logger.error(err));
2022-09-17 18:27:08 +00:00
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
return user;
2022-09-17 18:27:08 +00:00
}
/**
* Personの情報を更新します
* Misskeyに対象のPersonが登録されていなければ無視します
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
*
*
2022-09-17 18:27:08 +00:00
* @param uri URI of Person
* @param resolver Resolver
* @param hint Hint of Person object (Personの場合Remote resolveをせずに更新に利用します)
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
* @param movePreventUris URIがPersonのmovedToに指定されていたり10回より多く回っている場合これ以上アカウント移行を行わない
2022-09-17 18:27:08 +00:00
*/
@bindThis
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
public async updatePerson(uri: string, resolver?: Resolver | null, hint?: IObject, movePreventUris: string[] = []): Promise<string | void> {
2022-09-17 18:27:08 +00:00
if (typeof uri !== 'string') throw new Error('uri is not string');
// URIがこのサーバーを指しているならスキップ
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
if (uri.startsWith(`${this.config.url}/`)) return;
2022-09-17 18:27:08 +00:00
//#region このサーバーに既に登録されているか
const exist = await this.fetchPerson(uri) as MiRemoteUser | null;
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
if (exist === null) return;
2022-09-17 18:27:08 +00:00
//#endregion
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
// eslint-disable-next-line no-param-reassign
2022-09-17 18:27:08 +00:00
if (resolver == null) resolver = this.apResolverService.createResolver();
const object = hint ?? await resolver.resolve(uri);
2022-09-18 18:11:50 +00:00
const person = this.validateActor(object, uri);
2022-09-17 18:27:08 +00:00
2022-09-18 18:11:50 +00:00
this.logger.info(`Updating the Person: ${person.id}`);
2022-09-17 18:27:08 +00:00
// カスタム絵文字取得
const emojis = await this.apNoteService.extractEmojis(person.tag ?? [], exist.host).catch(e => {
2022-09-18 18:11:50 +00:00
this.logger.info(`extractEmojis: ${e}`);
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
return [];
2022-09-17 18:27:08 +00:00
});
const emojiNames = emojis.map(emoji => emoji.name);
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
const fields = this.analyzeAttachments(person.attachment ?? []);
2022-09-17 18:27:08 +00:00
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
const tags = extractApHashtags(person.tag).map(normalizeForSearch).splice(0, 32);
2022-09-17 18:27:08 +00:00
const bday = person['vcard:bday']?.match(/^\d{4}-\d{2}-\d{2}/);
const url = getOneApHrefNullable(person.url);
if (url && !checkHttps(url)) {
throw new Error('unexpected schema of person url: ' + url);
}
2022-09-17 18:27:08 +00:00
const updates = {
lastFetchedAt: new Date(),
inbox: person.inbox,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
sharedInbox: person.sharedInbox ?? person.endpoints?.sharedInbox,
2022-09-17 18:27:08 +00:00
followersUri: person.followers ? getApId(person.followers) : undefined,
featured: person.featured,
emojis: emojiNames,
name: truncate(person.name, nameLength),
tags,
approved: true,
isBot: getApType(object) === 'Service' || getApType(object) === 'Application',
2022-09-17 18:27:08 +00:00
isCat: (person as any).isCat === true,
speakAsCat: (person as any).speakAsCat != null ? (person as any).speakAsCat === true : (person as any).isCat === true,
noindex: (person as any).noindex ?? false,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
isLocked: person.manuallyApprovesFollowers,
movedToUri: person.movedTo ?? null,
alsoKnownAs: person.alsoKnownAs ?? null,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
isExplorable: person.discoverable,
...(await this.resolveAvatarAndBanner(exist, person.icon, person.image, person.backgroundUrl).catch(() => ({}))),
} as Partial<MiRemoteUser> & Pick<MiRemoteUser, 'isBot' | 'isCat' | 'speakAsCat' | 'isLocked' | 'movedToUri' | 'alsoKnownAs' | 'isExplorable'>;
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
const moving = ((): boolean => {
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
// 移行先がない→ある
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
if (
exist.movedToUri === null &&
updates.movedToUri
) return true;
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
// 移行先がある→別のもの
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
if (
exist.movedToUri !== null &&
updates.movedToUri !== null &&
exist.movedToUri !== updates.movedToUri
) return true;
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
// 移行先がある→ない、ない→ないは無視
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
return false;
})();
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
if (moving) updates.movedAt = new Date();
2022-09-17 18:27:08 +00:00
// Update user
await this.usersRepository.update(exist.id, updates);
if (person.publicKey) {
await this.userPublickeysRepository.update({ userId: exist.id }, {
keyId: person.publicKey.id,
keyPem: person.publicKey.publicKeyPem,
});
}
let _description: string | null = null;
if (person._misskey_summary) {
_description = truncate(person._misskey_summary, summaryLength);
} else if (person.summary) {
_description = this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag);
}
2022-09-17 18:27:08 +00:00
await this.userProfilesRepository.update({ userId: exist.id }, {
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
url,
2022-09-17 18:27:08 +00:00
fields,
description: _description,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
birthday: bday?.[0] ?? null,
2022-09-17 18:27:08 +00:00
location: person['vcard:Address'] ?? null,
listenbrainz: person.listenbrainz ?? null,
2022-09-17 18:27:08 +00:00
});
this.globalEventService.publishInternalEvent('remoteUserUpdated', { id: exist.id });
// ハッシュタグ更新
this.hashtagService.updateUsertags(exist, tags);
// 該当ユーザーが既にフォロワーになっていた場合はFollowingもアップデートする
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
await this.followingsRepository.update(
{ followerId: exist.id },
{ followerSharedInbox: person.sharedInbox ?? person.endpoints?.sharedInbox },
);
2022-09-17 18:27:08 +00:00
await this.updateFeatured(exist.id, resolver).catch(err => this.logger.error(err));
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
const updated = { ...exist, ...updates };
this.cacheService.uriPersonCache.set(uri, updated);
// 移行処理を行う
if (updated.movedAt && (
// 初めて移行する場合はmovedAtがnullなので移行処理を許可
exist.movedAt == null ||
// 以前のmovingから14日以上経過した場合のみ移行処理を許可
// Mastodonのクールダウン期間は30日だが若干緩めに設定しておく
exist.movedAt.getTime() + 1000 * 60 * 60 * 24 * 14 < updated.movedAt.getTime()
)) {
this.logger.info(`Start to process Move of @${updated.username}@${updated.host} (${uri})`);
return this.processRemoteMove(updated, movePreventUris)
.then(result => {
this.logger.info(`Processing Move Finished [${result}] @${updated.username}@${updated.host} (${uri})`);
return result;
})
.catch(e => {
this.logger.info(`Processing Move Failed @${updated.username}@${updated.host} (${uri})`, { stack: e });
});
}
return 'skip';
2022-09-17 18:27:08 +00:00
}
/**
* Personを解決します
*
* Misskeyに対象のPersonが登録されていればそれを返し
* Misskeyに登録しそれを返します
*/
@bindThis
public async resolvePerson(uri: string, resolver?: Resolver): Promise<MiLocalUser | MiRemoteUser> {
2022-09-17 18:27:08 +00:00
//#region このサーバーに既に登録されていたらそれを返す
const exist = await this.fetchPerson(uri);
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
if (exist) return exist;
2022-09-17 18:27:08 +00:00
//#endregion
// リモートサーバーからフェッチしてきて登録
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
// eslint-disable-next-line no-param-reassign
2022-09-17 18:27:08 +00:00
if (resolver == null) resolver = this.apResolverService.createResolver();
2023-02-13 06:28:07 +00:00
return await this.createPerson(uri, resolver);
2022-09-17 18:27:08 +00:00
}
@bindThis
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
// TODO: `attachments`が`IObject`だった場合、返り値が`[]`になるようだが構わないのか?
public analyzeAttachments(attachments: IObject | IObject[] | undefined): Field[] {
const fields: Field[] = [];
2022-09-17 18:27:08 +00:00
if (Array.isArray(attachments)) {
for (const attachment of attachments.filter(isPropertyValue)) {
fields.push({
name: attachment.name,
value: this.mfmService.fromHtml(attachment.value),
});
2022-09-17 18:27:08 +00:00
}
}
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
return fields;
2022-09-17 18:27:08 +00:00
}
@bindThis
public async updateFeatured(userId: MiUser['id'], resolver?: Resolver): Promise<void> {
2022-09-17 18:27:08 +00:00
const user = await this.usersRepository.findOneByOrFail({ id: userId });
if (!this.userEntityService.isRemoteUser(user)) return;
if (!user.featured) return;
2022-09-18 18:11:50 +00:00
this.logger.info(`Updating the featured: ${user.uri}`);
2022-09-17 18:27:08 +00:00
2023-01-25 02:23:57 +00:00
const _resolver = resolver ?? this.apResolverService.createResolver();
2022-09-17 18:27:08 +00:00
// Resolve to (Ordered)Collection Object
2023-01-25 02:23:57 +00:00
const collection = await _resolver.resolveCollection(user.featured);
2022-09-17 18:27:08 +00:00
if (!isCollectionOrOrderedCollection(collection)) throw new Error('Object is not Collection or OrderedCollection');
// Resolve to Object(may be Note) arrays
const unresolvedItems = isCollection(collection) ? collection.items : collection.orderedItems;
2023-01-25 02:23:57 +00:00
const items = await Promise.all(toArray(unresolvedItems).map(x => _resolver.resolve(x)));
2022-09-17 18:27:08 +00:00
// Resolve and regist Notes
const limit = promiseLimit<MiNote | null>(2);
2022-09-17 18:27:08 +00:00
const featuredNotes = await Promise.all(items
.filter(item => getApType(item) === 'Note') // TODO: Noteでなくてもいいかも
.slice(0, 5)
.map(item => limit(() => this.apNoteService.resolveNote(item, {
resolver: _resolver,
sentFrom: new URL(user.uri),
}))));
2022-09-17 18:27:08 +00:00
await this.db.transaction(async transactionalEntityManager => {
await transactionalEntityManager.delete(MiUserNotePining, { userId: user.id });
2022-09-17 18:27:08 +00:00
// とりあえずidを別の時間で生成して順番を維持
let td = 0;
for (const note of featuredNotes.filter(isNotNull)) {
2022-09-17 18:27:08 +00:00
td -= 1000;
transactionalEntityManager.insert(MiUserNotePining, {
id: this.idService.gen(Date.now() + td),
2022-09-17 18:27:08 +00:00
userId: user.id,
refactor(backend): `core/activitypub/models` (#11067) * cleanup(`ApImageService.ts`) * refactor(`ApImageService.ts`) * cleanup(`check-https.ts`) * cleanup(`ApMentionService.ts`) * refactor(`ApMentionService.ts`) * cleanup(`ApNoteService.ts`): unneeded `eslint-disable-next-line` * cleanup(`ApNoteService.ts`) * WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる * refactor(`ApNoteService.ts`): function return type * cleanup(`ApNoteService.ts`): deadcode * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * refactor(`ApNoteService.ts`): non-null assertion これまでは`getApId()`の方でエラーがスローされていた。 * cleanup(`ApNoteService.ts`): unneeded await * refactor(`ApNoteService.ts`): note.attachment - `toArray()`を使うように - よくわからない条件式を整理 - `as`をなくすために`promiseLimit()`でジェネリクスを使うように * cleanup(`ApNoteService.ts`) * refactor(`ApNoteService.ts`): よりよい型定義 `res`が`null`でないことは確認されているようだったので`null`とのunionはなくした * refactor(`ApNoteService.ts`): 不要な条件を削除 * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): 重要でない`as`を削除 * refactor(`ApNoteService.ts`): `eslint-disable-next-line` * cleanup(`ApNoteService.ts`): deadcode * cleanup(`ApNoteService.ts`): unneeded non-null assertion * refactor(`ApNoteService.ts`): 不要な条件を削除 * WIP(`ApNoteService.ts`): `as`をなくす エラーメッセージを考える * cleanup(`ApNoteService.ts`): 不要な`as`を削除 * cleanup(`ApPersonService.ts`): `no-unused-vars` * cleanup(`ApPersonService.ts`): deadcode * refactor(`ApPersonService.ts`): function return type * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`): deadcode * WIP(`ApPersonService.ts`): `as`を調整 `null`でないか確認する処理が続いていたので型アサーションは`null`とのunionにした。 より本質的な改善の余地があるように感じるのでひとまずWIPとしてコミット。 * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * WIP(`ApPersonService.ts`): `as any`をなくした エラーをスローするようにせざるを得なかったのでエラーメッセージを考える必要がある。 * WIP(`ApNoteService.ts`): non-null assertion non-nullアサーションを減らすために事前に存在確認をするようにした。 エラーをスローするようにしたのでメッセージを考えなければならない。 * refactor(`ApNoteService.ts`): non-null assertion -> optional chaining * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): `eslint-disable-next-line` * refactor(`ApPersonService.ts`): function return type * refactor(`ApPersonService.ts`): type guardによるnon-null assertionの削除 * WIP(`ApPersonService.ts`): `analyzeAttachments` - Field型を事前に定義しておくように - `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - `toArray()`を通すべきでは? * Revert "WIP(`ApImageService.ts`): `image.url`を`getApHrefNullable()`に通すかどうか悩んでいる" This reverts commit aeefb843a8a688f8a356794e8981c58f8a2733af. * cleanup(`ApImageService.ts`): `import` * refactor(`ApImageService.ts`): 冗長だった部分を短く * cleanup(`ApMentionService.ts`): `import` * refactor(`ApImageService.ts`): `JSON.stringify()`でのindentationを追加 * cleanup(`ApNoteService.ts`): `import` * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`) * cleanup(`ApNoteService.ts`): `any`に対するnon-null assertion * refactor(`ApNoteService.ts`): 添付ファイル * cleanup(`ApPersonService.ts`): `import` * refactor(`ApPersonService.ts`): より実情に即した`as`に * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 冗長だった部分を修正 * cleanup(`ApPersonService.ts`): deadcode * cleanup(`ApPersonService.ts`) * cleanup(`ApQuestionService.ts`): `import` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * refactor(`ApQuestionService.ts`): `eslint-disable-next-line` * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`): non-null assertionを消した * cleanup(`ApQuestionService.ts`) * WIP(`ApQuestionService.ts`): non-null assertionを消す エラーメッセージを考える必要がある。 * refactor(`ApQuestionService.ts`): `any`を消す * refactor(`ApQuestionService.ts`): function return type * WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 エラーメッセージを考える必要がある。 * cleanup(`ApPersonService.ts`): 不必要な三項演算子を削除 * cleanup(`ApPersonService.ts`): 不要な`as` * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 可読性の低い三項演算子を削除 元の実装が悪いと判断し`null`かどうかの確認をより厳密に行うようにした。 * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値を`void`に統一 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一 * refactor(`ApNoteService.ts`) * refactor(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * cleanup(`ApPersonService.ts`) * refactor(`ApPersonService.ts`): 返り値の`void`統一と条件式の調整 この返り値を参照しているコードは見当たらなかった。 また、普通に意味がない値であるように見受けられた。 * cleanup(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`ApQuestionService.ts`) * refactor(`tag.ts`): function return type * fixup! enhance: account migration (#10592) * fixup! WIP(`ApPersonService.ts`): 可読性の低い三項演算子を削除しつつnon-null assertionを回避 * fixup! cleanup(`ApPersonService.ts`): 不要な`as` * refactor: エラーメッセージを見繕った * Revert "cleanup(`ApImageService.ts`): `import`" This reverts commit 1454d04c377eaf46013b0f3c3ce664a4034fd53a. * Revert "cleanup(`ApMentionService.ts`): `import`" This reverts commit 244f6720c134a3434e33c1caf6e3e0c2c87b58f5. * Revert "cleanup(`ApNoteService.ts`): `import`" This reverts commit d8f0d769733c4cb0629821b04e557a0ae6f5ff5b. * Revert "cleanup(`ApPersonService.ts`): `import`" This reverts commit 5190ef954caf376da46c707f52e02208d53caafd. # Conflicts: # packages/backend/src/core/activitypub/models/ApPersonService.ts * Revert "cleanup(`ApQuestionService.ts`): `import`" This reverts commit 778585e2882477fec5f11fabf398b4b89cf26da2. * processRemoteMoveはそのままにしてほしい * Revert "fixup! refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit 083cd678abcd64325b9628895366c03b893e42ca. * Revert "refactor(`ApPersonService.ts`): 返り値を`void`に統一" This reverts commit bfa0fcd6f01a6e519ea0c68017358f9980d2ed96. --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-07-07 23:57:13 +00:00
noteId: note.id,
2022-09-17 18:27:08 +00:00
});
}
});
}
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
/**
*
* @param src updatePerson後である必要があるupdatePersonで呼ばれる前提
* @param movePreventUris URIにsrc.movedToUriが含まれる場合
*/
@bindThis
private async processRemoteMove(src: MiRemoteUser, movePreventUris: string[] = []): Promise<string> {
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
if (!src.movedToUri) return 'skip: no movedToUri';
if (src.uri === src.movedToUri) return 'skip: movedTo itself (src)'; //
if (movePreventUris.length > 10) return 'skip: too many moves';
// まずサーバー内で検索して様子見
let dst = await this.fetchPerson(src.movedToUri);
if (dst && this.userEntityService.isLocalUser(dst)) {
// targetがローカルユーザーだった場合データベースから引っ張ってくる
dst = await this.usersRepository.findOneByOrFail({ uri: src.movedToUri }) as MiLocalUser;
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
} else if (dst) {
if (movePreventUris.includes(src.movedToUri)) return 'skip: circular move';
// targetを見つけたことがあるならtargetをupdatePersonする
await this.updatePerson(src.movedToUri, undefined, undefined, [...movePreventUris, src.uri]);
dst = await this.fetchPerson(src.movedToUri) ?? dst;
} else {
if (src.movedToUri.startsWith(`${this.config.url}/`)) {
// ローカルユーザーっぽいのにfetchPersonで見つからないということはmovedToUriが間違っている
return 'failed: movedTo is local but not found';
}
// targetが知らない人だったらresolvePerson
// (uriが存在しなかったり応答がなかったりする場合resolvePersonはthrow Errorする)
dst = await this.resolvePerson(src.movedToUri);
}
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
if (dst.movedToUri === dst.uri) return 'skip: movedTo itself (dst)'; //
if (src.movedToUri !== dst.uri) return 'skip: missmatch uri'; //
if (dst.movedToUri === src.uri) return 'skip: dst.movedToUri === src.uri';
if (!dst.alsoKnownAs || dst.alsoKnownAs.length === 0) {
return 'skip: dst.alsoKnownAs is empty';
}
if (!dst.alsoKnownAs.includes(src.uri)) {
enhance: account migration (#10592) * copy block and mute then create follow and unfollow jobs * copy block and mute and update lists when detecting an account has moved * no need to care promise orders * refactor updating actor and target * automatically accept if a locked account had accepted an old account * fix exception format * prevent the old account from calling some endpoints * do not unfollow when moving * adjust following and follower counts * check movedToUri when receiving a follow request * skip if no need to adjust * Revert "disable account migration" This reverts commit 2321214c98591bcfe1385c1ab5bf0ff7b471ae1d. * fix translation specifier * fix checking alsoKnownAs and uri * fix updating account * fix refollowing locked account * decrease followersCount if followed by the old account * adjust following and followers counts when unfollowing * fix copying mutings * prohibit moved account from moving again * fix move service * allow app creation after moving * fix lint * remove unnecessary field * fix cache update * add e2e test * add e2e test of accepting the new account automatically * force follow if any error happens * remove unnecessary joins * use Array.map instead of for const of * ユーザーリストの移行は追加のみを行う * nanka iroiro * fix misskey-js? * :v: * 移行を行ったアカウントからのフォローリクエストの自動許可を調整 * newUriを外に出す * newUriを外に出す2 * clean up * fix newUri * prevent moving if the destination account has already moved * set alsoKnownAs via /i/update * fix database initialization * add return type * prohibit updating alsoKnownAs after moving * skip to add to alsoKnownAs if toUrl is known * skip adding to the list if it already has * use Acct.parse instead * rename error code * :art: * 制限を5から10に緩和 * movedTo(Uri), alsoKnownAsはユーザーidを返すように * test api res * fix * 元アカウントはミュートし続ける * :art: * unfollow * fix * getUserUriをUserEntityServiceに * ? * job! * :art: * instance => server * accountMovedShort, forbiddenBecauseYouAreMigrated * accountMovedShort * fix test * import, pin禁止 * 実績を凍結する * clean up * :v: * change message * ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに * Revert "ブロック, フォロー, ミュート, リストのインポートファイルの制限を32MiBに" This reverts commit 3bd7be35d8aa455cb01ae58f8172a71a50485db1. * validateAlsoKnownAs * 移行後2時間以内はインポート可能なファイルサイズを拡大 * clean up * どうせactorをupdatePersonで更新するならupdatePersonしか移行処理を発行しないことにする * handle error? * リモートからの移行処理の条件を是正 * log, port * fix * fix * enhance(dev): non-production環境でhttpサーバー間でもユーザー、ノートの連合が可能なように * refactor (use checkHttps) * MISSKEY_WEBFINGER_USE_HTTP * Environment Variable readme * NEVER USE IN PRODUCTION * fix punyHost * fix indent * fix * experimental --------- Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2023-04-29 15:09:29 +00:00
return 'skip: alsoKnownAs does not include from.uri';
}
await this.accountMoveService.postMoveProcess(src, dst);
return 'ok';
}
2022-09-17 18:27:08 +00:00
}