Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update host #643

Merged
merged 56 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
2ff90a8
fix(backend): add detailed schema to `fetch-rss` endpoint (#13764)
zyoshoka Apr 29, 2024
2017f91
refactor(frontend): 非ログイン画面でのmeta取得を減らす (#13776)
kakkokari-gtyih May 1, 2024
8c5e564
fix type error
kakkokari-gtyih May 1, 2024
ef630df
enhance(frontend): add contact page
syuilo May 1, 2024
9f66f22
fix(frontend): 連合なしの状態の読み書きができない問題 (#13777)
taiyme May 1, 2024
d2a5bb3
Merge pull request from GHSA-2vxv-pv3m-3wvj
tesaguri May 1, 2024
9c057e6
fix(frontend): fix Storybook type errors (#13779)
zyoshoka May 1, 2024
c530a46
enhance(backend): ドライブのファイルがNSFWかどうか個別に連合されるように (#13756)
KisaragiEffective May 1, 2024
1a243d8
Merge remote-tracking branch 'misskey-dev/develop' into io
u1-liquid May 4, 2024
ea88f85
Merge pull request MisskeyIO#627 from merge-upstream
u1-liquid May 4, 2024
053e762
enhance(frontend_ais): PostForm系の設定項目を追加 (#13788)
kakkokari-gtyih May 4, 2024
eef7fcd
chore(frontend): ui tweak
syuilo May 4, 2024
2b21c19
update deps (#13624)
syuilo May 4, 2024
fc77ad9
refactor(frontend): provide linkNavigationBehavior
syuilo May 6, 2024
c639f30
Update CHANGELOG.md
syuilo May 6, 2024
f5d57c0
dev: modify release manager to set indent type
tamaina May 7, 2024
f2743a0
Merge remote-tracking branch 'misskey-dev/develop' into io
u1-liquid May 8, 2024
dd71706
chore(deps): bump pnpm/action-setup from 3 to 4 (MisskeyIO#628)
dependabot[bot] May 8, 2024
3b41cfe
Merge pull request MisskeyIO#629 from merge-upstream
u1-liquid May 8, 2024
b298897
fix(backend): 不要なUserProfileの取得を修正 (#13812)
samunohito May 10, 2024
f6af6d9
fix(backend): UserEntityService.getRelationsの取得処理を軽量化 (#13811)
samunohito May 10, 2024
12ae9a2
feat: DevContainerにpnpmをインストールする際、corepackを使うようにする (#13821)
frfs May 13, 2024
9b0fc31
Update FUNDING.yml
syuilo May 14, 2024
acfe1cb
Merge remote-tracking branch 'misskey-dev/develop' into io
u1-liquid May 16, 2024
23a12b9
Merge pull request MisskeyIO#631 from merge-upstream
u1-liquid May 16, 2024
f4fbc22
spec(frontend): kawaii モード (MisskeyIO#632)
u1-liquid May 17, 2024
def7b8c
fix(frontend): fix Chromatic test fails (#13826)
zyoshoka May 18, 2024
ba62b73
fix(storybook): fix wrong `tabler-icons` CSS path (#13828)
zyoshoka May 18, 2024
acf84a2
FTTが有効かつsinceIdのみを指定した場合に帰って来るレスポンスが逆順である問題を修正 (#13837)
anatawa12 May 19, 2024
4d0db37
fix notification limit with exclude/include types (#13836)
anatawa12 May 20, 2024
f6df940
Exclude channel notes from featured polls (#13838)
anatawa12 May 20, 2024
ed74f7b
ci: use pnpm version from packageManager field in the package.json. (…
anatawa12 May 20, 2024
5836bd8
fix: 複数idを指定する`users/show`が関係ないユーザを返すことがある問題を修正 (#13765)
anatawa12 May 20, 2024
367bf0c
fix: `/share` with unicode characters in the URL (#13846)
anatawa12 May 20, 2024
1d4e639
ci: verify locale data (#13849)
acid-chicken May 21, 2024
3fba768
New Crowdin updates (#13500)
syuilo May 21, 2024
7bde630
`/tags` と `/user-tags` が検索エンジンにインデックスされないように (#13847)
anatawa12 May 21, 2024
37f2952
Update about-misskey.vue
syuilo May 21, 2024
3340631
Update about-misskey.vue
syuilo May 21, 2024
126383d
deps: AiScript VSCodeのバージョンを上げる (#13851)
kakkokari-gtyih May 21, 2024
6a637db
enhance(frontend): 通常のノートでも、お気に入りに登録したチャンネルにリノートできるように (#13855)
kakkokari-gtyih May 21, 2024
20c0bd9
happy-domにメモリリークがありそう
syuilo May 21, 2024
c69de6b
fix(l10n): fix wrong description of server silence (#13857)
Sayamame-beans May 21, 2024
ed432d0
New Crowdin updates (#13850)
syuilo May 21, 2024
38c1075
enhance(frontend): センシティブとして設定されたURLのプレビューサムネイルのblur調整 (MisskeyIO#633)
u1-liquid May 22, 2024
557601f
enhance(backend): 投票の選択肢に対してもセンシティブワード検出を行うように (MisskeyIO#630)
CyberRex0 May 22, 2024
0f70bf5
Merge remote-tracking branch 'misskey-dev/develop' into io
u1-liquid May 22, 2024
c523c86
Merge pull request MisskeyIO#636 from merge-upstream
u1-liquid May 22, 2024
3aa09e7
Bump up version to 2024.5.0-io.1 (MisskeyIO#637)
u1-liquid May 23, 2024
0b207e0
chore(frontend): CSSのwarning解消、i18n (MisskeyIO#640)
u1-liquid May 24, 2024
2b7f438
fix(backend): pnpm devが動作しない問題を修正 (MisskeyIO#641)
u1-liquid May 24, 2024
9e4ff38
enhance(backend): MisskeyIO#615 のパフォーマンス改善 (MisskeyIO#638)
u1-liquid May 24, 2024
f6bf7f9
feat(announcement): 個別のお知らせにリンクで飛べるように (MisskeyIO#639)
u1-liquid May 24, 2024
dff3853
enhance(frontend): 通報のカテゴリーの調整・説明文の追加 (MisskeyIO#642)
u1-liquid May 24, 2024
93ffb1b
spec: Remove Misskey.io related customization
u1-liquid May 24, 2024
6aa0b2c
Merge branch 'io' into host
u1-liquid May 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix notification limit with exclude/include types (misskey-dev#13836)
* fix: /i/notificationsがsinceIdのみのときに正しく動かない問題

Fix misskey-dev#10902 again

* chore: use exclusive range to fetch data

* fix: フィルタによって通知が0件だった場合でもリトライするように

* docs(changelog): `/i/notifications`に includeTypes`か`excludeTypes`を指定しているとき、通知が存在するのに空配列を返すことがある問題を修正
  • Loading branch information
anatawa12 committed May 20, 2024
commit 4d0db37d2e5baddea3995e222bddca7032052ef1
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
- Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正
- Fix: AP Link等は添付ファイル扱いしないようになど (#13754)
- Fix: FTTが有効かつsinceIdのみを指定した場合に帰って来るレスポンスが逆順である問題を修正
- Fix: `/i/notifications`に `includeTypes`か`excludeTypes`を指定しているとき、通知が存在するのに空配列を返すことがある問題を修正

## 2024.3.1

Expand Down
68 changes: 46 additions & 22 deletions packages/backend/src/server/api/endpoints/i/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { In } from 'typeorm';
import * as Redis from 'ioredis';
import { Inject, Injectable } from '@nestjs/common';
import type { NotesRepository } from '@/models/_.js';
import { obsoleteNotificationTypes, notificationTypes, FilterUnionByProperty } from '@/types.js';
import { FilterUnionByProperty, notificationTypes, obsoleteNotificationTypes } from '@/types.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { NoteReadService } from '@/core/NoteReadService.js';
import { NotificationEntityService } from '@/core/entities/NotificationEntityService.js';
Expand Down Expand Up @@ -84,27 +84,51 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const includeTypes = ps.includeTypes && ps.includeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];
const excludeTypes = ps.excludeTypes && ps.excludeTypes.filter(type => !(obsoleteNotificationTypes).includes(type as any)) as typeof notificationTypes[number][];

const limit = ps.limit + (ps.untilId ? 1 : 0) + (ps.sinceId ? 1 : 0); // untilIdに指定したものも含まれるため+1
const notificationsRes = await this.redisClient.xrevrange(
`notificationTimeline:${me.id}`,
ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : '+',
ps.sinceId ? this.idService.parse(ps.sinceId).date.getTime() : '-',
'COUNT', limit);

if (notificationsRes.length === 0) {
return [];
}

let notifications = notificationsRes.map(x => JSON.parse(x[1][1])).filter(x => x.id !== ps.untilId && x !== ps.sinceId) as MiNotification[];

if (includeTypes && includeTypes.length > 0) {
notifications = notifications.filter(notification => includeTypes.includes(notification.type));
} else if (excludeTypes && excludeTypes.length > 0) {
notifications = notifications.filter(notification => !excludeTypes.includes(notification.type));
}

if (notifications.length === 0) {
return [];
let sinceTime = ps.sinceId ? this.idService.parse(ps.sinceId).date.getTime().toString() : null;
let untilTime = ps.untilId ? this.idService.parse(ps.untilId).date.getTime().toString() : null;

let notifications: MiNotification[];
for (;;) {
let notificationsRes: [id: string, fields: string[]][];

// sinceidのみの場合は古い順、そうでない場合は新しい順。 QueryService.makePaginationQueryも参照
if (sinceTime && !untilTime) {
notificationsRes = await this.redisClient.xrange(
`notificationTimeline:${me.id}`,
'(' + sinceTime,
'+',
'COUNT', ps.limit);
} else {
notificationsRes = await this.redisClient.xrevrange(
`notificationTimeline:${me.id}`,
untilTime ? '(' + untilTime : '+',
sinceTime ? '(' + sinceTime : '-',
'COUNT', ps.limit);
}

if (notificationsRes.length === 0) {
return [];
}

notifications = notificationsRes.map(x => JSON.parse(x[1][1])) as MiNotification[];

if (includeTypes && includeTypes.length > 0) {
notifications = notifications.filter(notification => includeTypes.includes(notification.type));
} else if (excludeTypes && excludeTypes.length > 0) {
notifications = notifications.filter(notification => !excludeTypes.includes(notification.type));
}

if (notifications.length !== 0) {
// 通知が1件以上ある場合は返す
break;
}

// フィルタしたことで通知が0件になった場合、次のページを取得する
if (ps.sinceId && !ps.untilId) {
sinceTime = notificationsRes[notificationsRes.length - 1][0];
} else {
untilTime = notificationsRes[notificationsRes.length - 1][0];
}
}

// Mark all as read
Expand Down