Apply suggestions from code review

Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
This commit is contained in:
Nutomic 2024-03-27 13:34:02 +01:00 committed by GitHub
parent 8d3498d288
commit c275db4c03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View file

@ -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();

View file

@ -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);

View file

@ -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.