diff --git a/api_tests/src/image.spec.ts b/api_tests/src/image.spec.ts index 3a82b572d..457d38d4e 100644 --- a/api_tests/src/image.spec.ts +++ b/api_tests/src/image.spec.ts @@ -239,7 +239,7 @@ test("No image proxying if setting is disabled", async () => { let betaPost = await waitForPost( beta, post.post_view.post, - res => res?.post.alt_text != null, + res => res?.post.alt_text !== null, ); expect(betaPost.post).toBeDefined(); diff --git a/api_tests/src/post.spec.ts b/api_tests/src/post.spec.ts index 0433ce890..c1640e93e 100644 --- a/api_tests/src/post.spec.ts +++ b/api_tests/src/post.spec.ts @@ -59,12 +59,12 @@ async function assertPostFederation(postOne: PostView, postTwo: PostView) { // Link metadata is generated in background task and may not be ready yet at this time, // so wait for it explicitly. For removed posts we cant refetch anything. postOne = await waitForPost(beta, postOne.post, res => { - return res == null || res?.post.embed_title != null; + return res === null || res?.post.embed_title !== null; }); postTwo = await waitForPost( beta, postTwo.post, - res => res == null || res?.post.embed_title != null, + res => res === null || res?.post.embed_title !== null, ); expect(postOne?.post.ap_id).toBe(postTwo?.post.ap_id); diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index 15c177b53..84b58e3fc 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -104,7 +104,7 @@ pub fn generate_post_link_metadata( let allow_sensitive = local_site_opt_to_sensitive(&local_site); let page_is_sensitive = post.nsfw; let allow_generate_thumbnail = allow_sensitive || !page_is_sensitive; - let mut thumbnail_url = custom_thumbnail.or(post.thumbnail_url.map(Into::into)); + let mut thumbnail_url = custom_thumbnail.or_else(|| post.thumbnail_url.map(Into::into)); let do_generate_thumbnail = thumbnail_url.is_none() && allow_generate_thumbnail; // Generate local thumbnail only if no thumbnail was federated and 'sensitive' attributes allow it.