Adding listPersonContent check.

This commit is contained in:
Dessalines 2025-01-13 23:47:30 -05:00
parent 85d8810139
commit 38f5f4e043
5 changed files with 27 additions and 10 deletions

View file

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

View file

@ -30,8 +30,8 @@ importers:
specifier: ^29.5.0
version: 29.7.0(@types/node@22.10.1)
lemmy-js-client:
specifier: 0.20.0-image-api-rework.8
version: 0.20.0-image-api-rework.8
specifier: 0.20.0-modlog-combined.0
version: 0.20.0-modlog-combined.0
prettier:
specifier: ^3.4.2
version: 3.4.2
@ -1166,8 +1166,8 @@ packages:
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
engines: {node: '>=6'}
lemmy-js-client@0.20.0-image-api-rework.8:
resolution: {integrity: sha512-Ns/ayfCSm2lHbdAU1tGIZSx6kJ2ZeS7UiXlPuH0IzHQSi8Yuyzj3srDCyHpE6Td3pmXbQlt9N1ziPE4KeRJ3CA==}
lemmy-js-client@0.20.0-modlog-combined.0:
resolution: {integrity: sha512-lb3na39klOSE184hJJObMufKjHtm3Mrk42RHqyVNCYZQ+FAAbQzBFTuYyqv8QJV5TJlMmyFO2v1v/9cH72nLRg==}
leven@3.1.0:
resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==}
@ -3078,7 +3078,7 @@ snapshots:
kleur@3.0.3: {}
lemmy-js-client@0.20.0-image-api-rework.8: {}
lemmy-js-client@0.20.0-modlog-combined.0: {}
leven@3.1.0: {}

View file

@ -27,7 +27,6 @@ import {
getComments,
getCommentParentId,
resolveCommunity,
getPersonDetails,
getReplies,
getUnreadCount,
waitUntil,
@ -38,6 +37,7 @@ import {
delay,
saveUserSettings,
listReports,
listPersonContent,
} from "./shared";
import {
CommentReportView,
@ -210,11 +210,13 @@ test.skip("Remove a comment from admin and community on the same instance", asyn
expect(removeCommentRes.comment_view.comment.removed).toBe(true);
// Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
let refetchedPostComments = await getPersonDetails(
let refetchedPostComments = await listPersonContent(
alpha,
commentRes.comment_view.comment.creator_id,
"Comments",
);
expect(refetchedPostComments.comments[0].comment.removed).toBe(true);
let firstRefetchedComment = refetchedPostComments.content[0] as CommentView;
expect(firstRefetchedComment.comment.removed).toBe(true);
// beta will unremove the comment
let unremoveCommentRes = await removeComment(beta, false, betaCommentId);

View file

@ -23,6 +23,9 @@ import {
PrivateMessageReportResponse,
SuccessResponse,
UserBlockInstanceParams,
ListPersonContentResponse,
ListPersonContent,
PersonContentType,
} from "lemmy-js-client";
import { CreatePost } from "lemmy-js-client/dist/types/CreatePost";
import { DeletePost } from "lemmy-js-client/dist/types/DeletePost";
@ -735,6 +738,7 @@ export async function saveUserSettings(
): Promise<SuccessResponse> {
return api.saveUserSettings(form);
}
export async function getPersonDetails(
api: LemmyHttp,
person_id: number,
@ -745,6 +749,18 @@ export async function getPersonDetails(
return api.getPersonDetails(form);
}
export async function listPersonContent(
api: LemmyHttp,
person_id: number,
type_?: PersonContentType,
): Promise<ListPersonContentResponse> {
let form: ListPersonContent = {
person_id,
type_,
};
return api.listPersonContent(form);
}
export async function deleteUser(api: LemmyHttp): Promise<SuccessResponse> {
let form: DeleteAccount = {
delete_content: true,

View file

@ -75,7 +75,6 @@ test("Delete user", async () => {
let user = await registerUser(alpha, alphaUrl);
let user_profile = await getMyUser(user);
let person_id = user_profile.local_user_view.person.id;
let actor_id = user_profile.local_user_view.person.actor_id;
// make a local post and comment
let alphaCommunity = (await resolveCommunity(user, "main@lemmy-alpha:8541"))