- git submodule update
prettier_check:
- image: tmknom/prettier:2.8.8
+ image: tmknom/prettier:3.0.0
commands:
- prettier -c . '!**/volumes' '!**/dist' '!target' '!**/translations'
"eslint-plugin-prettier": "^4.0.0",
"jest": "^29.5.0",
"lemmy-js-client": "0.17.2-rc.13",
- "prettier": "^2.8.8",
+ "prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
function assertCommentFederation(
commentOne?: CommentView,
- commentTwo?: CommentView
+ commentTwo?: CommentView,
) {
expect(commentOne?.comment.ap_id).toBe(commentTwo?.comment.ap_id);
expect(commentOne?.comment.content).toBe(commentTwo?.comment.content);
let updateCommentRes = await editComment(
alpha,
- commentRes.comment_view.comment.id
+ commentRes.comment_view.comment.id,
);
expect(updateCommentRes.comment_view.comment.content).toBe(
- "A jest test federated comment update"
+ "A jest test federated comment update",
);
expect(updateCommentRes.comment_view.community.local).toBe(false);
expect(updateCommentRes.comment_view.creator.local).toBe(true);
let deleteCommentRes = await deleteComment(
alpha,
true,
- commentRes.comment_view.comment.id
+ commentRes.comment_view.comment.id,
);
expect(deleteCommentRes.comment_view.comment.deleted).toBe(true);
// Make sure that comment is undefined on beta
let betaCommentRes = (await resolveComment(
beta,
- commentRes.comment_view.comment
+ commentRes.comment_view.comment,
)) as any;
expect(betaCommentRes.error).toBe("couldnt_find_object");
let undeleteCommentRes = await deleteComment(
alpha,
false,
- commentRes.comment_view.comment.id
+ commentRes.comment_view.comment.id,
);
expect(undeleteCommentRes.comment_view.comment.deleted).toBe(false);
// Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
let refetchedPostComments = await getComments(
alpha,
- postRes.post_view.post.id
+ postRes.post_view.post.id,
);
expect(refetchedPostComments.comments[0].comment.removed).toBe(true);
// Make sure that comment is unremoved on beta
let refetchedPostComments2 = await getComments(
alpha,
- postRes.post_view.post.id
+ postRes.post_view.post.id,
);
expect(refetchedPostComments2.comments[0].comment.removed).toBe(false);
assertCommentFederation(
refetchedPostComments2.comments[0],
- unremoveCommentRes.comment_view
+ unremoveCommentRes.comment_view,
);
});
let newCommunity = await createCommunity(newAlphaApi);
let newPost = await createPost(
newAlphaApi,
- newCommunity.community_view.community.id
+ newCommunity.community_view.community.id,
);
let commentRes = await createComment(newAlphaApi, newPost.post_view.post.id);
expect(commentRes.comment_view.comment.content).toBeDefined();
let removeCommentRes = await removeComment(
beta,
true,
- betaComment.comment.id
+ betaComment.comment.id,
);
expect(removeCommentRes.comment_view.comment.removed).toBe(true);
// Make sure its not removed on alpha
let refetchedPostComments = await getComments(
alpha,
- newPost.post_view.post.id
+ newPost.post_view.post.id,
);
expect(refetchedPostComments.comments[0].comment.removed).toBe(false);
assertCommentFederation(
refetchedPostComments.comments[0],
- commentRes.comment_view
+ commentRes.comment_view,
);
});
let replyRes = await createComment(
beta,
betaComment.post.id,
- betaComment.comment.id
+ betaComment.comment.id,
);
expect(replyRes.comment_view.comment.content).toBeDefined();
expect(replyRes.comment_view.community.local).toBe(true);
expect(replyRes.comment_view.creator.local).toBe(true);
expect(getCommentParentId(replyRes.comment_view.comment)).toBe(
- betaComment.comment.id
+ betaComment.comment.id,
);
expect(replyRes.comment_view.counts.score).toBe(1);
let alphaComment = postComments.comments[0];
expect(alphaComment.comment.content).toBeDefined();
expect(getCommentParentId(alphaComment.comment)).toBe(
- postComments.comments[1].comment.id
+ postComments.comments[1].comment.id,
);
expect(alphaComment.community.local).toBe(false);
expect(alphaComment.creator.local).toBe(false);
alpha,
postRes.post_view.post.id,
commentRes.comment_view.comment.id,
- mentionContent
+ mentionContent,
);
expect(mentionRes.comment_view.comment.content).toBeDefined();
expect(mentionRes.comment_view.community.local).toBe(false);
gamma,
gammaPost.post.id,
undefined,
- commentContent
+ commentContent,
);
expect(commentRes.comment_view.comment.content).toBe(commentContent);
expect(commentRes.comment_view.community.local).toBe(false);
// Make sure alpha sees it
let alphaPostComments2 = await getComments(
alpha,
- alphaPost.post_view.post.id
+ alphaPost.post_view.post.id,
);
expect(alphaPostComments2.comments[0].comment.content).toBe(commentContent);
expect(alphaPostComments2.comments[0].community.local).toBe(true);
expect(alphaPostComments2.comments[0].counts.score).toBe(1);
assertCommentFederation(
alphaPostComments2.comments[0],
- commentRes.comment_view
+ commentRes.comment_view,
);
// Make sure beta has mentions
gamma,
gammaPost.post.id,
undefined,
- commentContent
+ commentContent,
);
expect(commentRes.comment_view.comment.content).toBe(commentContent);
expect(commentRes.comment_view.community.local).toBe(false);
expect(alphaPostComments2.comments[0].counts.score).toBe(1);
assertCommentFederation(
alphaPostComments2.comments[0],
- commentRes.comment_view
+ commentRes.comment_view,
);
await unfollowRemotes(alpha);
// Unfollow all remote communities
let site = await unfollowRemotes(alpha);
expect(
- site.my_user?.follows.filter(c => c.community.local == false).length
+ site.my_user?.follows.filter(c => c.community.local == false).length,
).toBe(0);
// B creates a post, and two comments, should be invisible to A
beta,
postRes.post_view.post.id,
undefined,
- parentCommentContent
+ parentCommentContent,
);
expect(parentCommentRes.comment_view.comment.content).toBe(
- parentCommentContent
+ parentCommentContent,
);
// B creates a comment, then a child one of that.
beta,
postRes.post_view.post.id,
parentCommentRes.comment_view.comment.id,
- childCommentContent
+ childCommentContent,
);
expect(childCommentRes.comment_view.comment.content).toBe(
- childCommentContent
+ childCommentContent,
);
// Follow beta again
let updateRes = await editComment(
beta,
childCommentRes.comment_view.comment.id,
- updatedCommentContent
+ updatedCommentContent,
);
expect(updateRes.comment_view.comment.content).toBe(updatedCommentContent);
expect(alphaPost.post_view.post.name).toBeDefined();
assertCommentFederation(
alphaPostComments.comments[1],
- parentCommentRes.comment_view
+ parentCommentRes.comment_view,
);
assertCommentFederation(
alphaPostComments.comments[0],
- updateRes.comment_view
+ updateRes.comment_view,
);
expect(alphaPost.post_view.community.local).toBe(false);
expect(alphaPost.post_view.creator.local).toBe(false);
expect(betaReport).toBeDefined();
expect(betaReport.resolved).toBe(false);
expect(betaReport.original_comment_text).toBe(
- alphaReport.original_comment_text
+ alphaReport.original_comment_text,
);
expect(betaReport.reason).toBe(alphaReport.reason);
});
function assertCommunityFederation(
communityOne?: CommunityView,
- communityTwo?: CommunityView
+ communityTwo?: CommunityView,
) {
expect(communityOne?.community.actor_id).toBe(
- communityTwo?.community.actor_id
+ communityTwo?.community.actor_id,
);
expect(communityOne?.community.name).toBe(communityTwo?.community.name);
expect(communityOne?.community.title).toBe(communityTwo?.community.title);
expect(communityOne?.community.description).toBe(
- communityTwo?.community.description
+ communityTwo?.community.description,
);
expect(communityOne?.community.icon).toBe(communityTwo?.community.icon);
expect(communityOne?.community.banner).toBe(communityTwo?.community.banner);
expect(communityOne?.community.published).toBe(
- communityTwo?.community.published
+ communityTwo?.community.published,
);
expect(communityOne?.community.nsfw).toBe(communityTwo?.community.nsfw);
expect(communityOne?.community.removed).toBe(communityTwo?.community.removed);
let deleteCommunityRes = await deleteCommunity(
beta,
true,
- communityRes.community_view.community.id
+ communityRes.community_view.community.id,
);
expect(deleteCommunityRes.community_view.community.deleted).toBe(true);
expect(deleteCommunityRes.community_view.community.title).toBe(
- communityRes.community_view.community.title
+ communityRes.community_view.community.title,
);
// Make sure it got deleted on A
let communityOnAlphaDeleted = await getCommunity(
alpha,
- alphaCommunity.community.id
+ alphaCommunity.community.id,
);
expect(communityOnAlphaDeleted.community_view.community.deleted).toBe(true);
let undeleteCommunityRes = await deleteCommunity(
beta,
false,
- communityRes.community_view.community.id
+ communityRes.community_view.community.id,
);
expect(undeleteCommunityRes.community_view.community.deleted).toBe(false);
// Make sure it got undeleted on A
let communityOnAlphaUnDeleted = await getCommunity(
alpha,
- alphaCommunity.community.id
+ alphaCommunity.community.id,
);
expect(communityOnAlphaUnDeleted.community_view.community.deleted).toBe(
- false
+ false,
);
});
let removeCommunityRes = await removeCommunity(
beta,
true,
- communityRes.community_view.community.id
+ communityRes.community_view.community.id,
);
expect(removeCommunityRes.community_view.community.removed).toBe(true);
expect(removeCommunityRes.community_view.community.title).toBe(
- communityRes.community_view.community.title
+ communityRes.community_view.community.title,
);
// Make sure it got Removed on A
let communityOnAlphaRemoved = await getCommunity(
alpha,
- alphaCommunity.community.id
+ alphaCommunity.community.id,
);
expect(communityOnAlphaRemoved.community_view.community.removed).toBe(true);
let unremoveCommunityRes = await removeCommunity(
beta,
false,
- communityRes.community_view.community.id
+ communityRes.community_view.community.id,
);
expect(unremoveCommunityRes.community_view.community.removed).toBe(false);
// Make sure it got undeleted on A
let communityOnAlphaUnRemoved = await getCommunity(
alpha,
- alphaCommunity.community.id
+ alphaCommunity.community.id,
);
expect(communityOnAlphaUnRemoved.community_view.community.removed).toBe(
- false
+ false,
);
});
bannedUserInfo2.person.id,
betaCommunity.community.id,
true,
- true
+ true,
);
expect(banRes.banned).toBe(true);
// Check it from local
let site = await getSite(alpha);
let remoteCommunityId = site.my_user?.follows.find(
- c => c.community.local == false
+ c => c.community.local == false,
)?.community.id;
expect(remoteCommunityId).toBeDefined();
expect(site.my_user?.follows.length).toBe(2);
alpha,
alphaPerson.person.id,
true,
- true
+ true,
);
expect(banAlpha.banned).toBe(true);
alpha,
alphaPerson.person.id,
false,
- false
+ false,
);
expect(unBanAlpha.banned).toBe(false);
alphaPerson.person.id,
2,
true,
- true
+ true,
);
expect(banAlpha.banned).toBe(true);
alphaPerson.person.id,
2,
false,
- false
+ false,
);
expect(unBanAlpha.banned).toBe(false);
let postRes3 = await createPost(alpha, betaCommunity.community.id);
let pmRes = await createPrivateMessage(alpha, recipient_id);
let pmUpdated = await editPrivateMessage(
alpha,
- pmRes.private_message_view.private_message.id
+ pmRes.private_message_view.private_message.id,
);
expect(pmUpdated.private_message_view.private_message.content).toBe(
- updatedContent
+ updatedContent,
);
let betaPms = await listPrivateMessages(beta);
expect(betaPms.private_messages[0].private_message.content).toBe(
- updatedContent
+ updatedContent,
);
});
let deletedPmRes = await deletePrivateMessage(
alpha,
true,
- pmRes.private_message_view.private_message.id
+ pmRes.private_message_view.private_message.id,
);
expect(deletedPmRes.private_message_view.private_message.deleted).toBe(true);
// no reason to show them
let betaPms2 = await listPrivateMessages(beta);
expect(betaPms2.private_messages.length).toBe(
- betaPms1.private_messages.length - 1
+ betaPms1.private_messages.length - 1,
);
// Undelete
let undeletedPmRes = await deletePrivateMessage(
alpha,
false,
- pmRes.private_message_view.private_message.id
+ pmRes.private_message_view.private_message.id,
);
expect(undeletedPmRes.private_message_view.private_message.deleted).toBe(
- false
+ false,
);
let betaPms3 = await listPrivateMessages(beta);
expect(betaPms3.private_messages.length).toBe(
- betaPms1.private_messages.length
+ betaPms1.private_messages.length,
);
});
export async function createPost(
api: API,
- community_id: number
+ community_id: number,
): Promise<PostResponse> {
let name = randomString(5);
let body = randomString(10);
export async function deletePost(
api: API,
deleted: boolean,
- post: Post
+ post: Post,
): Promise<PostResponse> {
let form: DeletePost = {
post_id: post.id,
export async function removePost(
api: API,
removed: boolean,
- post: Post
+ post: Post,
): Promise<PostResponse> {
let form: RemovePost = {
post_id: post.id,
export async function featurePost(
api: API,
featured: boolean,
- post: Post
+ post: Post,
): Promise<PostResponse> {
let form: FeaturePost = {
post_id: post.id,
export async function lockPost(
api: API,
locked: boolean,
- post: Post
+ post: Post,
): Promise<PostResponse> {
let form: LockPost = {
post_id: post.id,
export async function resolvePost(
api: API,
- post: Post
+ post: Post,
): Promise<ResolveObjectResponse> {
let form: ResolveObject = {
q: post.ap_id,
export async function searchPostLocal(
api: API,
- post: Post
+ post: Post,
): Promise<SearchResponse> {
let form: Search = {
q: post.name,
export async function getPost(
api: API,
- post_id: number
+ post_id: number,
): Promise<GetPostResponse> {
let form: GetPost = {
id: post_id,
export async function getComments(
api: API,
- post_id: number
+ post_id: number,
): Promise<GetCommentsResponse> {
let form: GetComments = {
post_id: post_id,
export async function resolveComment(
api: API,
- comment: Comment
+ comment: Comment,
): Promise<ResolveObjectResponse> {
let form: ResolveObject = {
q: comment.ap_id,
}
export async function resolveBetaCommunity(
- api: API
+ api: API,
): Promise<ResolveObjectResponse> {
// Use short-hand search url
let form: ResolveObject = {
export async function resolveCommunity(
api: API,
- q: string
+ q: string,
): Promise<ResolveObjectResponse> {
let form: ResolveObject = {
q,
export async function resolvePerson(
api: API,
- apShortname: string
+ apShortname: string,
): Promise<ResolveObjectResponse> {
let form: ResolveObject = {
q: apShortname,
api: API,
person_id: number,
ban: boolean,
- remove_data: boolean
+ remove_data: boolean,
): Promise<BanPersonResponse> {
// Make sure lemmy-beta/c/main is cached on lemmy_alpha
let form: BanPerson = {
person_id: number,
community_id: number,
remove_data: boolean,
- ban: boolean
+ ban: boolean,
): Promise<BanFromCommunityResponse> {
let form: BanFromCommunity = {
person_id,
export async function followCommunity(
api: API,
follow: boolean,
- community_id: number
+ community_id: number,
): Promise<CommunityResponse> {
let form: FollowCommunity = {
community_id,
export async function likePost(
api: API,
score: number,
- post: Post
+ post: Post,
): Promise<PostResponse> {
let form: CreatePostLike = {
post_id: post.id,
api: API,
post_id: number,
parent_id?: number,
- content = "a jest test comment"
+ content = "a jest test comment",
): Promise<CommentResponse> {
let form: CreateComment = {
content,
export async function editComment(
api: API,
comment_id: number,
- content = "A jest test federated comment update"
+ content = "A jest test federated comment update",
): Promise<CommentResponse> {
let form: EditComment = {
content,
export async function deleteComment(
api: API,
deleted: boolean,
- comment_id: number
+ comment_id: number,
): Promise<CommentResponse> {
let form: DeleteComment = {
comment_id,
export async function removeComment(
api: API,
removed: boolean,
- comment_id: number
+ comment_id: number,
): Promise<CommentResponse> {
let form: RemoveComment = {
comment_id,
}
export async function getMentions(
- api: API
+ api: API,
): Promise<GetPersonMentionsResponse> {
let form: GetPersonMentions = {
sort: "New",
export async function likeComment(
api: API,
score: number,
- comment: Comment
+ comment: Comment,
): Promise<CommentResponse> {
let form: CreateCommentLike = {
comment_id: comment.id,
export async function createCommunity(
api: API,
- name_: string = randomString(5)
+ name_: string = randomString(5),
): Promise<CommunityResponse> {
let description = "a sample description";
let form: CreateCommunity = {
export async function getCommunity(
api: API,
- id: number
+ id: number,
): Promise<CommunityResponse> {
let form: GetCommunity = {
id,
export async function deleteCommunity(
api: API,
deleted: boolean,
- community_id: number
+ community_id: number,
): Promise<CommunityResponse> {
let form: DeleteCommunity = {
community_id,
export async function removeCommunity(
api: API,
removed: boolean,
- community_id: number
+ community_id: number,
): Promise<CommunityResponse> {
let form: RemoveCommunity = {
community_id,
export async function createPrivateMessage(
api: API,
- recipient_id: number
+ recipient_id: number,
): Promise<PrivateMessageResponse> {
let content = "A jest test federated private message";
let form: CreatePrivateMessage = {
export async function editPrivateMessage(
api: API,
- private_message_id: number
+ private_message_id: number,
): Promise<PrivateMessageResponse> {
let updatedContent = "A jest test federated private message edited";
let form: EditPrivateMessage = {
export async function deletePrivateMessage(
api: API,
deleted: boolean,
- private_message_id: number
+ private_message_id: number,
): Promise<PrivateMessageResponse> {
let form: DeletePrivateMessage = {
deleted,
export async function registerUser(
api: API,
- username: string = randomString(5)
+ username: string = randomString(5),
): Promise<LoginResponse> {
let form: Register = {
username,
}
export async function saveUserSettingsFederated(
- api: API
+ api: API,
): Promise<LoginResponse> {
let avatar = "https://image.flaticon.com/icons/png/512/35/35896.png";
let banner = "https://image.flaticon.com/icons/png/512/36/35896.png";
export async function saveUserSettings(
api: API,
- form: SaveUserSettings
+ form: SaveUserSettings,
): Promise<LoginResponse> {
return api.client.saveUserSettings(form);
}
}
export async function listPrivateMessages(
- api: API
+ api: API,
): Promise<PrivateMessagesResponse> {
let form: GetPrivateMessages = {
auth: api.auth,
export async function reportPost(
api: API,
post_id: number,
- reason: string
+ reason: string,
): Promise<PostReportResponse> {
let form: CreatePostReport = {
post_id,
}
export async function listPostReports(
- api: API
+ api: API,
): Promise<ListPostReportsResponse> {
let form: ListPostReports = {
auth: api.auth,
export async function reportComment(
api: API,
comment_id: number,
- reason: string
+ reason: string,
): Promise<CommentReportResponse> {
let form: CreateCommentReport = {
comment_id,
}
export async function listCommentReports(
- api: API
+ api: API,
): Promise<ListCommentReportsResponse> {
let form: ListCommentReports = {
auth: api.auth,
dependencies:
fast-diff "^1.1.2"
-prettier@^2.8.8:
- version "2.8.8"
- resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
- integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
+prettier@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.0.tgz#e7b19f691245a21d618c68bc54dc06122f6105ae"
+ integrity sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==
pretty-format@^29.0.0, pretty-format@^29.5.0:
version "29.5.0"