for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
psql "$LEMMY_DATABASE_URL" -c "DROP DATABASE $INSTANCE"
-done
\ No newline at end of file
+done
createCommunity,
registerUser,
API,
- delay,
- longDelay,
} from './shared';
import {
Comment,
await followBeta(alpha);
await followBeta(gamma);
let search = await searchForBetaCommunity(alpha);
- await longDelay();
postRes = await createPost(
alpha,
search.communities.filter(c => c.local == false)[0].id
expect(commentRes.comment.community_local).toBe(false);
expect(commentRes.comment.creator_local).toBe(true);
expect(commentRes.comment.score).toBe(1);
- await longDelay();
// Make sure that comment is liked on beta
let searchBeta = await searchComment(beta, commentRes.comment);
let searchBeta = await searchComment(beta, commentRes.comment);
assertCommentFederation(searchBeta.comments[0], commentRes.comment);
- await delay();
let updateCommentRes = await updateComment(alpha, commentRes.comment.id);
expect(updateCommentRes.comment.content).toBe(
'A jest test federated comment update'
);
expect(updateCommentRes.comment.community_local).toBe(false);
expect(updateCommentRes.comment.creator_local).toBe(true);
- await delay();
// Make sure that post is updated on beta
let searchBetaUpdated = await searchComment(beta, commentRes.comment);
test('Delete a comment', async () => {
let commentRes = await createComment(alpha, postRes.post.id);
- await delay();
let deleteCommentRes = await deleteComment(
alpha,
commentRes.comment.id
);
expect(deleteCommentRes.comment.deleted).toBe(true);
- await delay();
// Make sure that comment is undefined on beta
let searchBeta = await searchComment(beta, commentRes.comment);
let betaComment = searchBeta.comments[0];
expect(betaComment).toBeUndefined();
- await delay();
let undeleteCommentRes = await deleteComment(
alpha,
commentRes.comment.id
);
expect(undeleteCommentRes.comment.deleted).toBe(false);
- await delay();
// Make sure that comment is undeleted on beta
let searchBeta2 = await searchComment(beta, commentRes.comment);
test('Remove a comment from admin and community on the same instance', async () => {
let commentRes = await createComment(alpha, postRes.post.id);
- await delay();
// Get the id for beta
let betaCommentId = (await searchComment(beta, commentRes.comment))
// The beta admin removes it (the community lives on beta)
let removeCommentRes = await removeComment(beta, true, betaCommentId);
expect(removeCommentRes.comment.removed).toBe(true);
- await longDelay();
// Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
let refetchedPost = await getPost(alpha, postRes.post.id);
let unremoveCommentRes = await removeComment(beta, false, betaCommentId);
expect(unremoveCommentRes.comment.removed).toBe(false);
- await longDelay();
// Make sure that comment is unremoved on beta
let refetchedPost2 = await getPost(alpha, postRes.post.id);
// New alpha user creates a community, post, and comment.
let newCommunity = await createCommunity(newAlphaApi);
- await delay();
let newPost = await createPost(newAlphaApi, newCommunity.community.id);
- await delay();
let commentRes = await createComment(newAlphaApi, newPost.post.id);
expect(commentRes.comment.content).toBeDefined();
- await delay();
// Beta searches that to cache it, then removes it
let searchBeta = await searchComment(beta, commentRes.comment);
let betaComment = searchBeta.comments[0];
let removeCommentRes = await removeComment(beta, true, betaComment.id);
expect(removeCommentRes.comment.removed).toBe(true);
- await delay();
// Make sure its not removed on alpha
let refetchedPost = await getPost(newAlphaApi, newPost.post.id);
test('Unlike a comment', async () => {
let commentRes = await createComment(alpha, postRes.post.id);
- await delay();
let unlike = await likeComment(alpha, 0, commentRes.comment);
expect(unlike.comment.score).toBe(0);
- await delay();
// Make sure that post is unliked on beta
let searchBeta = await searchComment(beta, commentRes.comment);
test('Federated comment like', async () => {
let commentRes = await createComment(alpha, postRes.post.id);
- await longDelay();
// Find the comment on beta
let searchBeta = await searchComment(beta, commentRes.comment);
let like = await likeComment(beta, 1, betaComment);
expect(like.comment.score).toBe(2);
- await longDelay();
// Get the post from alpha, check the likes
let post = await getPost(alpha, postRes.post.id);
test('Reply to a comment', async () => {
// Create a comment on alpha, find it on beta
let commentRes = await createComment(alpha, postRes.post.id);
- await delay();
let searchBeta = await searchComment(beta, commentRes.comment);
let betaComment = searchBeta.comments[0];
expect(replyRes.comment.creator_local).toBe(true);
expect(replyRes.comment.parent_id).toBe(betaComment.id);
expect(replyRes.comment.score).toBe(1);
- await longDelay();
// Make sure that comment is seen on alpha
// TODO not sure why, but a searchComment back to alpha, for the ap_id of betas
// Create a mention on alpha
let mentionContent = 'A test mention of @lemmy_beta@lemmy-beta:8551';
let commentRes = await createComment(alpha, postRes.post.id);
- await delay();
let mentionRes = await createComment(
alpha,
postRes.post.id,
expect(mentionRes.comment.community_local).toBe(false);
expect(mentionRes.comment.creator_local).toBe(true);
expect(mentionRes.comment.score).toBe(1);
- await delay();
let mentionsRes = await getMentions(beta);
expect(mentionsRes.mentions[0].content).toBeDefined();
test('Comment Search', async () => {
let commentRes = await createComment(alpha, postRes.post.id);
- await delay();
let searchBeta = await searchComment(beta, commentRes.comment);
assertCommentFederation(searchBeta.comments[0], commentRes.comment);
});
// Create a local post
let alphaPost = await createPost(alpha, 2);
expect(alphaPost.post.community_local).toBe(true);
- await delay();
// Make sure gamma sees it
let search = await searchPost(gamma, alphaPost.post);
expect(commentRes.comment.community_local).toBe(false);
expect(commentRes.comment.creator_local).toBe(true);
expect(commentRes.comment.score).toBe(1);
- await longDelay();
// Make sure alpha sees it
let alphaPost2 = await getPost(alpha, alphaPost.post.id);
expect(alphaPost2.comments[0].creator_local).toBe(false);
expect(alphaPost2.comments[0].score).toBe(1);
assertCommentFederation(alphaPost2.comments[0], commentRes.comment);
- await delay();
// Make sure beta has mentions
let mentionsRes = await getMentions(beta);
// B creates a post, and two comments, should be invisible to A
let postRes = await createPost(beta, 2);
expect(postRes.post.name).toBeDefined();
- await delay();
let parentCommentContent = 'An invisible top level comment from beta';
let parentCommentRes = await createComment(
parentCommentContent
);
expect(parentCommentRes.comment.content).toBe(parentCommentContent);
- await delay();
// B creates a comment, then a child one of that.
let childCommentContent = 'An invisible child comment from beta';
childCommentContent
);
expect(childCommentRes.comment.content).toBe(childCommentContent);
- await delay();
// Follow beta again
let follow = await followBeta(alpha);
expect(follow.community.local).toBe(false);
expect(follow.community.name).toBe('main');
- await delay();
// An update to the child comment on beta, should push the post, parent, and child to alpha now
let updatedCommentContent = 'An update child comment from beta';
updatedCommentContent
);
expect(updateRes.comment.content).toBe(updatedCommentContent);
- await delay();
// Get the post from alpha
let search = await searchPost(alpha, postRes.post);
let alphaPostB = search.posts[0];
- await longDelay();
let alphaPost = await getPost(alpha, alphaPostB.id);
expect(alphaPost.post.name).toBeDefined();
alpha,
beta,
setupLogins,
- searchForBetaCommunity,
searchForCommunity,
createCommunity,
deleteCommunity,
removeCommunity,
getCommunity,
followCommunity,
- delay,
- longDelay,
} from './shared';
import {
Community,
let prevName = communityRes.community.name;
let communityRes2 = await createCommunity(alpha, prevName);
expect(communityRes2['error']).toBe('community_already_exists');
- await delay();
// Cache the community on beta, make sure it has the other fields
let searchShort = `!${prevName}@lemmy-alpha:8541`;
test('Delete community', async () => {
let communityRes = await createCommunity(beta);
- await delay();
// Cache the community on Alpha
let searchShort = `!${communityRes.community.name}@lemmy-beta:8551`;
let search = await searchForCommunity(alpha, searchShort);
let communityOnAlpha = search.communities[0];
assertCommunityFederation(communityOnAlpha, communityRes.community);
- await delay();
// Follow the community from alpha
let follow = await followCommunity(alpha, true, communityOnAlpha.id);
// Make sure the follow response went through
expect(follow.community.local).toBe(false);
- await delay();
let deleteCommunityRes = await deleteCommunity(
beta,
communityRes.community.id
);
expect(deleteCommunityRes.community.deleted).toBe(true);
- await delay();
// Make sure it got deleted on A
let communityOnAlphaDeleted = await getCommunity(alpha, communityOnAlpha.id);
expect(communityOnAlphaDeleted.community.deleted).toBe(true);
- await delay();
// Undelete
let undeleteCommunityRes = await deleteCommunity(
communityRes.community.id
);
expect(undeleteCommunityRes.community.deleted).toBe(false);
- await delay();
// Make sure it got undeleted on A
let communityOnAlphaUnDeleted = await getCommunity(alpha, communityOnAlpha.id);
test('Remove community', async () => {
let communityRes = await createCommunity(beta);
- await delay();
// Cache the community on Alpha
let searchShort = `!${communityRes.community.name}@lemmy-beta:8551`;
let search = await searchForCommunity(alpha, searchShort);
let communityOnAlpha = search.communities[0];
assertCommunityFederation(communityOnAlpha, communityRes.community);
- await delay();
// Follow the community from alpha
let follow = await followCommunity(alpha, true, communityOnAlpha.id);
// Make sure the follow response went through
expect(follow.community.local).toBe(false);
- await delay();
let removeCommunityRes = await removeCommunity(
beta,
communityRes.community.id
);
expect(removeCommunityRes.community.removed).toBe(true);
- await delay();
// Make sure it got Removed on A
let communityOnAlphaRemoved = await getCommunity(alpha, communityOnAlpha.id);
expect(communityOnAlphaRemoved.community.removed).toBe(true);
- await delay();
// unremove
let unremoveCommunityRes = await removeCommunity(
communityRes.community.id
);
expect(unremoveCommunityRes.community.removed).toBe(false);
- await delay();
// Make sure it got undeleted on A
let communityOnAlphaUnRemoved = await getCommunity(alpha, communityOnAlpha.id);
test('Search for beta community', async () => {
let communityRes = await createCommunity(beta);
expect(communityRes.community.name).toBeDefined();
- await delay();
let searchShort = `!${communityRes.community.name}@lemmy-beta:8551`;
let search = await searchForCommunity(alpha, searchShort);
followCommunity,
checkFollowedCommunities,
unfollowRemotes,
- delay,
- longDelay,
} from './shared';
beforeAll(async () => {
// Make sure the follow response went through
expect(follow.community.local).toBe(false);
expect(follow.community.name).toBe('main');
- await longDelay();
// Check it from local
let followCheck = await checkFollowedCommunities(alpha);
- await delay();
let remoteCommunityId = followCheck.communities.filter(
c => c.community_local == false
)[0].community_id;
// Test an unfollow
let unfollow = await followCommunity(alpha, false, remoteCommunityId);
expect(unfollow.community.local).toBe(false);
- await delay();
// Make sure you are unsubbed locally
let unfollowCheck = await checkFollowedCommunities(alpha);
removePost,
getPost,
unfollowRemotes,
- delay,
- longDelay,
searchForUser,
banUserFromSite,
searchPostLocal,
} from './shared';
import {
Post,
+ Community,
} from 'lemmy-js-client';
+let betaCommunity: Community;
+
beforeAll(async () => {
await setupLogins();
- await followBeta(alpha);
- await followBeta(gamma);
- await followBeta(delta);
- await followBeta(epsilon);
- await longDelay();
+ let search = await searchForBetaCommunity(alpha);
+ betaCommunity = search.communities[0];
});
afterAll(async () => {
}
test('Create a post', async () => {
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
+ let postRes = await createPost(alpha, betaCommunity.id);
expect(postRes.post).toBeDefined();
expect(postRes.post.community_local).toBe(false);
expect(postRes.post.creator_local).toBe(true);
expect(postRes.post.score).toBe(1);
- await delay();
// Make sure that post is liked on beta
let searchBeta = await searchPost(beta, postRes.post);
});
test('Unlike a post', async () => {
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
+ let postRes = await createPost(alpha, betaCommunity.id);
let unlike = await likePost(alpha, 0, postRes.post);
expect(unlike.post.score).toBe(0);
});
test('Update a post', async () => {
- let search = await searchForBetaCommunity(alpha);
- let postRes = await createPost(alpha, search.communities[0].id);
- await delay();
+ let postRes = await createPost(alpha, betaCommunity.id);
let updatedName = 'A jest test federated post, updated';
let updatedPost = await updatePost(alpha, postRes.post);
expect(updatedPost.post.name).toBe(updatedName);
expect(updatedPost.post.community_local).toBe(false);
expect(updatedPost.post.creator_local).toBe(true);
- await delay();
// Make sure that post is updated on beta
let searchBeta = await searchPost(beta, postRes.post);
expect(betaPost.creator_local).toBe(false);
expect(betaPost.name).toBe(updatedName);
assertPostFederation(betaPost, updatedPost.post);
- await delay();
// Make sure lemmy beta cannot update the post
let updatedPostBeta = await updatePost(beta, betaPost);
});
test('Sticky a post', async () => {
- let search = await searchForBetaCommunity(alpha);
- let postRes = await createPost(alpha, search.communities[0].id);
- await delay();
+ let postRes = await createPost(alpha, betaCommunity.id);
let stickiedPostRes = await stickyPost(alpha, true, postRes.post);
expect(stickiedPostRes.post.stickied).toBe(true);
- await delay();
-
// Make sure that post is stickied on beta
let searchBeta = await searchPost(beta, postRes.post);
let betaPost = searchBeta.posts[0];
expect(betaPost.community_local).toBe(true);
expect(betaPost.creator_local).toBe(false);
expect(betaPost.stickied).toBe(true);
- await delay();
// Unsticky a post
let unstickiedPost = await stickyPost(alpha, false, postRes.post);
expect(unstickiedPost.post.stickied).toBe(false);
- await delay();
// Make sure that post is unstickied on beta
let searchBeta2 = await searchPost(beta, postRes.post);
expect(betaPost2.community_local).toBe(true);
expect(betaPost2.creator_local).toBe(false);
expect(betaPost2.stickied).toBe(false);
- await delay();
// Make sure that gamma cannot sticky the post on beta
let searchGamma = await searchPost(gamma, postRes.post);
let gammaPost = searchGamma.posts[0];
- await delay();
let gammaTrySticky = await stickyPost(gamma, true, gammaPost);
- await delay();
let searchBeta3 = await searchPost(beta, postRes.post);
let betaPost3 = searchBeta3.posts[0];
expect(gammaTrySticky.post.stickied).toBe(true);
});
test('Lock a post', async () => {
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
- await delay();
+ let postRes = await createPost(alpha, betaCommunity.id);
// Lock the post
let lockedPostRes = await lockPost(alpha, true, postRes.post);
expect(lockedPostRes.post.locked).toBe(true);
- await delay();
// Make sure that post is locked on beta
let searchBeta = await searchPostLocal(beta, postRes.post);
let betaPost1 = searchBeta.posts[0];
expect(betaPost1.locked).toBe(true);
- await delay();
// Try to make a new comment there, on alpha
let comment = await createComment(alpha, postRes.post.id);
expect(comment['error']).toBe('locked');
- await delay();
// Unlock a post
let unlockedPost = await lockPost(alpha, false, postRes.post);
expect(unlockedPost.post.locked).toBe(false);
- await delay();
// Make sure that post is unlocked on beta
let searchBeta2 = await searchPost(beta, postRes.post);
expect(betaPost2.community_local).toBe(true);
expect(betaPost2.creator_local).toBe(false);
expect(betaPost2.locked).toBe(false);
- await delay();
// Try to create a new comment, on beta
let commentBeta = await createComment(beta, betaPost2.id);
});
test('Delete a post', async () => {
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
+ let postRes = await createPost(alpha, betaCommunity.id);
let deletedPost = await deletePost(alpha, true, postRes.post);
expect(deletedPost.post.deleted).toBe(true);
});
test('Remove a post from admin and community on different instance', async () => {
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
- await delay();
+ let postRes = await createPost(alpha, betaCommunity.id);
let removedPost = await removePost(alpha, true, postRes.post);
expect(removedPost.post.removed).toBe(true);
- await delay();
// Make sure lemmy beta sees post is NOT removed
let searchBeta = await searchPost(beta, postRes.post);
let betaPost = searchBeta.posts[0];
expect(betaPost.removed).toBe(false);
- await delay();
// Undelete
let undeletedPost = await removePost(alpha, false, postRes.post);
expect(undeletedPost.post.removed).toBe(false);
- await delay();
// Make sure lemmy beta sees post is undeleted
let searchBeta2 = await searchPost(beta, postRes.post);
});
test('Remove a post from admin and community on same instance', async () => {
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
- await delay();
+ let postRes = await createPost(alpha, betaCommunity.id);
// Get the id for beta
let searchBeta = await searchPost(beta, postRes.post);
let betaPost = searchBeta.posts[0];
- await delay();
+
+ await followBeta(alpha);
// The beta admin removes it (the community lives on beta)
let removePostRes = await removePost(beta, true, betaPost);
expect(removePostRes.post.removed).toBe(true);
- await delay();
// Make sure lemmy alpha sees post is removed
let alphaPost = await getPost(alpha, postRes.post.id);
expect(alphaPost.post.removed).toBe(true);
assertPostFederation(alphaPost.post, removePostRes.post);
- await delay();
// Undelete
let undeletedPost = await removePost(beta, false, betaPost);
expect(undeletedPost.post.removed).toBe(false);
- await delay();
// Make sure lemmy alpha sees post is undeleted
let alphaPost2 = await getPost(alpha, postRes.post.id);
expect(alphaPost2.post.removed).toBe(false);
assertPostFederation(alphaPost2.post, undeletedPost.post);
+ await unfollowRemotes(alpha);
});
test('Search for a post', async () => {
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
- await delay();
+ let postRes = await createPost(alpha, betaCommunity.id);
let searchBeta = await searchPost(beta, postRes.post);
expect(searchBeta.posts[0].name).toBeDefined();
});
test('A and G subscribe to B (center) A posts, it gets announced to G', async () => {
- let search = await searchForBetaCommunity(alpha);
- let postRes = await createPost(alpha, search.communities[0].id);
- await delay();
+ let postRes = await createPost(alpha, betaCommunity.id);
let search2 = await searchPost(gamma, postRes.post);
expect(search2.posts[0].name).toBeDefined();
let userSearch = await searchForUser(beta, alphaShortname);
let alphaUser = userSearch.users[0];
expect(alphaUser).toBeDefined();
- await delay();
// ban alpha from beta site
let banAlpha = await banUserFromSite(beta, alphaUser.id, true);
expect(banAlpha.banned).toBe(true);
- await delay();
// Alpha makes post on beta
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
+ let postRes = await createPost(alpha, betaCommunity.id);
expect(postRes.post).toBeDefined();
expect(postRes.post.community_local).toBe(false);
expect(postRes.post.creator_local).toBe(true);
expect(postRes.post.score).toBe(1);
- await delay();
// Make sure that post doesn't make it to beta
let searchBeta = await searchPostLocal(beta, postRes.post);
let betaPost = searchBeta.posts[0];
expect(betaPost).toBeUndefined();
- await delay();
// Unban alpha
let unBanAlpha = await banUserFromSite(beta, alphaUser.id, false);
let userSearch = await searchForUser(beta, alphaShortname);
let alphaUser = userSearch.users[0];
expect(alphaUser).toBeDefined();
- await delay();
// ban alpha from beta site
await banUserFromCommunity(beta, alphaUser.id, 2, false);
let banAlpha = await banUserFromCommunity(beta, alphaUser.id, 2, true);
expect(banAlpha.banned).toBe(true);
- await delay();
// Alpha makes post on beta
- let search = await searchForBetaCommunity(alpha);
- await delay();
- let postRes = await createPost(alpha, search.communities[0].id);
+ let postRes = await createPost(alpha, betaCommunity.id);
expect(postRes.post).toBeDefined();
expect(postRes.post.community_local).toBe(false);
expect(postRes.post.creator_local).toBe(true);
expect(postRes.post.score).toBe(1);
- await delay();
// Make sure that post doesn't make it to beta community
let searchBeta = await searchPostLocal(beta, postRes.post);
listPrivateMessages,
deletePrivateMessage,
unfollowRemotes,
- delay,
- longDelay,
} from './shared';
let recipient_id: number;
beforeAll(async () => {
await setupLogins();
let follow = await followBeta(alpha);
- await longDelay();
recipient_id = follow.community.creator_id;
});
expect(pmRes.message.local).toBe(true);
expect(pmRes.message.creator_local).toBe(true);
expect(pmRes.message.recipient_local).toBe(false);
- await delay();
let betaPms = await listPrivateMessages(beta);
expect(betaPms.messages[0].content).toBeDefined();
let pmRes = await createPrivateMessage(alpha, recipient_id);
let pmUpdated = await updatePrivateMessage(alpha, pmRes.message.id);
expect(pmUpdated.message.content).toBe(updatedContent);
- await longDelay();
let betaPms = await listPrivateMessages(beta);
expect(betaPms.messages[0].content).toBe(updatedContent);
test('Delete a private message', async () => {
let pmRes = await createPrivateMessage(alpha, recipient_id);
- await delay();
let betaPms1 = await listPrivateMessages(beta);
let deletedPmRes = await deletePrivateMessage(alpha, true, pmRes.message.id);
expect(deletedPmRes.message.deleted).toBe(true);
- await delay();
// The GetPrivateMessages filters out deleted,
// even though they are in the actual database.
// no reason to show them
let betaPms2 = await listPrivateMessages(beta);
expect(betaPms2.messages.length).toBe(betaPms1.messages.length - 1);
- await delay();
// Undelete
let undeletedPmRes = await deletePrivateMessage(
pmRes.message.id
);
expect(undeletedPmRes.message.deleted).toBe(false);
- await longDelay();
let betaPms3 = await listPrivateMessages(beta);
expect(betaPms3.messages.length).toBe(betaPms1.messages.length);
}
export async function followBeta(api: API): Promise<CommunityResponse> {
- await unfollowRemotes(api);
-
// Cache it
let search = await searchForBetaCommunity(api);
let com = search.communities.filter(c => c.local == false);
export function delay(millis: number = 500) {
return new Promise((resolve, _reject) => {
- setTimeout(_ => resolve(), 10);
+ setTimeout(_ => resolve(), millis);
});
}
beta,
registerUser,
searchForUser,
- saveUserSettingsBio,
saveUserSettings,
getSite,
} from './shared';
apShortname = `@${site.my_user.name}@lemmy-alpha:8541`;
});
-test('Save user settings, check changed bio from beta', async () => {
- let bio = 'a changed bio';
- let userRes = await saveUserSettingsBio(alpha, auth);
- expect(userRes.jwt).toBeDefined();
-
- let site = await getSite(alpha, auth);
- expect(site.my_user.bio).toBe(bio);
- let searchAlpha = await searchForUser(alpha, site.my_user.actor_id);
-
- // Make sure beta sees this bio is changed
- let searchBeta = await searchForUser(beta, apShortname);
- assertUserFederation(searchAlpha.users[0], searchBeta.users[0]);
-});
-
-test('Set avatar and banner, check that they are federated', async () => {
+test('Set some user settings, check that they are federated', async () => {
let avatar = 'https://image.flaticon.com/icons/png/512/35/35896.png';
let banner = 'https://image.flaticon.com/icons/png/512/36/35896.png';
+ let bio = 'a changed bio';
let form: UserSettingsForm = {
show_nsfw: false,
theme: "",
preferred_username: "user321",
show_avatars: false,
send_notifications_to_email: false,
+ bio,
auth,
}
- let settingsRes = await saveUserSettings(alpha, form);
+ await saveUserSettings(alpha, form);
- let searchAlpha = await searchForUser(beta, apShortname);
+ let searchAlpha = await searchForUser(alpha, apShortname);
let userOnAlpha = searchAlpha.users[0];
let searchBeta = await searchForUser(beta, apShortname);
let userOnBeta = searchBeta.users[0];
use crate::{settings::Settings, APIError};
use actix_web::dev::ConnectionInfo;
-use chrono::{DateTime, FixedOffset, Local, NaiveDateTime};
+use chrono::{DateTime, FixedOffset, NaiveDateTime};
use itertools::Itertools;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use regex::{Regex, RegexBuilder};
}
pub fn convert_datetime(datetime: NaiveDateTime) -> DateTime<FixedOffset> {
- let now = Local::now();
- DateTime::<FixedOffset>::from_utc(datetime, *now.offset())
+ DateTime::<FixedOffset>::from_utc(datetime, FixedOffset::east(0))
}
pub fn remove_slurs(test: &str) -> String {