Adding post body mention api test, fixing api tests.

This commit is contained in:
Dessalines 2025-01-14 22:21:15 -05:00
parent 8f39568760
commit 893e02f2e5
7 changed files with 123 additions and 103 deletions

View file

@ -28,7 +28,7 @@
"eslint": "^9.16.0", "eslint": "^9.16.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"jest": "^29.5.0", "jest": "^29.5.0",
"lemmy-js-client": "0.20.0-modlog-combined.1", "lemmy-js-client": "0.20.0-inbox-combined.0",
"prettier": "^3.4.2", "prettier": "^3.4.2",
"ts-jest": "^29.1.0", "ts-jest": "^29.1.0",
"typescript": "^5.7.2", "typescript": "^5.7.2",

View file

@ -30,8 +30,8 @@ importers:
specifier: ^29.5.0 specifier: ^29.5.0
version: 29.7.0(@types/node@22.10.1) version: 29.7.0(@types/node@22.10.1)
lemmy-js-client: lemmy-js-client:
specifier: 0.20.0-modlog-combined.1 specifier: 0.20.0-inbox-combined.0
version: 0.20.0-modlog-combined.1 version: 0.20.0-inbox-combined.0
prettier: prettier:
specifier: ^3.4.2 specifier: ^3.4.2
version: 3.4.2 version: 3.4.2
@ -1166,8 +1166,8 @@ packages:
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
engines: {node: '>=6'} engines: {node: '>=6'}
lemmy-js-client@0.20.0-modlog-combined.1: lemmy-js-client@0.20.0-inbox-combined.0:
resolution: {integrity: sha512-TL7Vk/G25xALDNDdc5UGgxPNUw2EML33Rh5+1F/0u126RC+l4uoLZvFAczSgu0Na3qDedjMPFnDpvsA60OrlTw==} resolution: {integrity: sha512-JHUwr5UabGf12EETBtYf149Ye0r2nQBdKSpR7FnEuyc7dcAV1gAmYooVurgDcagqf6Xim0UwUTPDyvTaLGeJnQ==}
leven@3.1.0: leven@3.1.0:
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
@ -3078,7 +3078,7 @@ snapshots:
kleur@3.0.3: {} kleur@3.0.3: {}
lemmy-js-client@0.20.0-modlog-combined.1: {} lemmy-js-client@0.20.0-inbox-combined.0: {}
leven@3.1.0: {} leven@3.1.0: {}

View file

@ -16,7 +16,6 @@ import {
editComment, editComment,
deleteComment, deleteComment,
removeComment, removeComment,
getMentions,
resolvePost, resolvePost,
unfollowRemotes, unfollowRemotes,
createCommunity, createCommunity,
@ -27,7 +26,6 @@ import {
getComments, getComments,
getCommentParentId, getCommentParentId,
resolveCommunity, resolveCommunity,
getReplies,
getUnreadCount, getUnreadCount,
waitUntil, waitUntil,
waitForPost, waitForPost,
@ -38,11 +36,14 @@ import {
saveUserSettings, saveUserSettings,
listReports, listReports,
listPersonContent, listPersonContent,
listInbox,
} from "./shared"; } from "./shared";
import { import {
CommentReplyView,
CommentReportView, CommentReportView,
CommentView, CommentView,
CommunityView, CommunityView,
PersonCommentMentionView,
ReportCombinedView, ReportCombinedView,
SaveUserSettings, SaveUserSettings,
} from "lemmy-js-client"; } from "lemmy-js-client";
@ -356,7 +357,7 @@ test("Federated comment like", async () => {
}); });
test("Reply to a comment from another instance, get notification", async () => { test("Reply to a comment from another instance, get notification", async () => {
await alpha.markAllAsRead(); await alpha.markAllNotificationsAsRead();
let betaCommunity = ( let betaCommunity = (
await waitUntil( await waitUntil(
@ -423,18 +424,18 @@ test("Reply to a comment from another instance, get notification", async () => {
// Did alpha get notified of the reply from beta? // Did alpha get notified of the reply from beta?
let alphaUnreadCountRes = await waitUntil( let alphaUnreadCountRes = await waitUntil(
() => getUnreadCount(alpha), () => getUnreadCount(alpha),
e => e.replies >= 1, e => e.count >= 1,
); );
expect(alphaUnreadCountRes.replies).toBeGreaterThanOrEqual(1); expect(alphaUnreadCountRes.count).toBeGreaterThanOrEqual(1);
// check inbox of replies on alpha, fetching read/unread both // check inbox of replies on alpha, fetching read/unread both
let alphaRepliesRes = await waitUntil( let alphaRepliesRes = await waitUntil(
() => getReplies(alpha), () => listInbox(alpha, "CommentReply"),
r => r.replies.length > 0, r => r.inbox.length > 0,
);
const alphaReply = alphaRepliesRes.replies.find(
r => r.comment.id === alphaComment.comment.id,
); );
const alphaReply = alphaRepliesRes.inbox.find(
r => r.type_ == "CommentReply" && r.comment.id === alphaComment.comment.id,
) as CommentReplyView | undefined;
expect(alphaReply).toBeDefined(); expect(alphaReply).toBeDefined();
if (!alphaReply) throw Error(); if (!alphaReply) throw Error();
expect(alphaReply.comment.content).toBeDefined(); expect(alphaReply.comment.content).toBeDefined();
@ -463,7 +464,7 @@ test("Bot reply notifications are filtered when bots are hidden", async () => {
throw "Missing alpha community"; throw "Missing alpha community";
} }
await alpha.markAllAsRead(); await alpha.markAllNotificationsAsRead();
form = { form = {
show_bot_accounts: false, show_bot_accounts: false,
}; };
@ -478,10 +479,7 @@ test("Bot reply notifications are filtered when bots are hidden", async () => {
expect(commentRes).toBeDefined(); expect(commentRes).toBeDefined();
let alphaUnreadCountRes = await getUnreadCount(alpha); let alphaUnreadCountRes = await getUnreadCount(alpha);
expect(alphaUnreadCountRes.replies).toBe(0); expect(alphaUnreadCountRes.count).toBe(0);
let alphaUnreadRepliesRes = await getReplies(alpha, true);
expect(alphaUnreadRepliesRes.replies.length).toBe(0);
// This both restores the original state that may be expected by other tests // This both restores the original state that may be expected by other tests
// implicitly and is used by the next steps to ensure replies are still // implicitly and is used by the next steps to ensure replies are still
@ -492,16 +490,16 @@ test("Bot reply notifications are filtered when bots are hidden", async () => {
await saveUserSettings(alpha, form); await saveUserSettings(alpha, form);
alphaUnreadCountRes = await getUnreadCount(alpha); alphaUnreadCountRes = await getUnreadCount(alpha);
expect(alphaUnreadCountRes.replies).toBe(1); expect(alphaUnreadCountRes.count).toBe(1);
alphaUnreadRepliesRes = await getReplies(alpha, true); let alphaUnreadRepliesRes = await listInbox(alpha, "CommentReply", true);
expect(alphaUnreadRepliesRes.replies.length).toBe(1); expect(alphaUnreadRepliesRes.inbox.length).toBe(1);
expect(alphaUnreadRepliesRes.replies[0].comment.id).toBe( expect((alphaUnreadRepliesRes.inbox[0] as CommentReplyView).comment.id).toBe(
commentRes.comment_view.comment.id, commentRes.comment_view.comment.id,
); );
}); });
test("Mention beta from alpha", async () => { test("Mention beta from alpha comment", async () => {
if (!betaCommunity) throw Error("no community"); if (!betaCommunity) throw Error("no community");
const postOnAlphaRes = await createPost(alpha, betaCommunity.community.id); const postOnAlphaRes = await createPost(alpha, betaCommunity.community.id);
// Create a new branch, trunk-level comment branch, from alpha instance // Create a new branch, trunk-level comment branch, from alpha instance
@ -548,15 +546,17 @@ test("Mention beta from alpha", async () => {
assertCommentFederation(betaRootComment, commentRes.comment_view); assertCommentFederation(betaRootComment, commentRes.comment_view);
let mentionsRes = await waitUntil( let mentionsRes = await waitUntil(
() => getMentions(beta), () => listInbox(beta, "CommentMention"),
m => !!m.mentions[0], m => !!m.inbox[0],
); );
expect(mentionsRes.mentions[0].comment.content).toBeDefined();
expect(mentionsRes.mentions[0].community.local).toBe(true); const firstMention = mentionsRes.inbox[0] as PersonCommentMentionView;
expect(mentionsRes.mentions[0].creator.local).toBe(false); expect(firstMention.comment.content).toBeDefined();
expect(mentionsRes.mentions[0].counts.score).toBe(1); expect(firstMention.community.local).toBe(true);
expect(firstMention.creator.local).toBe(false);
expect(firstMention.counts.score).toBe(1);
// the reply comment with mention should be the most fresh, newest, index 0 // the reply comment with mention should be the most fresh, newest, index 0
expect(mentionsRes.mentions[0].person_mention.comment_id).toBe( expect(firstMention.person_comment_mention.comment_id).toBe(
betaPostComments.comments[0].comment.id, betaPostComments.comments[0].comment.id,
); );
}); });
@ -623,15 +623,17 @@ test("A and G subscribe to B (center) A posts, G mentions B, it gets announced t
); );
// Make sure beta has mentions // Make sure beta has mentions
let relevantMention = await waitUntil( let relevantMention = (await waitUntil(
() => () =>
getMentions(beta).then(m => listInbox(beta, "CommentMention").then(m =>
m.mentions.find( m.inbox.find(
m => m.comment.ap_id === commentRes.comment_view.comment.ap_id, m =>
m.type_ == "CommentMention" &&
m.comment.ap_id === commentRes.comment_view.comment.ap_id,
), ),
), ),
e => !!e, e => !!e,
); )) as PersonCommentMentionView | undefined;
if (!relevantMention) throw Error("could not find mention"); if (!relevantMention) throw Error("could not find mention");
expect(relevantMention.comment.content).toBe(commentContent); expect(relevantMention.comment.content).toBe(commentContent);
expect(relevantMention.community.local).toBe(false); expect(relevantMention.community.local).toBe(false);
@ -837,7 +839,7 @@ test("Dont send a comment reply to a blocked community", async () => {
// Check beta's inbox count // Check beta's inbox count
let unreadCount = await getUnreadCount(beta); let unreadCount = await getUnreadCount(beta);
expect(unreadCount.replies).toBe(1); expect(unreadCount.count).toBe(1);
// Beta blocks the new beta community // Beta blocks the new beta community
let blockRes = await blockCommunity(beta, newCommunityId, true); let blockRes = await blockCommunity(beta, newCommunityId, true);
@ -857,10 +859,10 @@ test("Dont send a comment reply to a blocked community", async () => {
// Check beta's inbox count, make sure it stays the same // Check beta's inbox count, make sure it stays the same
unreadCount = await getUnreadCount(beta); unreadCount = await getUnreadCount(beta);
expect(unreadCount.replies).toBe(1); expect(unreadCount.count).toBe(1);
let replies = await getReplies(beta); let replies = await listInbox(beta, "CommentReply");
expect(replies.replies.length).toBe(1); expect(replies.inbox.length).toBe(1);
// Unblock the community // Unblock the community
blockRes = await blockCommunity(beta, newCommunityId, false); blockRes = await blockCommunity(beta, newCommunityId, false);

View file

@ -38,11 +38,13 @@ import {
createCommunity, createCommunity,
listReports, listReports,
getMyUser, getMyUser,
listInbox,
} from "./shared"; } from "./shared";
import { PostView } from "lemmy-js-client/dist/types/PostView"; import { PostView } from "lemmy-js-client/dist/types/PostView";
import { AdminBlockInstanceParams } from "lemmy-js-client/dist/types/AdminBlockInstanceParams"; import { AdminBlockInstanceParams } from "lemmy-js-client/dist/types/AdminBlockInstanceParams";
import { import {
EditSite, EditSite,
PersonPostMentionView,
PostReport, PostReport,
PostReportView, PostReportView,
ReportCombinedView, ReportCombinedView,
@ -799,6 +801,44 @@ test("Fetch post with redirect", async () => {
expect(gammaPost2.post).toBeDefined(); expect(gammaPost2.post).toBeDefined();
}); });
test("Mention beta from alpha post body", async () => {
if (!betaCommunity) throw Error("no community");
let mentionContent = "A test mention of @lemmy_beta@lemmy-beta:8551";
const postOnAlphaRes = await createPost(
alpha,
betaCommunity.community.id,
undefined,
mentionContent,
);
expect(postOnAlphaRes.post_view.post.body).toBeDefined();
expect(postOnAlphaRes.post_view.community.local).toBe(false);
expect(postOnAlphaRes.post_view.creator.local).toBe(true);
expect(postOnAlphaRes.post_view.counts.score).toBe(1);
// get beta's localized copy of the alpha post
let betaPost = await waitForPost(beta, postOnAlphaRes.post_view.post);
if (!betaPost) {
throw "unable to locate post on beta";
}
expect(betaPost.post.ap_id).toBe(postOnAlphaRes.post_view.post.ap_id);
expect(betaPost.post.name).toBe(postOnAlphaRes.post_view.post.name);
await assertPostFederation(betaPost, postOnAlphaRes.post_view);
let mentionsRes = await waitUntil(
() => listInbox(beta, "PostMention"),
m => !!m.inbox[0],
);
const firstMention = mentionsRes.inbox[0] as PersonPostMentionView;
expect(firstMention.post.body).toBeDefined();
expect(firstMention.community.local).toBe(true);
expect(firstMention.creator.local).toBe(false);
expect(firstMention.counts.score).toBe(1);
expect(firstMention.person_post_mention.post_id).toBe(betaPost.post.id);
});
test("Rewrite markdown links", async () => { test("Rewrite markdown links", async () => {
const community = (await resolveBetaCommunity(beta)).community!; const community = (await resolveBetaCommunity(beta)).community!;

View file

@ -1,4 +1,5 @@
jest.setTimeout(120000); jest.setTimeout(120000);
import { PrivateMessageView } from "lemmy-js-client";
import { import {
alpha, alpha,
beta, beta,
@ -6,11 +7,11 @@ import {
followBeta, followBeta,
createPrivateMessage, createPrivateMessage,
editPrivateMessage, editPrivateMessage,
listPrivateMessages,
deletePrivateMessage, deletePrivateMessage,
waitUntil, waitUntil,
reportPrivateMessage, reportPrivateMessage,
unfollows, unfollows,
listInbox,
} from "./shared"; } from "./shared";
let recipient_id: number; let recipient_id: number;
@ -31,13 +32,14 @@ test("Create a private message", async () => {
expect(pmRes.private_message_view.recipient.local).toBe(false); expect(pmRes.private_message_view.recipient.local).toBe(false);
let betaPms = await waitUntil( let betaPms = await waitUntil(
() => listPrivateMessages(beta), () => listInbox(beta, "PrivateMessage"),
e => !!e.private_messages[0], e => !!e.inbox[0],
); );
expect(betaPms.private_messages[0].private_message.content).toBeDefined(); const firstPm = betaPms.inbox[0] as PrivateMessageView;
expect(betaPms.private_messages[0].private_message.local).toBe(false); expect(firstPm.private_message.content).toBeDefined();
expect(betaPms.private_messages[0].creator.local).toBe(false); expect(firstPm.private_message.local).toBe(false);
expect(betaPms.private_messages[0].recipient.local).toBe(true); expect(firstPm.creator.local).toBe(false);
expect(firstPm.recipient.local).toBe(true);
}); });
test("Update a private message", async () => { test("Update a private message", async () => {
@ -53,10 +55,12 @@ test("Update a private message", async () => {
); );
let betaPms = await waitUntil( let betaPms = await waitUntil(
() => listPrivateMessages(beta), () => listInbox(beta, "PrivateMessage"),
p => p.private_messages[0].private_message.content === updatedContent, p =>
p.inbox[0].type_ == "PrivateMessage" &&
p.inbox[0].private_message.content === updatedContent,
); );
expect(betaPms.private_messages[0].private_message.content).toBe( expect((betaPms.inbox[0] as PrivateMessageView).private_message.content).toBe(
updatedContent, updatedContent,
); );
}); });
@ -64,12 +68,13 @@ test("Update a private message", async () => {
test("Delete a private message", async () => { test("Delete a private message", async () => {
let pmRes = await createPrivateMessage(alpha, recipient_id); let pmRes = await createPrivateMessage(alpha, recipient_id);
let betaPms1 = await waitUntil( let betaPms1 = await waitUntil(
() => listPrivateMessages(beta), () => listInbox(beta, "PrivateMessage"),
m => m =>
!!m.private_messages.find( !!m.inbox.find(
e => e =>
e.type_ == "PrivateMessage" &&
e.private_message.ap_id === e.private_message.ap_id ===
pmRes.private_message_view.private_message.ap_id, pmRes.private_message_view.private_message.ap_id,
), ),
); );
let deletedPmRes = await deletePrivateMessage( let deletedPmRes = await deletePrivateMessage(
@ -83,12 +88,10 @@ test("Delete a private message", async () => {
// even though they are in the actual database. // even though they are in the actual database.
// no reason to show them // no reason to show them
let betaPms2 = await waitUntil( let betaPms2 = await waitUntil(
() => listPrivateMessages(beta), () => listInbox(beta, "PrivateMessage"),
p => p.private_messages.length === betaPms1.private_messages.length - 1, p => p.inbox.length === betaPms1.inbox.length - 1,
);
expect(betaPms2.private_messages.length).toBe(
betaPms1.private_messages.length - 1,
); );
expect(betaPms2.inbox.length).toBe(betaPms1.inbox.length - 1);
// Undelete // Undelete
let undeletedPmRes = await deletePrivateMessage( let undeletedPmRes = await deletePrivateMessage(
@ -101,26 +104,25 @@ test("Delete a private message", async () => {
); );
let betaPms3 = await waitUntil( let betaPms3 = await waitUntil(
() => listPrivateMessages(beta), () => listInbox(beta, "PrivateMessage"),
p => p.private_messages.length === betaPms1.private_messages.length, p => p.inbox.length === betaPms1.inbox.length,
);
expect(betaPms3.private_messages.length).toBe(
betaPms1.private_messages.length,
); );
expect(betaPms3.inbox.length).toBe(betaPms1.inbox.length);
}); });
test("Create a private message report", async () => { test("Create a private message report", async () => {
let pmRes = await createPrivateMessage(alpha, recipient_id); let pmRes = await createPrivateMessage(alpha, recipient_id);
let betaPms1 = await waitUntil( let betaPms1 = await waitUntil(
() => listPrivateMessages(beta), () => listInbox(beta, "PrivateMessage"),
m => m =>
!!m.private_messages.find( !!m.inbox.find(
e => e =>
e.type_ == "PrivateMessage" &&
e.private_message.ap_id === e.private_message.ap_id ===
pmRes.private_message_view.private_message.ap_id, pmRes.private_message_view.private_message.ap_id,
), ),
); );
let betaPm = betaPms1.private_messages[0]; let betaPm = betaPms1.inbox[0] as PrivateMessageView;
expect(betaPm).toBeDefined(); expect(betaPm).toBeDefined();
// Make sure that only the recipient can report it, so this should fail // Make sure that only the recipient can report it, so this should fail

View file

@ -7,8 +7,6 @@ import {
CreatePrivateMessageReport, CreatePrivateMessageReport,
EditCommunity, EditCommunity,
GetCommunityPendingFollowsCountResponse, GetCommunityPendingFollowsCountResponse,
GetReplies,
GetRepliesResponse,
GetUnreadCountResponse, GetUnreadCountResponse,
InstanceId, InstanceId,
LemmyHttp, LemmyHttp,
@ -26,6 +24,9 @@ import {
ListPersonContentResponse, ListPersonContentResponse,
ListPersonContent, ListPersonContent,
PersonContentType, PersonContentType,
ListInboxResponse,
ListInbox,
InboxDataType,
} from "lemmy-js-client"; } from "lemmy-js-client";
import { CreatePost } from "lemmy-js-client/dist/types/CreatePost"; import { CreatePost } from "lemmy-js-client/dist/types/CreatePost";
import { DeletePost } from "lemmy-js-client/dist/types/DeletePost"; import { DeletePost } from "lemmy-js-client/dist/types/DeletePost";
@ -59,8 +60,6 @@ import { CreateComment } from "lemmy-js-client/dist/types/CreateComment";
import { EditComment } from "lemmy-js-client/dist/types/EditComment"; import { EditComment } from "lemmy-js-client/dist/types/EditComment";
import { DeleteComment } from "lemmy-js-client/dist/types/DeleteComment"; import { DeleteComment } from "lemmy-js-client/dist/types/DeleteComment";
import { RemoveComment } from "lemmy-js-client/dist/types/RemoveComment"; import { RemoveComment } from "lemmy-js-client/dist/types/RemoveComment";
import { GetPersonMentionsResponse } from "lemmy-js-client/dist/types/GetPersonMentionsResponse";
import { GetPersonMentions } from "lemmy-js-client/dist/types/GetPersonMentions";
import { CreateCommentLike } from "lemmy-js-client/dist/types/CreateCommentLike"; import { CreateCommentLike } from "lemmy-js-client/dist/types/CreateCommentLike";
import { CreateCommunity } from "lemmy-js-client/dist/types/CreateCommunity"; import { CreateCommunity } from "lemmy-js-client/dist/types/CreateCommunity";
import { GetCommunity } from "lemmy-js-client/dist/types/GetCommunity"; import { GetCommunity } from "lemmy-js-client/dist/types/GetCommunity";
@ -75,8 +74,6 @@ import { Register } from "lemmy-js-client/dist/types/Register";
import { SaveUserSettings } from "lemmy-js-client/dist/types/SaveUserSettings"; import { SaveUserSettings } from "lemmy-js-client/dist/types/SaveUserSettings";
import { DeleteAccount } from "lemmy-js-client/dist/types/DeleteAccount"; import { DeleteAccount } from "lemmy-js-client/dist/types/DeleteAccount";
import { GetSiteResponse } from "lemmy-js-client/dist/types/GetSiteResponse"; import { GetSiteResponse } from "lemmy-js-client/dist/types/GetSiteResponse";
import { PrivateMessagesResponse } from "lemmy-js-client/dist/types/PrivateMessagesResponse";
import { GetPrivateMessages } from "lemmy-js-client/dist/types/GetPrivateMessages";
import { PostReportResponse } from "lemmy-js-client/dist/types/PostReportResponse"; import { PostReportResponse } from "lemmy-js-client/dist/types/PostReportResponse";
import { CreatePostReport } from "lemmy-js-client/dist/types/CreatePostReport"; import { CreatePostReport } from "lemmy-js-client/dist/types/CreatePostReport";
import { CommentReportResponse } from "lemmy-js-client/dist/types/CommentReportResponse"; import { CommentReportResponse } from "lemmy-js-client/dist/types/CommentReportResponse";
@ -377,15 +374,16 @@ export async function getUnreadCount(
return api.getUnreadCount(); return api.getUnreadCount();
} }
export async function getReplies( export async function listInbox(
api: LemmyHttp, api: LemmyHttp,
type_?: InboxDataType,
unread_only: boolean = false, unread_only: boolean = false,
): Promise<GetRepliesResponse> { ): Promise<ListInboxResponse> {
let form: GetReplies = { let form: ListInbox = {
sort: "New",
unread_only, unread_only,
type_,
}; };
return api.getReplies(form); return api.listInbox(form);
} }
export async function resolveComment( export async function resolveComment(
@ -542,16 +540,6 @@ export async function removeComment(
return api.removeComment(form); return api.removeComment(form);
} }
export async function getMentions(
api: LemmyHttp,
): Promise<GetPersonMentionsResponse> {
let form: GetPersonMentions = {
sort: "New",
unread_only: false,
};
return api.getPersonMentions(form);
}
export async function likeComment( export async function likeComment(
api: LemmyHttp, api: LemmyHttp,
score: number, score: number,
@ -777,15 +765,6 @@ export async function getMyUser(api: LemmyHttp): Promise<MyUserInfo> {
return api.getMyUser(); return api.getMyUser();
} }
export async function listPrivateMessages(
api: LemmyHttp,
): Promise<PrivateMessagesResponse> {
let form: GetPrivateMessages = {
unread_only: false,
};
return api.getPrivateMessages(form);
}
export async function unfollowRemotes(api: LemmyHttp): Promise<MyUserInfo> { export async function unfollowRemotes(api: LemmyHttp): Promise<MyUserInfo> {
// Unfollow all remote communities // Unfollow all remote communities
let my_user = await getMyUser(api); let my_user = await getMyUser(api);

View file

@ -333,10 +333,7 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) {
"/mention/post/mark_as_read", "/mention/post/mark_as_read",
post().to(mark_post_mention_as_read), post().to(mark_post_mention_as_read),
) )
.route( .route("/mark_as_read/all", post().to(mark_all_notifications_read))
"/mark_as_read/all",
post().to(mark_all_notifications_read),
)
.route("/report_count", get().to(report_count)) .route("/report_count", get().to(report_count))
.route("/unread_count", get().to(unread_count)) .route("/unread_count", get().to(unread_count))
.route("/list_logins", get().to(list_logins)) .route("/list_logins", get().to(list_logins))