* Correctly synchronize collection of community featured posts (fixes #3867) * Add api test for synchronizing featured posts (ref #4475) * prettier
This commit is contained in:
parent
e01ea32928
commit
ab4deaa49a
3 changed files with 2152 additions and 967 deletions
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@ export RUST_LOG="warn,lemmy_server=$LEMMY_LOG_LEVEL,lemmy_federate=$LEMMY_LOG_LE
|
||||||
export LEMMY_TEST_FAST_FEDERATION=1 # by default, the persistent federation queue has delays in the scale of 30s-5min
|
export LEMMY_TEST_FAST_FEDERATION=1 # by default, the persistent federation queue has delays in the scale of 30s-5min
|
||||||
|
|
||||||
# pictrs setup
|
# pictrs setup
|
||||||
if [ ! -f "pict-rs" ]; then
|
if [ ! -f "api_tests/pict-rs" ]; then
|
||||||
curl "https://git.asonix.dog/asonix/pict-rs/releases/download/v0.5.0-beta.2/pict-rs-linux-amd64" -o api_tests/pict-rs
|
curl "https://git.asonix.dog/asonix/pict-rs/releases/download/v0.5.0-beta.2/pict-rs-linux-amd64" -o api_tests/pict-rs
|
||||||
chmod +x api_tests/pict-rs
|
chmod +x api_tests/pict-rs
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -37,9 +37,11 @@ import {
|
||||||
waitForPost,
|
waitForPost,
|
||||||
alphaUrl,
|
alphaUrl,
|
||||||
loginUser,
|
loginUser,
|
||||||
|
createCommunity,
|
||||||
|
getPosts,
|
||||||
} from "./shared";
|
} from "./shared";
|
||||||
import { PostView } from "lemmy-js-client/dist/types/PostView";
|
import { PostView } from "lemmy-js-client/dist/types/PostView";
|
||||||
import { EditSite, ResolveObject } from "lemmy-js-client";
|
import { EditSite, ListingType, ResolveObject } from "lemmy-js-client";
|
||||||
|
|
||||||
let betaCommunity: CommunityView | undefined;
|
let betaCommunity: CommunityView | undefined;
|
||||||
|
|
||||||
|
@ -225,6 +227,26 @@ test("Sticky a post", async () => {
|
||||||
expect(betaPost3?.post.featured_community).toBe(false);
|
expect(betaPost3?.post.featured_community).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Collection of featured posts gets federated", async () => {
|
||||||
|
// create a new community and feature a post
|
||||||
|
let community = await createCommunity(alpha);
|
||||||
|
let post = await createPost(alpha, community.community_view.community.id);
|
||||||
|
let featuredPost = await featurePost(alpha, true, post.post_view.post);
|
||||||
|
expect(featuredPost.post_view.post.featured_community).toBe(true);
|
||||||
|
|
||||||
|
// fetch the community, ensure that post is also fetched and marked as featured
|
||||||
|
let betaCommunity = await resolveCommunity(
|
||||||
|
beta,
|
||||||
|
community.community_view.community.actor_id,
|
||||||
|
);
|
||||||
|
|
||||||
|
const betaPost = await waitForPost(
|
||||||
|
beta,
|
||||||
|
post.post_view.post,
|
||||||
|
post => post?.post.featured_community === true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("Lock a post", async () => {
|
test("Lock a post", async () => {
|
||||||
if (!betaCommunity) {
|
if (!betaCommunity) {
|
||||||
throw "Missing beta community";
|
throw "Missing beta community";
|
||||||
|
|
Loading…
Reference in a new issue