mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-23 18:35:56 +00:00
Adding listPersonContent check.
This commit is contained in:
parent
85d8810139
commit
38f5f4e043
5 changed files with 27 additions and 10 deletions
|
@ -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-image-api-rework.8",
|
"lemmy-js-client": "0.20.0-modlog-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",
|
||||||
|
|
|
@ -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-image-api-rework.8
|
specifier: 0.20.0-modlog-combined.0
|
||||||
version: 0.20.0-image-api-rework.8
|
version: 0.20.0-modlog-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-image-api-rework.8:
|
lemmy-js-client@0.20.0-modlog-combined.0:
|
||||||
resolution: {integrity: sha512-Ns/ayfCSm2lHbdAU1tGIZSx6kJ2ZeS7UiXlPuH0IzHQSi8Yuyzj3srDCyHpE6Td3pmXbQlt9N1ziPE4KeRJ3CA==}
|
resolution: {integrity: sha512-lb3na39klOSE184hJJObMufKjHtm3Mrk42RHqyVNCYZQ+FAAbQzBFTuYyqv8QJV5TJlMmyFO2v1v/9cH72nLRg==}
|
||||||
|
|
||||||
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-image-api-rework.8: {}
|
lemmy-js-client@0.20.0-modlog-combined.0: {}
|
||||||
|
|
||||||
leven@3.1.0: {}
|
leven@3.1.0: {}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ import {
|
||||||
getComments,
|
getComments,
|
||||||
getCommentParentId,
|
getCommentParentId,
|
||||||
resolveCommunity,
|
resolveCommunity,
|
||||||
getPersonDetails,
|
|
||||||
getReplies,
|
getReplies,
|
||||||
getUnreadCount,
|
getUnreadCount,
|
||||||
waitUntil,
|
waitUntil,
|
||||||
|
@ -38,6 +37,7 @@ import {
|
||||||
delay,
|
delay,
|
||||||
saveUserSettings,
|
saveUserSettings,
|
||||||
listReports,
|
listReports,
|
||||||
|
listPersonContent,
|
||||||
} from "./shared";
|
} from "./shared";
|
||||||
import {
|
import {
|
||||||
CommentReportView,
|
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);
|
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)
|
// 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,
|
alpha,
|
||||||
commentRes.comment_view.comment.creator_id,
|
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
|
// beta will unremove the comment
|
||||||
let unremoveCommentRes = await removeComment(beta, false, betaCommentId);
|
let unremoveCommentRes = await removeComment(beta, false, betaCommentId);
|
||||||
|
|
|
@ -23,6 +23,9 @@ import {
|
||||||
PrivateMessageReportResponse,
|
PrivateMessageReportResponse,
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
UserBlockInstanceParams,
|
UserBlockInstanceParams,
|
||||||
|
ListPersonContentResponse,
|
||||||
|
ListPersonContent,
|
||||||
|
PersonContentType,
|
||||||
} 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";
|
||||||
|
@ -735,6 +738,7 @@ export async function saveUserSettings(
|
||||||
): Promise<SuccessResponse> {
|
): Promise<SuccessResponse> {
|
||||||
return api.saveUserSettings(form);
|
return api.saveUserSettings(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPersonDetails(
|
export async function getPersonDetails(
|
||||||
api: LemmyHttp,
|
api: LemmyHttp,
|
||||||
person_id: number,
|
person_id: number,
|
||||||
|
@ -745,6 +749,18 @@ export async function getPersonDetails(
|
||||||
return api.getPersonDetails(form);
|
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> {
|
export async function deleteUser(api: LemmyHttp): Promise<SuccessResponse> {
|
||||||
let form: DeleteAccount = {
|
let form: DeleteAccount = {
|
||||||
delete_content: true,
|
delete_content: true,
|
||||||
|
|
|
@ -75,7 +75,6 @@ test("Delete user", async () => {
|
||||||
let user = await registerUser(alpha, alphaUrl);
|
let user = await registerUser(alpha, alphaUrl);
|
||||||
let user_profile = await getMyUser(user);
|
let user_profile = await getMyUser(user);
|
||||||
let person_id = user_profile.local_user_view.person.id;
|
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
|
// make a local post and comment
|
||||||
let alphaCommunity = (await resolveCommunity(user, "main@lemmy-alpha:8541"))
|
let alphaCommunity = (await resolveCommunity(user, "main@lemmy-alpha:8541"))
|
||||||
|
|
Loading…
Reference in a new issue