diff --git a/api_tests/package.json b/api_tests/package.json index 881bf9bb5..f9c67eea7 100644 --- a/api_tests/package.json +++ b/api_tests/package.json @@ -28,7 +28,7 @@ "eslint": "^9.18.0", "eslint-plugin-prettier": "^5.1.3", "jest": "^29.5.0", - "lemmy-js-client": "0.20.0-inbox-combined.0", + "lemmy-js-client": "0.20.0-inbox-combined.1", "prettier": "^3.4.2", "ts-jest": "^29.1.0", "typescript": "^5.7.3", diff --git a/api_tests/pnpm-lock.yaml b/api_tests/pnpm-lock.yaml index 78d7b0aa0..0a662e576 100644 --- a/api_tests/pnpm-lock.yaml +++ b/api_tests/pnpm-lock.yaml @@ -30,8 +30,8 @@ importers: specifier: ^29.5.0 version: 29.7.0(@types/node@22.10.6) lemmy-js-client: - specifier: 0.20.0-inbox-combined.0 - version: 0.20.0-inbox-combined.0 + specifier: 0.20.0-inbox-combined.1 + version: 0.20.0-inbox-combined.1 prettier: specifier: ^3.4.2 version: 3.4.2 @@ -1157,8 +1157,8 @@ packages: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} - lemmy-js-client@0.20.0-inbox-combined.0: - resolution: {integrity: sha512-JHUwr5UabGf12EETBtYf149Ye0r2nQBdKSpR7FnEuyc7dcAV1gAmYooVurgDcagqf6Xim0UwUTPDyvTaLGeJnQ==} + lemmy-js-client@0.20.0-inbox-combined.1: + resolution: {integrity: sha512-sFJJePXdMHIVQwCa3fN+nIcIvfD7ZbBEZn08fmITXEA6/qbJLvZGWG/rEcRNkZM+lRKnhfrZihWKx1AHZE9wqA==} leven@3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} @@ -3060,7 +3060,7 @@ snapshots: kleur@3.0.3: {} - lemmy-js-client@0.20.0-inbox-combined.0: {} + lemmy-js-client@0.20.0-inbox-combined.1: {} leven@3.1.0: {} diff --git a/api_tests/src/comment.spec.ts b/api_tests/src/comment.spec.ts index c60d4fda2..42fc06882 100644 --- a/api_tests/src/comment.spec.ts +++ b/api_tests/src/comment.spec.ts @@ -826,6 +826,7 @@ test("Report a comment", async () => { }); test("Dont send a comment reply to a blocked community", async () => { + await beta.markAllNotificationsAsRead(); let newCommunity = await createCommunity(beta); let newCommunityId = newCommunity.community_view.community.id; @@ -839,7 +840,7 @@ test("Dont send a comment reply to a blocked community", async () => { // Check beta's inbox count let unreadCount = await getUnreadCount(beta); - expect(unreadCount.count).toBe(1); + expect(unreadCount.count).toBe(0); // Beta blocks the new beta community let blockRes = await blockCommunity(beta, newCommunityId, true); @@ -859,10 +860,10 @@ test("Dont send a comment reply to a blocked community", async () => { // Check beta's inbox count, make sure it stays the same unreadCount = await getUnreadCount(beta); - expect(unreadCount.count).toBe(1); + expect(unreadCount.count).toBe(0); - let replies = await listInbox(beta, "CommentReply"); - expect(replies.inbox.length).toBe(1); + let replies = await listInbox(beta, "CommentReply", true); + expect(replies.inbox.length).toBe(0); // Unblock the community blockRes = await blockCommunity(beta, newCommunityId, false); diff --git a/src/api_routes_v4.rs b/src/api_routes_v4.rs index af289710e..c0eb33fab 100644 --- a/src/api_routes_v4.rs +++ b/src/api_routes_v4.rs @@ -312,26 +312,19 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/verify_email", post().to(verify_email)) .route("/saved", get().to(list_person_saved)), ) - .route("/account/settings/save", put().to(save_user_settings)) - .service( - scope("/account/settings") - .wrap(rate_limit.import_user_settings()) - .route("/export", get().to(export_settings)) - .route("/import", post().to(import_settings)), - ) .service( scope("/account") .route("", get().to(get_my_user)) .route("/list_media", get().to(list_media)) .route("/inbox", get().to(list_inbox)) .route("/delete", post().to(delete_account)) - .route( - "/mention/comment/mark_as_read", - post().to(mark_comment_mention_as_read), - ) - .route( - "/mention/post/mark_as_read", - post().to(mark_post_mention_as_read), + .service( + scope("/mention") + .route( + "/comment/mark_as_read", + post().to(mark_comment_mention_as_read), + ) + .route("/post/mark_as_read", post().to(mark_post_mention_as_read)), ) .route("/mark_as_read/all", post().to(mark_all_notifications_read)) .route("/report_count", get().to(report_count)) @@ -347,6 +340,14 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/person", post().to(user_block_person)) .route("/community", post().to(user_block_community)) .route("/instance", post().to(user_block_instance)), + ) + .route("/settings/save", put().to(save_user_settings)) + // Account settings import / export have a strict rate limit + .service( + scope("/settings") + .wrap(rate_limit.import_user_settings()) + .route("/export", get().to(export_settings)) + .route("/import", post().to(import_settings)), ), ) // User actions