"eslint": "^7.18.0",
"eslint-plugin-jane": "^9.0.3",
"jest": "^26.6.3",
- "lemmy-js-client": "0.9.1-rc.1",
+ "lemmy-js-client": "0.10.0-rc.4",
"node-fetch": "^2.6.1",
"prettier": "^2.1.2",
"ts-jest": "^26.4.4",
);
expect(communityOne.creator.actor_id).toBe(communityTwo.creator.actor_id);
expect(communityOne.community.nsfw).toBe(communityTwo.community.nsfw);
- expect(communityOne.community.category_id).toBe(
- communityTwo.community.category_id
- );
expect(communityOne.community.removed).toBe(communityTwo.community.removed);
expect(communityOne.community.deleted).toBe(communityTwo.community.deleted);
}
getPost,
unfollowRemotes,
searchForUser,
- banUserFromSite,
+ banPersonFromSite,
searchPostLocal,
- banUserFromCommunity,
+ banPersonFromCommunity,
} from './shared';
import { PostView, CommunityView } from 'lemmy-js-client';
expect(alphaUser).toBeDefined();
// ban alpha from beta site
- let banAlpha = await banUserFromSite(beta, alphaUser.user.id, true);
+ let banAlpha = await banPersonFromSite(beta, alphaUser.person.id, true);
expect(banAlpha.banned).toBe(true);
// Alpha makes post on beta
expect(betaPost).toBeUndefined();
// Unban alpha
- let unBanAlpha = await banUserFromSite(beta, alphaUser.user.id, false);
+ let unBanAlpha = await banPersonFromSite(beta, alphaUser.person.id, false);
expect(unBanAlpha.banned).toBe(false);
});
expect(alphaUser).toBeDefined();
// ban alpha from beta site
- await banUserFromCommunity(beta, alphaUser.user.id, 2, false);
- let banAlpha = await banUserFromCommunity(beta, alphaUser.user.id, 2, true);
+ await banPersonFromCommunity(beta, alphaUser.person.id, 2, false);
+ let banAlpha = await banPersonFromCommunity(beta, alphaUser.person.id, 2, true);
expect(banAlpha.banned).toBe(true);
// Alpha makes post on beta
expect(betaPost).toBeUndefined();
// Unban alpha
- let unBanAlpha = await banUserFromCommunity(
+ let unBanAlpha = await banPersonFromCommunity(
beta,
- alphaUser.user.id,
+ alphaUser.person.id,
2,
false
);
CreateCommunity,
DeleteCommunity,
RemoveCommunity,
- GetUserMentions,
+ GetPersonMentions,
CreateCommentLike,
CreatePostLike,
EditPrivateMessage,
GetPost,
PrivateMessageResponse,
PrivateMessagesResponse,
- GetUserMentionsResponse,
+ GetPersonMentionsResponse,
SaveUserSettings,
SortType,
ListingType,
GetSiteResponse,
SearchType,
LemmyHttp,
- BanUserResponse,
- BanUser,
+ BanPersonResponse,
+ BanPerson,
BanFromCommunity,
BanFromCommunityResponse,
Post,
return api.client.search(form);
}
-export async function banUserFromSite(
+export async function banPersonFromSite(
api: API,
- user_id: number,
+ person_id: number,
ban: boolean
-): Promise<BanUserResponse> {
+): Promise<BanPersonResponse> {
// Make sure lemmy-beta/c/main is cached on lemmy_alpha
// Use short-hand search url
- let form: BanUser = {
- user_id,
+ let form: BanPerson = {
+ person_id,
ban,
remove_data: false,
auth: api.auth,
};
- return api.client.banUser(form);
+ return api.client.banPerson(form);
}
-export async function banUserFromCommunity(
+export async function banPersonFromCommunity(
api: API,
- user_id: number,
+ person_id: number,
community_id: number,
ban: boolean
): Promise<BanFromCommunityResponse> {
// Make sure lemmy-beta/c/main is cached on lemmy_alpha
// Use short-hand search url
let form: BanFromCommunity = {
- user_id,
+ person_id,
community_id,
remove_data: false,
ban,
return api.client.removeComment(form);
}
-export async function getMentions(api: API): Promise<GetUserMentionsResponse> {
- let form: GetUserMentions = {
+export async function getMentions(api: API): Promise<GetPersonMentionsResponse> {
+ let form: GetPersonMentions = {
sort: SortType.New,
unread_only: false,
auth: api.auth,
};
- return api.client.getUserMentions(form);
+ return api.client.getPersonMentions(form);
}
export async function likeComment(
description,
icon,
banner,
- category_id: 1,
nsfw: false,
auth: api.auth,
};
getSite,
} from './shared';
import {
- UserViewSafe,
+ PersonViewSafe,
SaveUserSettings,
SortType,
ListingType,
let auth: string;
let apShortname: string;
-function assertUserFederation(userOne: UserViewSafe, userTwo: UserViewSafe) {
- expect(userOne.user.name).toBe(userTwo.user.name);
- expect(userOne.user.preferred_username).toBe(userTwo.user.preferred_username);
- expect(userOne.user.bio).toBe(userTwo.user.bio);
- expect(userOne.user.actor_id).toBe(userTwo.user.actor_id);
- expect(userOne.user.avatar).toBe(userTwo.user.avatar);
- expect(userOne.user.banner).toBe(userTwo.user.banner);
- expect(userOne.user.published).toBe(userTwo.user.published);
+function assertUserFederation(userOne: PersonViewSafe, userTwo: PersonViewSafe) {
+ expect(userOne.person.name).toBe(userTwo.person.name);
+ expect(userOne.person.preferred_username).toBe(userTwo.person.preferred_username);
+ expect(userOne.person.bio).toBe(userTwo.person.bio);
+ expect(userOne.person.actor_id).toBe(userTwo.person.actor_id);
+ expect(userOne.person.avatar).toBe(userTwo.person.avatar);
+ expect(userOne.person.banner).toBe(userTwo.person.banner);
+ expect(userOne.person.published).toBe(userTwo.person.published);
}
test('Create user', async () => {
let site = await getSite(alpha, auth);
expect(site.my_user).toBeDefined();
- apShortname = `@${site.my_user.name}@lemmy-alpha:8541`;
+ apShortname = `@${site.my_user.person.name}@lemmy-alpha:8541`;
});
test('Set some user settings, check that they are federated', async () => {
dependencies:
language-subtag-registry "~0.3.2"
-lemmy-js-client@0.9.1-rc.1:
- version "0.9.1-rc.1"
- resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.9.1-rc.1.tgz#afe3cb0d4852f849dd087a4756a3771bc920a907"
- integrity sha512-aVvo4IeJvIPUvypipk4GnyLB6nVQVLfB0arYrMkVV4L7zrZ/0pGtpkMDLaOAj/KpA6O0u9eLmaou5RberZQolA==
+lemmy-js-client@0.10.0-rc.4:
+ version "0.10.0-rc.4"
+ resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.10.0-rc.4.tgz#ac6fe6940fc5f73260ddb166ce0ef3c0520901fc"
+ integrity sha512-yJPnvGaWneOOwjKEqb4qXtQk+4DbRgO+hEzSin2GgUgnxluY43gemwiCPt6EnV+j4ueKoi0+QORVg2RuRC2PaQ==
leven@^3.1.0:
version "3.1.0"