Sharkey/packages/backend/test/e2e/mute.ts

321 lines
14 KiB
TypeScript
Raw Permalink Normal View History

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import { api, post, react, signup, waitFire } from '../utils.js';
import type * as misskey from 'misskey-js';
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
describe('Mute', () => {
// alice mutes carol
let alice: misskey.entities.SignupResponse;
let bob: misskey.entities.SignupResponse;
let carol: misskey.entities.SignupResponse;
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
2022-09-17 11:27:08 -07:00
beforeAll(async () => {
Add GitHub Actions (#5522) * add .github/workflows/nodejs.yml * fix * GitHub Actions: Node.js 8.xはサポートしない * add .github/workflows/docker.yml * Dockerビルドをキャッシュするように * Run test in github actions * 同リポジトリ内からのプルリクだと無駄に二回走るのを抑制 * 6925c00のdocker.ymlへの適応忘れ * fix .circleci/misskey/test.yml * test実行時にDBとかredisとか動かすように * fix * fix tests (#5544) * fix test * fix compile errors * PATH引き継ぎでchild_process.spawn時のENOENTを修正 * サーバー起動処理を共通化 * fix coding style * fd=4をipcに使うように * fix port * fix * fix ws port * #4033 にテストケースを追従 * fix? * fix?? * fix * fix * fix * maybe fix * fix * node 10.xサポートしてなかった * 11.10じゃないとだめだった * fix * remove chart test * fix * chart test復活 * fix * 一回一回コネクションを閉じる * Revert "一回一回コネクションを閉じる" This reverts commit 56e35cf4f83070744c8dd852f1a7075011d88828. * 一回一回sync→dropしてるのをやめてみる * fix * fix * … * キャッシュを切ってみる * add ts to require target * omg fix * Revert "キャッシュを切ってみる" This reverts commit 88161c59d2ea769ddf87143ba4fd4660a06afdf2. * done呼び忘れ * 実際の文字数リミットと違ってたので対応 * テストケースがバグってたので修正 * Revert "一回一回sync→dropしてるのをやめてみる" This reverts commit a9e543ba2eef790ac7a14ae8799b898765748e35. * fix * fix * fix * fix? * fix * chartのconnectionを分離する * fix * fix * fix tsconfig? * Revert "fix tsconfig?" This reverts commit ba9269eaf65507ff97ec1dd2e27260fb2cf0510b. * fix * TS_NODE_FILES を scripts の方で指定 * Windowsェ * Circle CIの実行条件をmasterへのpushのみに Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2020-01-08 21:35:04 -08:00
alice = await signup({ username: 'alice' });
bob = await signup({ username: 'bob' });
carol = await signup({ username: 'carol' });
// Mute: alice ==> carol
await api('mute/create', {
userId: carol.id,
}, alice);
}, 1000 * 60 * 2);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
2023-02-02 01:18:25 -08:00
test('ミュート作成', async () => {
const res = await api('mute/create', {
userId: bob.id,
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
}, alice);
assert.strictEqual(res.status, 204);
// 単体でも走らせられるように副作用消す
await api('mute/delete', {
userId: bob.id,
}, alice);
2022-09-17 11:27:08 -07:00
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
2023-02-02 01:18:25 -08:00
test('「自分宛ての投稿」にミュートしているユーザーの投稿が含まれない', async () => {
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
const bobNote = await post(bob, { text: '@alice hi' });
const carolNote = await post(carol, { text: '@alice hi' });
const res = await api('notes/mentions', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
2022-09-17 11:27:08 -07:00
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
2023-02-02 01:18:25 -08:00
test('ミュートしているユーザーからメンションされても、hasUnreadMentions が true にならない', async () => {
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
// 状態リセット
await api('i/read-all-unread-notes', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
await post(carol, { text: '@alice hi' });
const res = await api('i', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
assert.strictEqual(res.status, 200);
assert.strictEqual(res.body.hasUnreadMentions, false);
2022-09-17 11:27:08 -07:00
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
2023-02-02 01:18:25 -08:00
test('ミュートしているユーザーからメンションされても、ストリームに unreadMention イベントが流れてこない', async () => {
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
// 状態リセット
await api('i/read-all-unread-notes', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
const fired = await waitFire(alice, 'main', () => post(carol, { text: '@alice hi' }), msg => msg.type === 'unreadMention');
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
assert.strictEqual(fired, false);
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
2023-02-02 01:18:25 -08:00
test('ミュートしているユーザーからメンションされても、ストリームに unreadNotification イベントが流れてこない', async () => {
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
// 状態リセット
await api('i/read-all-unread-notes', {}, alice);
await api('notifications/mark-all-as-read', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
const fired = await waitFire(alice, 'main', () => post(carol, { text: '@alice hi' }), msg => msg.type === 'unreadNotification');
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
assert.strictEqual(fired, false);
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
describe('Timeline', () => {
2023-02-02 01:18:25 -08:00
test('タイムラインにミュートしているユーザーの投稿が含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
const bobNote = await post(bob, { text: 'hi' });
const carolNote = await post(carol, { text: 'hi' });
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
const res = await api('notes/local-timeline', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
2022-09-17 11:27:08 -07:00
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
2023-02-02 01:18:25 -08:00
test('タイムラインにミュートしているユーザーの投稿のRenoteが含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
const carolNote = await post(carol, { text: 'hi' });
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
const bobNote = await post(bob, {
2022-05-21 06:21:41 -07:00
renoteId: carolNote.id,
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
});
const res = await api('notes/local-timeline', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
2022-09-17 11:27:08 -07:00
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
});
describe('Notification', () => {
2023-02-02 01:18:25 -08:00
test('通知にミュートしているユーザーの通知が含まれない(リアクション)', async () => {
const aliceNote = await post(alice, { text: 'hi' });
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
await react(bob, aliceNote, 'like');
await react(carol, aliceNote, 'like');
const res = await api('i/notifications', {}, alice);
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
2022-09-17 11:27:08 -07:00
});
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
test('通知にミュートしているユーザーからのリプライが含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
await post(bob, { text: '@alice hi', replyId: aliceNote.id });
await post(carol, { text: '@alice hi', replyId: aliceNote.id });
const res = await api('i/notifications', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのリプライが含まれない', async () => {
await post(alice, { text: 'hi' });
await post(bob, { text: '@alice hi' });
await post(carol, { text: '@alice hi' });
const res = await api('i/notifications', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからの引用リノートが含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
await post(bob, { text: 'hi', renoteId: aliceNote.id });
await post(carol, { text: 'hi', renoteId: aliceNote.id });
const res = await api('i/notifications', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのリノートが含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
await post(bob, { renoteId: aliceNote.id });
await post(carol, { renoteId: aliceNote.id });
const res = await api('i/notifications', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのフォロー通知が含まれない', async () => {
await api('following/create', { userId: alice.id }, bob);
await api('following/create', { userId: alice.id }, carol);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
const res = await api('i/notifications', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
await api('following/delete', { userId: alice.id }, bob);
await api('following/delete', { userId: alice.id }, carol);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのフォローリクエストが含まれない', async () => {
await api('i/update', { isLocked: true }, alice);
await api('following/create', { userId: alice.id }, bob);
await api('following/create', { userId: alice.id }, carol);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
const res = await api('i/notifications', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
await api('following/delete', { userId: alice.id }, bob);
await api('following/delete', { userId: alice.id }, carol);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
});
describe('Notification (Grouped)', () => {
test('通知にミュートしているユーザーの通知が含まれない(リアクション)', async () => {
const aliceNote = await post(alice, { text: 'hi' });
await react(bob, aliceNote, 'like');
await react(carol, aliceNote, 'like');
const res = await api('i/notifications-grouped', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのリプライが含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
await post(bob, { text: '@alice hi', replyId: aliceNote.id });
await post(carol, { text: '@alice hi', replyId: aliceNote.id });
const res = await api('i/notifications-grouped', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのリプライが含まれない', async () => {
await post(alice, { text: 'hi' });
await post(bob, { text: '@alice hi' });
await post(carol, { text: '@alice hi' });
const res = await api('i/notifications-grouped', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからの引用リノートが含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
await post(bob, { text: 'hi', renoteId: aliceNote.id });
await post(carol, { text: 'hi', renoteId: aliceNote.id });
const res = await api('i/notifications-grouped', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのリノートが含まれない', async () => {
const aliceNote = await post(alice, { text: 'hi' });
await post(bob, { renoteId: aliceNote.id });
await post(carol, { renoteId: aliceNote.id });
const res = await api('i/notifications-grouped', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのフォロー通知が含まれない', async () => {
await api('following/create', { userId: alice.id }, bob);
await api('following/create', { userId: alice.id }, carol);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
const res = await api('i/notifications-grouped', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
await api('following/delete', { userId: alice.id }, bob);
await api('following/delete', { userId: alice.id }, carol);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
test('通知にミュートしているユーザーからのフォローリクエストが含まれない', async () => {
await api('i/update', { isLocked: true }, alice);
await api('following/create', { userId: alice.id }, bob);
await api('following/create', { userId: alice.id }, carol);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
const res = await api('i/notifications-grouped', {}, alice);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
assert.strictEqual(res.status, 200);
assert.strictEqual(Array.isArray(res.body), true);
test(backend): kill many `any` in backend test (partial) (#14054) * kill any on utils:api * kill any on timeline test * use optional chain to kill TS2532 on timeline test 変更前: 該当ノートが見つからなければundefinedに対するプロパティアクセスとしてテストがクラッシュ 変更後: 該当ノートが見つからなければoptional chainがundefinedとして評価されるが、strictEqualの右辺がnon-nullableなためアサーションに失敗しテストがクラッシュ * kill `as any` for ApMfmService * kill argument any for api-visibility * kill argument any across a few tests * do not return value that has yielded from `await`-ing `Promise<void>` * force cast * runtime non-null assertion to coerce * rewrite `assert.notEqual(expr, null)` to `assert.ok(expr)` こうすることでassertion type扱いになり、non-nullableになる * change return type of `failedApiCall` to `void` 戻り値がどこにも使われていない * split bindings for exports.ts 型が合わなくて文句を言ってくるので適切に分割 * runtime non-null assertion * runtime non-null assertion * 何故かうまく行かないので、とりあえずXORしてみる * Revert "何故かうまく行かないので、とりあえずXORしてみる" This reverts commit 48cf32c930924840d0892af92d71b9437acb5844. * castAsErrorで安全ではないキャストを隠蔽 * 型アサーションの追加 * 型アサーションの追加 * 型アサーションの追加 * voidで値を返さない * castAsError * assert.ok => kill nullability * もはや明示的な型の指定は必要ない * castAsError * castAsError * 型アサーションの追加 * nullableを一旦抑止 * 変数を分離して型エラーを排除 * 不要なプロパティを削除する処理を隠蔽してanyを排除 * Repository type * simple type * assert.ok => kill nullability * revert `as any` drop reverts fe95c05b3f53266108128680d9358a3796844232 partialy * test: fix invalid assertion partially revert b99b7b5392d9d20c81dfee1346ba8b33ff9e1fbb * test: 52d8a54fc72b886fecb30a736b3ccf5057ea2a0c により型が合うようになった部分の`as any`を除去 * format * test: apply https://github.com/misskey-dev/misskey/pull/14054#discussion_r1672369526 (part 1) * test: use non-null assertion to suppress too many error * Update packages/backend/test/utils.ts Co-authored-by: anatawa12 <anatawa12@icloud.com> --------- Co-authored-by: anatawa12 <anatawa12@icloud.com>
2024-07-13 17:33:16 -07:00
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
enhance(backend): 通知がミュート・凍結を考慮するようにする (#13412) * Never return broken notifications #409 Since notifications are stored in Redis, we can't expect relational integrity: deleting a user will *not* delete notifications that mention it. But if we return notifications with missing bits (a `follow` without a `user`, for example), the frontend will get very confused and throw an exception while trying to render them. This change makes sure we never expose those broken notifications. For uniformity, I've applied the same logic to notes and roles mentioned in notifications, even if nobody reported breakage in those cases. Tested by creating a few types of notifications with a `notifierId`, then deleting their user. (cherry picked from commit 421f8d49e5d7a8dc3a798cc54716c767df8be3cb) * Update Changelog * Update CHANGELOG.md * enhance: 通知がミュートを考慮するようにする * enhance: 通知が凍結も考慮するようにする * fix: notifierIdがない通知が消えてしまう問題 * Add tests (通知がミュートを考慮しているかどうか) * fix: notifierIdがない通知が消えてしまう問題 (grouped) * Remove unused import * Fix: typo * Revert "enhance: 通知が凍結も考慮するようにする" This reverts commit b1e57e571dfd9a7d8b2430294473c2053cc3ea33. * Revert API handling * Remove unused imports * enhance: Check if notifierId is valid in NotificationEntityService * 通知作成時にpackしてnullになったらあとの処理をやめる * Remove duplication of valid notifier check * add filter notification is not null * Revert "Remove duplication of valid notifier check" This reverts commit 239a6952f717add53d52c3e701e7362eb1987645. * Improve performance * Fix packGrouped * Refactor: 判定部分を共通化 * Fix condition * use isNotNull * Update CHANGELOG.md * filterの改善 * Refactor: DONT REPEAT YOURSELF Note: GroupedNotificationはNotificationの拡張なのでその例外だけ書けば基本的に共通の処理になり複雑な個別の処理は増えにくいと思われる * Add groupedNotificationTypes * Update misskey-js typedef * Refactor: less sql calls * refactor * clean up * filter notes to mark as read * packed noteがmapなのでそちらを使う * if (notesToRead.size > 0) * if (notes.length === 0) return; * fix * Revert "if (notes.length === 0) return;" This reverts commit 22e2324f9633bddba50769ef838bc5ddb4564c88. * :art: * console.error * err * remove try-catch * 不要なジェネリクスを除去 * Revert (既読処理をpack内で行うものを元に戻す) * Clean * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/entities/NotificationEntityService.ts * Update packages/backend/src/core/NotificationService.ts * Clean --------- Co-authored-by: dakkar <dakkar@thenautilus.net> Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com> Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> Co-authored-by: tamaina <tamaina@hotmail.co.jp> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-02-28 04:26:26 -08:00
});
Use PostgreSQL instead of MongoDB (#4572) * wip * Update note.ts * Update timeline.ts * Update core.ts * wip * Update generate-visibility-query.ts * wip * wip * wip * wip * wip * Update global-timeline.ts * wip * wip * wip * Update vote.ts * wip * wip * Update create.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update files.ts * wip * wip * Update CONTRIBUTING.md * wip * wip * wip * wip * wip * wip * wip * wip * Update read-notification.ts * wip * wip * wip * wip * wip * wip * wip * Update cancel.ts * wip * wip * wip * Update show.ts * wip * wip * Update gen-id.ts * Update create.ts * Update id.ts * wip * wip * wip * wip * wip * wip * wip * Docker: Update files about Docker (#4599) * Docker: Use cache if files used by `yarn install` was not updated This patch reduces the number of times to installing node_modules. For example, `yarn install` step will be skipped when only ".config/default.yml" is updated. * Docker: Migrate MongoDB to Postgresql Misskey uses Postgresql as a database instead of Mongodb since version 11. * Docker: Uncomment about data persistence This patch will save a lot of databases. * wip * wip * wip * Update activitypub.ts * wip * wip * wip * Update logs.ts * wip * Update drive-file.ts * Update register.ts * wip * wip * Update mentions.ts * wip * wip * wip * Update recommendation.ts * wip * Update index.ts * wip * Update recommendation.ts * Doc: Update docker.ja.md and docker.en.md (#1) (#4608) Update how to set up misskey. * wip * :v: * wip * Update note.ts * Update postgre.ts * wip * wip * wip * wip * Update add-file.ts * wip * wip * wip * Clean up * Update logs.ts * wip * :pizza: * wip * Ad notes * wip * Update api-visibility.ts * Update note.ts * Update add-file.ts * tests * tests * Update postgre.ts * Update utils.ts * wip * wip * Refactor * wip * Refactor * wip * wip * Update show-users.ts * Update update-instance.ts * wip * Update feed.ts * Update outbox.ts * Update outbox.ts * Update user.ts * wip * Update list.ts * Update update-hashtag.ts * wip * Update update-hashtag.ts * Refactor * Update update.ts * wip * wip * :v: * clean up * docs * Update push.ts * wip * Update api.ts * wip * :v: * Update make-pagination-query.ts * :v: * Delete hashtags.ts * Update instances.ts * Update instances.ts * Update create.ts * Update search.ts * Update reversi-game.ts * Update signup.ts * Update user.ts * id * Update example.yml * :art: * objectid * fix * reversi * reversi * Fix bug of chart engine * Add test of chart engine * Improve test * Better testing * Improve chart engine * Refactor * Add test of chart engine * Refactor * Add chart test * Fix bug * コミットし忘れ * Refactoring * :v: * Add tests * Add test * Extarct note tests * Refactor * 存在しないユーザーにメンションできなくなっていた問題を修正 * Fix bug * Update update-meta.ts * Fix bug * Update mention.vue * Fix bug * Update meta.ts * Update CONTRIBUTING.md * Fix bug * Fix bug * Fix bug * Clean up * Clean up * Update notification.ts * Clean up * Add mute tests * Add test * Refactor * Add test * Fix test * Refactor * Refactor * Add tests * Update utils.ts * Update utils.ts * Fix test * Update package.json * Update update.ts * Update manifest.ts * Fix bug * Fix bug * Add test * :art: * Update endpoint permissions * Updaye permisison * Update person.ts #4299 * データベースと同期しないように * Fix bug * Fix bug * Update reversi-game.ts * Use a feature of Node v11.7.0 to extract a public key (#4644) * wip * wip * :v: * Refactoring #1540 * test * test * test * test * test * test * test * Fix bug * Fix test * :sushi: * wip * #4471 * Add test for #4335 * Refactor * Fix test * Add tests * :clock4: * Fix bug * Add test * Add test * rename * Fix bug
2019-04-07 05:50:36 -07:00
});
});