Merge branch 'develop' into note-edit
This commit is contained in:
commit
8fd0d696ab
|
@ -11,6 +11,7 @@
|
||||||
### Server
|
### Server
|
||||||
- チャート生成時にinstance.suspentionStateに置き換えられたinstance.isSuspendedが参照されてしまう問題を修正
|
- チャート生成時にinstance.suspentionStateに置き換えられたinstance.isSuspendedが参照されてしまう問題を修正
|
||||||
- Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949)
|
- Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949)
|
||||||
|
- Fix: アンテナ・クリップ・リスト・ウェブフックがロールポリシーの上限より一つ多く作れてしまうのを修正 (#14036)
|
||||||
|
|
||||||
## 2024.5.0
|
## 2024.5.0
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class ClipService {
|
||||||
const currentCount = await this.clipsRepository.countBy({
|
const currentCount = await this.clipsRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).clipLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).clipLimit) {
|
||||||
throw new ClipService.TooManyClipsError();
|
throw new ClipService.TooManyClipsError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export class ClipService {
|
||||||
const currentCount = await this.clipNotesRepository.countBy({
|
const currentCount = await this.clipNotesRepository.countBy({
|
||||||
clipId: clip.id,
|
clipId: clip.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).noteEachClipsLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).noteEachClipsLimit) {
|
||||||
throw new ClipService.TooManyClipNotesError();
|
throw new ClipService.TooManyClipNotesError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ export class UserListService implements OnApplicationShutdown, OnModuleInit {
|
||||||
const currentCount = await this.userListMembershipsRepository.countBy({
|
const currentCount = await this.userListMembershipsRepository.countBy({
|
||||||
userListId: list.id,
|
userListId: list.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).userEachUserListsLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).userEachUserListsLimit) {
|
||||||
throw new UserListService.TooManyUsersError();
|
throw new UserListService.TooManyUsersError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentAntennasCount = await this.antennasRepository.countBy({
|
const currentAntennasCount = await this.antennasRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentAntennasCount > (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
if (currentAntennasCount >= (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyAntennas);
|
throw new ApiError(meta.errors.tooManyAntennas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
if (file.size === 0) throw new ApiError(meta.errors.emptyFile);
|
if (file.size === 0) throw new ApiError(meta.errors.emptyFile);
|
||||||
const antennas: (_Antenna & { userListAccts: string[] | null })[] = JSON.parse(await this.downloadService.downloadTextFile(file.url));
|
const antennas: (_Antenna & { userListAccts: string[] | null })[] = JSON.parse(await this.downloadService.downloadTextFile(file.url));
|
||||||
const currentAntennasCount = await this.antennasRepository.countBy({ userId: me.id });
|
const currentAntennasCount = await this.antennasRepository.countBy({ userId: me.id });
|
||||||
if (currentAntennasCount + antennas.length > (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
if (currentAntennasCount + antennas.length >= (await this.roleService.getUserPolicies(me.id)).antennaLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyAntennas);
|
throw new ApiError(meta.errors.tooManyAntennas);
|
||||||
}
|
}
|
||||||
this.queueService.createImportAntennasJob(me, antennas);
|
this.queueService.createImportAntennasJob(me, antennas);
|
||||||
|
|
|
@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentWebhooksCount = await this.webhooksRepository.countBy({
|
const currentWebhooksCount = await this.webhooksRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentWebhooksCount > (await this.roleService.getUserPolicies(me.id)).webhookLimit) {
|
if (currentWebhooksCount >= (await this.roleService.getUserPolicies(me.id)).webhookLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyWebhooks);
|
throw new ApiError(meta.errors.tooManyWebhooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentCount = await this.userListsRepository.countBy({
|
const currentCount = await this.userListsRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyUserLists);
|
throw new ApiError(meta.errors.tooManyUserLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const currentCount = await this.userListsRepository.countBy({
|
const currentCount = await this.userListsRepository.countBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
if (currentCount > (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
if (currentCount >= (await this.roleService.getUserPolicies(me.id)).userListLimit) {
|
||||||
throw new ApiError(meta.errors.tooManyUserLists);
|
throw new ApiError(meta.errors.tooManyUserLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,7 @@ describe('アンテナ', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('が上限いっぱいまで作成できること', async () => {
|
test('が上限いっぱいまで作成できること', async () => {
|
||||||
// antennaLimit + 1まで作れるのがキモ
|
const response = await Promise.all([...Array(DEFAULT_POLICIES.antennaLimit)].map(() => successfulApiCall({
|
||||||
const response = await Promise.all([...Array(DEFAULT_POLICIES.antennaLimit + 1)].map(() => successfulApiCall({
|
|
||||||
endpoint: 'antennas/create',
|
endpoint: 'antennas/create',
|
||||||
parameters: { ...defaultParam },
|
parameters: { ...defaultParam },
|
||||||
user: alice,
|
user: alice,
|
||||||
|
|
|
@ -153,8 +153,7 @@ describe('クリップ', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('の作成はポリシーで定められた数以上はできない。', async () => {
|
test('の作成はポリシーで定められた数以上はできない。', async () => {
|
||||||
// ポリシー + 1まで作れるという所がミソ
|
const clipLimit = DEFAULT_POLICIES.clipLimit;
|
||||||
const clipLimit = DEFAULT_POLICIES.clipLimit + 1;
|
|
||||||
for (let i = 0; i < clipLimit; i++) {
|
for (let i = 0; i < clipLimit; i++) {
|
||||||
await create();
|
await create();
|
||||||
}
|
}
|
||||||
|
@ -327,7 +326,7 @@ describe('クリップ', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('の一覧(clips/list)が取得できる(上限いっぱい)', async () => {
|
test('の一覧(clips/list)が取得できる(上限いっぱい)', async () => {
|
||||||
const clipLimit = DEFAULT_POLICIES.clipLimit + 1;
|
const clipLimit = DEFAULT_POLICIES.clipLimit;
|
||||||
const clips = await createMany({}, clipLimit);
|
const clips = await createMany({}, clipLimit);
|
||||||
const res = await list({
|
const res = await list({
|
||||||
parameters: { limit: 1 }, // FIXME: 無視されて11全部返ってくる
|
parameters: { limit: 1 }, // FIXME: 無視されて11全部返ってくる
|
||||||
|
@ -705,7 +704,7 @@ describe('クリップ', () => {
|
||||||
|
|
||||||
// TODO: 17000msくらいかかる...
|
// TODO: 17000msくらいかかる...
|
||||||
test('をポリシーで定められた上限いっぱい(200)を超えて追加はできない。', async () => {
|
test('をポリシーで定められた上限いっぱい(200)を超えて追加はできない。', async () => {
|
||||||
const noteLimit = DEFAULT_POLICIES.noteEachClipsLimit + 1;
|
const noteLimit = DEFAULT_POLICIES.noteEachClipsLimit;
|
||||||
const noteList = await Promise.all([...Array(noteLimit)].map((_, i) => post(alice, {
|
const noteList = await Promise.all([...Array(noteLimit)].map((_, i) => post(alice, {
|
||||||
text: `test ${i}`,
|
text: `test ${i}`,
|
||||||
}) as unknown)) as Misskey.entities.Note[];
|
}) as unknown)) as Misskey.entities.Note[];
|
||||||
|
|
|
@ -120,7 +120,7 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr
|
||||||
res.json().then(done2, fail2);
|
res.json().then(done2, fail2);
|
||||||
}))
|
}))
|
||||||
.then(async res => {
|
.then(async res => {
|
||||||
if (res.error) {
|
if ('error' in res) {
|
||||||
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
|
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
|
||||||
// SUSPENDED
|
// SUSPENDED
|
||||||
if (forceShowDialog || $i && (token === $i.token || id === $i.id)) {
|
if (forceShowDialog || $i && (token === $i.token || id === $i.id)) {
|
||||||
|
|
|
@ -109,6 +109,15 @@ definePageMetadata(() => ({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
|
.fadeEnterActive,
|
||||||
|
.fadeLeaveActive {
|
||||||
|
transition: opacity 0.125s ease;
|
||||||
|
}
|
||||||
|
.fadeEnterFrom,
|
||||||
|
.fadeLeaveTo {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.announcement {
|
.announcement {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"esnext",
|
"esnext",
|
||||||
"dom"
|
"dom",
|
||||||
|
"dom.iterable"
|
||||||
],
|
],
|
||||||
"jsx": "preserve"
|
"jsx": "preserve"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue